Home
last modified time | relevance | path

Searched refs:nonce (Results 1 – 25 of 243) sorted by relevance

12345678910

/freebsd/sys/contrib/libsodium/test/default/
H A Dsodium_utils.c12 unsigned char nonce[24]; in main() local
33 memset(nonce, 0, sizeof nonce); in main()
34 sodium_increment(nonce, sizeof nonce); in main()
36 sodium_bin2hex(nonce_hex, sizeof nonce_hex, nonce, sizeof nonce)); in main()
37 memset(nonce, 255, sizeof nonce); in main()
38 sodium_increment(nonce, sizeof nonce); in main()
40 sodium_bin2hex(nonce_hex, sizeof nonce_hex, nonce, sizeof nonce)); in main()
41 nonce[1] = 1U; in main()
42 sodium_increment(nonce, sizeof nonce); in main()
44 sodium_bin2hex(nonce_hex, sizeof nonce_hex, nonce, sizeof nonce)); in main()
[all …]
H A Dxchacha20.c85 const char nonce[crypto_stream_xchacha20_NONCEBYTES * 2 + 1]; member
107 unsigned char *nonce; in tv_stream_xchacha20() local
114 nonce = (unsigned char *) sodium_malloc(crypto_stream_xchacha20_NONCEBYTES); in tv_stream_xchacha20()
121 sodium_hex2bin(nonce, crypto_stream_xchacha20_NONCEBYTES, in tv_stream_xchacha20()
122 tv->nonce, strlen(tv->nonce), NULL, NULL, NULL); in tv_stream_xchacha20()
126 crypto_stream_xchacha20(out2, out_len, nonce, key); in tv_stream_xchacha20()
128 crypto_stream_xchacha20_xor(out2, out, out_len, nonce, key); in tv_stream_xchacha20()
130 crypto_stream_xchacha20_xor_ic(out2, out, out_len, nonce, 0, key); in tv_stream_xchacha20()
132 crypto_stream_xchacha20_xor_ic(out2, out, out_len, nonce, 1, key); in tv_stream_xchacha20()
134 crypto_stream_xchacha20_xor(out, out, out_len, nonce, key); in tv_stream_xchacha20()
[all …]
H A Dchacha20.c23 unsigned char nonce[crypto_stream_chacha20_NONCEBYTES]; in tv() local
35 sodium_hex2bin(nonce, sizeof nonce, tests[i].nonce_hex, in tv()
37 crypto_stream_chacha20(out, sizeof out, nonce, key); in tv()
42 crypto_stream_chacha20_xor(part, out, plen, nonce, key); in tv()
52 crypto_stream_chacha20(out, plen, nonce, key); in tv()
57 crypto_stream_chacha20(out, sizeof out, nonce, key); in tv()
61 assert(crypto_stream_chacha20(out, 0U, nonce, key) == 0); in tv()
62 assert(crypto_stream_chacha20_xor(out, out, 0U, nonce, key) == 0); in tv()
63 assert(crypto_stream_chacha20_xor(out, out, 0U, nonce, key) == 0); in tv()
64 assert(crypto_stream_chacha20_xor_ic(out, out, 0U, nonce, 1U, key) == 0); in tv()
[all …]
H A Dbox_easy2.c19 unsigned char *nonce; in main() local
42 nonce = (unsigned char *) sodium_malloc(crypto_box_NONCEBYTES); in main()
49 randombytes_buf(nonce, crypto_box_NONCEBYTES); in main()
50 ret = crypto_box_easy(c, m, mlen, nonce, bobpk, alicesk); in main()
54 nonce, alicepk, bobsk) != 0) { in main()
61 if (crypto_box_open_easy(m2, c, (unsigned long long) i, nonce, alicepk, in main()
69 crypto_box_easy(c, c, (unsigned long long) mlen, nonce, bobpk, alicesk); in main()
75 nonce, alicepk, bobsk) != 0) { in main()
91 if (crypto_box_easy_afternm(c, m, 0, nonce, k1) != 0) { in main()
96 crypto_box_easy_afternm(c, m, (unsigned long long) mlen, nonce, k1); in main()
[all …]
H A Daead_chacha20poly1305.c20 static const unsigned char nonce[crypto_aead_chacha20poly1305_NPUBBYTES] in tv() local
35 NULL, nonce, firstkey); in tv()
49 NULL, nonce, firstkey); in tv()
59 nonce, firstkey) != 0) { in tv()
72 nonce, firstkey) == 0); in tv()
76 nonce, firstkey) != 0) { in tv()
86 ad, ADLEN, nonce, firstkey) in tv()
94 NULL, 0U, NULL, nonce, firstkey); in tv()
107 NULL, 0U, nonce, firstkey) != 0) { in tv()
120 NULL, 0U, nonce, firstkey) != -1) { in tv()
[all …]
H A Dsecretbox_easy2.c11 unsigned char *nonce; in main() local
21 nonce = (unsigned char *) sodium_malloc(crypto_secretbox_NONCEBYTES); in main()
26 randombytes_buf(nonce, crypto_secretbox_NONCEBYTES); in main()
27 crypto_secretbox_easy(c, m, (unsigned long long) mlen, nonce, k); in main()
29 m2, c, (unsigned long long) mlen + crypto_secretbox_MACBYTES, nonce, in main()
36 if (crypto_secretbox_open_easy(m2, c, (unsigned long long) i, nonce, in main()
42 crypto_secretbox_detached(c, mac, m, (unsigned long long) mlen, nonce, k); in main()
44 nonce, k) != 0) { in main()
48 nonce, k) != 0) { in main()
54 crypto_secretbox_easy(c, c, (unsigned long long) mlen, nonce, k); in main()
[all …]
H A Dsecretbox_easy.c11 static unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, variable
41 crypto_secretbox_easy(c, m, 131, nonce, firstkey); in main()
47 crypto_secretbox_detached(c, mac, m, 131, nonce, firstkey); in main()
59 crypto_secretbox_easy(c, c + 1, 131, nonce, firstkey); in main()
66 crypto_secretbox_easy(c + 1, c, 131, nonce, firstkey); in main()
73 crypto_secretbox_easy(c, c, 131, nonce, firstkey); in main()
79 assert(crypto_secretbox_easy(c, m, 0, nonce, firstkey) == 0); in main()
83 crypto_secretbox_easy(c, c, 0, nonce, firstkey); in main()
88 if (crypto_secretbox_open_easy(c, c, crypto_secretbox_MACBYTES, nonce, in main()
97 if (crypto_secretbox_open_easy(c, c, crypto_secretbox_MACBYTES, nonce, in main()
[all …]
H A Daead_xchacha20poly1305.c25 static const unsigned char nonce[crypto_aead_xchacha20poly1305_ietf_NPUBBYTES] in tv() local
44 NULL, nonce, firstkey); in tv()
59 NULL, nonce, firstkey); in tv()
68 ADLEN, nonce, firstkey) != 0) { in tv()
81 nonce, firstkey) != 0) { in tv()
91 ad, ADLEN, nonce, firstkey) in tv()
98 NULL, 0U, NULL, nonce, firstkey); in tv()
110 NULL, 0U, nonce, firstkey) != 0) { in tv()
123 NULL, 0U, nonce, firstkey) != -1) { in tv()
132 nonce, firstkey) != -1) { in tv()
[all …]
H A Dsecretbox2.c11 static unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, variable
41 if (crypto_secretbox_open(m, c, 163, nonce, firstkey) == 0) { in main()
49 assert(crypto_secretbox_open(m, c, 31, nonce, firstkey) == -1); in main()
50 assert(crypto_secretbox_open(m, c, 16, nonce, firstkey) == -1); in main()
51 assert(crypto_secretbox_open(m, c, 1, nonce, firstkey) == -1); in main()
52 assert(crypto_secretbox_open(m, c, 0, nonce, firstkey) == -1); in main()
H A Dsecretbox.c11 static unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, variable
41 crypto_secretbox(c, m, 163, nonce, firstkey); in main()
50 crypto_secretbox(c, c, 163, nonce, firstkey); in main()
58 assert(crypto_secretbox(c, c, 31, nonce, firstkey) == -1); in main()
59 assert(crypto_secretbox(c, c, 12, nonce, firstkey) == -1); in main()
60 assert(crypto_secretbox(c, c, 1, nonce, firstkey) == -1); in main()
61 assert(crypto_secretbox(c, c, 0, nonce, firstkey) == -1); in main()
H A Daead_aes256gcm.c3090 unsigned char *nonce; in tv() local
3102 nonce = (unsigned char *) sodium_malloc(crypto_aead_aes256gcm_NPUBBYTES); in tv()
3111 sodium_hex2bin(nonce, crypto_aead_aes256gcm_NPUBBYTES, in tv()
3141 ad, ad_len, NULL, nonce, key); in tv()
3157 ad, ad_len, NULL, nonce, key); in tv()
3174 ad, ad_len, nonce, key) != -1) { in tv()
3184 ad, ad_len, nonce, key) != -1) { in tv()
3190 ad, ad_len, nonce, key) != 0) { in tv()
3195 ad, ad_len, nonce, key) != 0) { in tv()
3206 mac, ad, ad_len, nonce, key) != 0) { in tv()
[all …]
H A Dstream.c11 static unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, variable
27 crypto_stream(output, sizeof output, nonce, firstkey); in main()
34 crypto_stream_xsalsa20_xor_ic(output, output, 4000, nonce, 0U, firstkey); in main()
38 crypto_stream_xsalsa20_xor_ic(output, output, 4000, nonce, 1U, firstkey); in main()
45 crypto_stream(output, (int) (i & 0xff), nonce, firstkey); in main()
51 crypto_stream_xsalsa20_xor_ic(output, output, 192, nonce, in main()
/freebsd/crypto/openssl/crypto/modes/
H A Dccm128.c30 memset(ctx->nonce.c, 0, sizeof(ctx->nonce.c)); in CRYPTO_ccm128_init()
31 ctx->nonce.c[0] = ((u8)(L - 1) & 7) | (u8)(((M - 2) / 2) & 7) << 3; in CRYPTO_ccm128_init()
41 const unsigned char *nonce, size_t nlen, size_t mlen) in CRYPTO_ccm128_setiv() argument
43 unsigned int L = ctx->nonce.c[0] & 7; /* the L parameter */ in CRYPTO_ccm128_setiv()
49 ctx->nonce.c[8] = (u8)(mlen >> (56 % (sizeof(mlen) * 8))); in CRYPTO_ccm128_setiv()
50 ctx->nonce.c[9] = (u8)(mlen >> (48 % (sizeof(mlen) * 8))); in CRYPTO_ccm128_setiv()
51 ctx->nonce.c[10] = (u8)(mlen >> (40 % (sizeof(mlen) * 8))); in CRYPTO_ccm128_setiv()
52 ctx->nonce.c[11] = (u8)(mlen >> (32 % (sizeof(mlen) * 8))); in CRYPTO_ccm128_setiv()
54 ctx->nonce.u[1] = 0; in CRYPTO_ccm128_setiv()
56 ctx->nonce.c[12] = (u8)(mlen >> 24); in CRYPTO_ccm128_setiv()
[all …]
/freebsd/sys/contrib/libsodium/src/libsodium/crypto_box/
H A Dcrypto_box_seal.c10 _crypto_box_seal_nonce(unsigned char *nonce, in _crypto_box_seal_nonce() argument
18 crypto_generichash_final(&st, nonce, crypto_box_NONCEBYTES); in _crypto_box_seal_nonce()
27 unsigned char nonce[crypto_box_NONCEBYTES]; in crypto_box_seal() local
36 _crypto_box_seal_nonce(nonce, epk, pk); in crypto_box_seal()
38 nonce, pk, esk); in crypto_box_seal()
41 sodium_memzero(nonce, sizeof nonce); in crypto_box_seal()
51 unsigned char nonce[crypto_box_NONCEBYTES]; in crypto_box_seal_open() local
56 _crypto_box_seal_nonce(nonce, c, pk); in crypto_box_seal_open()
61 nonce, c, sk); in crypto_box_seal_open()
/freebsd/sys/contrib/libsodium/src/libsodium/crypto_box/curve25519xchacha20poly1305/
H A Dbox_seal_curve25519xchacha20poly1305.c10 _crypto_box_curve25519xchacha20poly1305_seal_nonce(unsigned char *nonce, in _crypto_box_curve25519xchacha20poly1305_seal_nonce() argument
22 crypto_generichash_final(&st, nonce, in _crypto_box_curve25519xchacha20poly1305_seal_nonce()
33 unsigned char nonce[crypto_box_curve25519xchacha20poly1305_NONCEBYTES]; in crypto_box_curve25519xchacha20poly1305_seal() local
42 _crypto_box_curve25519xchacha20poly1305_seal_nonce(nonce, epk, pk); in crypto_box_curve25519xchacha20poly1305_seal()
45 nonce, pk, esk); in crypto_box_curve25519xchacha20poly1305_seal()
48 sodium_memzero(nonce, sizeof nonce); in crypto_box_curve25519xchacha20poly1305_seal()
59 unsigned char nonce[crypto_box_curve25519xchacha20poly1305_NONCEBYTES]; in crypto_box_curve25519xchacha20poly1305_seal_open() local
64 _crypto_box_curve25519xchacha20poly1305_seal_nonce(nonce, c, pk); in crypto_box_curve25519xchacha20poly1305_seal_open()
72 nonce, c, sk); in crypto_box_curve25519xchacha20poly1305_seal_open()
/freebsd/sys/opencrypto/
H A Dxform_chacha20_poly1305.c40 char nonce[CHACHA20_POLY1305_IV_LEN]; member
67 KASSERT(ivlen == 8 || ivlen == sizeof(ctx->nonce), in chacha20_poly1305_reinit()
70 memcpy(ctx->nonce, iv, ivlen); in chacha20_poly1305_reinit()
93 CHACHA20_NATIVE_BLOCK_LEN, ctx->nonce, ctx->ic, ctx->key); in chacha20_poly1305_crypt()
96 CHACHA20_NATIVE_BLOCK_LEN, ctx->nonce, ctx->ic, ctx->key); in chacha20_poly1305_crypt()
111 ctx->nonce, ctx->ic, ctx->key); in chacha20_poly1305_crypt_multi()
113 error = crypto_stream_chacha20_xor_ic(out, in, len, ctx->nonce, in chacha20_poly1305_crypt_multi()
129 ctx->nonce, ctx->ic, ctx->key); in chacha20_poly1305_crypt_last()
131 error = crypto_stream_chacha20_xor_ic(out, in, len, ctx->nonce, in chacha20_poly1305_crypt_last()
192 char nonce[CHACHA20_POLY1305_IV_LEN]; in xchacha20_poly1305_reinit() local
[all …]
/freebsd/crypto/openssl/doc/man3/
H A DOCSP_request_add1_nonce.pod5 OCSP_request_add1_nonce, OCSP_basic_add1_nonce, OCSP_check_nonce, OCSP_copy_nonce - OCSP nonce func…
18 OCSP_request_add1_nonce() adds a nonce of value B<val> and length B<len> to
19 OCSP request B<req>. If B<val> is B<NULL> a random nonce is used. If B<len>
23 it adds a nonce to OCSP basic response B<resp>.
25 OCSP_check_nonce() compares the nonce value in B<req> and B<resp>.
27 OCSP_copy_nonce() copies any nonce value present in B<req> to B<resp>.
34 OCSP_copy_nonce() returns 1 if a nonce was successfully copied, 2 if no nonce
37 OCSP_check_nonce() returns the result of the nonce comparison between B<req>
40 returned. If a nonce is present in the response only 3 is returned. If nonces
41 are present and unequal 0 is returned. If the nonce is present in the request
[all …]
/freebsd/contrib/libarchive/libarchive/
H A Darchive_cryptor.c171 memset(ctx->nonce, 0, sizeof(ctx->nonce)); in aes_ctr_init()
187 r = CCCryptorUpdate(ref, ctx->nonce, AES_BLOCK_SIZE, ctx->encr_buf, in aes_ctr_encrypt_counter()
196 memset(ctx->nonce, 0, sizeof(ctx->nonce)); in aes_ctr_release()
279 status = BCryptEncrypt(ctx->hKey, (PUCHAR)ctx->nonce, AES_BLOCK_SIZE, in aes_ctr_encrypt_counter()
309 memset(ctx->nonce, 0, sizeof(ctx->nonce)); in aes_ctr_init()
320 if (mbedtls_aes_crypt_ecb(&ctx->ctx, MBEDTLS_AES_ENCRYPT, ctx->nonce, in aes_ctr_encrypt_counter()
341 memset(ctx->nonce, 0, sizeof(ctx->nonce)); in aes_ctr_init()
352 aes_encrypt(&ctx->ctx, AES_BLOCK_SIZE, ctx->encr_buf, ctx->nonce); in aes_ctr_encrypt_counter()
358 ctx->nonce); in aes_ctr_encrypt_counter()
363 ctx->nonce); in aes_ctr_encrypt_counter()
[all …]
/freebsd/sys/dev/wg/
H A Dcrypto.h29 const uint64_t nonce, in chacha20poly1305_encrypt() argument
34 le64enc(nonce_bytes, nonce); in chacha20poly1305_encrypt()
42 const uint64_t nonce, in chacha20poly1305_decrypt() argument
47 le64enc(nonce_bytes, nonce); in chacha20poly1305_decrypt()
56 const uint8_t nonce[XCHACHA20POLY1305_NONCE_SIZE], in xchacha20poly1305_encrypt()
59 xchacha20_poly1305_encrypt(dst, src, src_len, ad, ad_len, nonce, key); in xchacha20poly1305_encrypt()
66 const uint8_t nonce[XCHACHA20POLY1305_NONCE_SIZE], in xchacha20poly1305_decrypt()
69 return (xchacha20_poly1305_decrypt(dst, src, src_len, ad, ad_len, nonce, key)); in xchacha20poly1305_decrypt()
73 chacha20poly1305_encrypt_mbuf(struct mbuf *, const uint64_t nonce,
77 chacha20poly1305_decrypt_mbuf(struct mbuf *, const uint64_t nonce,
/freebsd/contrib/unbound/dnscrypt/
H A Ddnscrypt.c66 uint8_t nonce[crypto_box_HALF_NONCEBYTES]; member
159 dnsc_nonce_cache_key_hash(const uint8_t nonce[crypto_box_HALF_NONCEBYTES], in dnsc_nonce_cache_key_hash()
164 h = hashlittle(nonce, crypto_box_HALF_NONCEBYTES, h); in dnsc_nonce_cache_key_hash()
180 const uint8_t nonce[crypto_box_HALF_NONCEBYTES], in dnsc_nonce_cache_insert()
192 memcpy(k->nonce, nonce, crypto_box_HALF_NONCEBYTES); in dnsc_nonce_cache_insert()
216 const uint8_t nonce[crypto_box_HALF_NONCEBYTES], in dnsc_nonces_lookup()
224 memcpy(k.nonce, nonce, crypto_box_HALF_NONCEBYTES); in dnsc_nonces_lookup()
252 uint8_t nonce[crypto_box_NONCEBYTES]; in dnscrypt_server_uncurve() local
269 query_header->nonce, in dnscrypt_server_uncurve()
276 query_header->nonce, in dnscrypt_server_uncurve()
[all …]
/freebsd/contrib/bearssl/src/ssl/
H A Dssl_rec_ccm.c73 unsigned char nonce[12], header[13]; in ccm_decrypt() local
82 memcpy(nonce, cc->iv, sizeof cc->iv); in ccm_decrypt()
83 memcpy(nonce + 4, data, 8); in ccm_decrypt()
97 br_ccm_reset(&zc, nonce, sizeof nonce, sizeof header, len, cc->tag_len); in ccm_decrypt()
154 unsigned char nonce[12], header[13]; in ccm_encrypt() local
164 memcpy(nonce, cc->iv, sizeof cc->iv); in ccm_encrypt()
165 br_enc64be(nonce + 4, cc->seq); in ccm_encrypt()
179 br_ccm_reset(&zc, nonce, sizeof nonce, sizeof header, len, cc->tag_len); in ccm_encrypt()
190 memcpy(buf + 5, nonce + 4, 8); in ccm_encrypt()
/freebsd/crypto/openssl/providers/implementations/ciphers/
H A Dcipher_aes_ccm_hw_s390x.inc25 sctx->ccm.s390x.nonce.b[0] = ((ctx->l - 1) & 0x7)
27 memset(sctx->ccm.s390x.nonce.b + 1, 0, sizeof(sctx->ccm.s390x.nonce.b));
34 const unsigned char *nonce, size_t noncelen,
39 sctx->ccm.s390x.nonce.b[0] &= ~S390X_CCM_AAD_FLAG;
40 sctx->ccm.s390x.nonce.g[1] = mlen;
41 memcpy(sctx->ccm.s390x.nonce.b + 1, nonce, 15 - ctx->l);
58 sctx->ccm.s390x.nonce.b[0] |= S390X_CCM_AAD_FLAG;
90 s390x_kmac(sctx->ccm.s390x.nonce.b, 32, sctx->ccm.s390x.fc,
126 flags = sctx->ccm.s390x.nonce.b[0];
128 s390x_km(sctx->ccm.s390x.nonce.b, 16, sctx->ccm.s390x.kmac.icv.b,
[all …]
/freebsd/sys/contrib/libsodium/src/libsodium/crypto_sign/ed25519/ref10/
H A Dsign.c71 unsigned char nonce[64]; in _crypto_sign_ed25519_detached() local
79 _crypto_sign_ed25519_synthetic_r_hv(&hs, nonce, az); in _crypto_sign_ed25519_detached()
86 crypto_hash_sha512_final(&hs, nonce); in _crypto_sign_ed25519_detached()
90 sc25519_reduce(nonce); in _crypto_sign_ed25519_detached()
91 ge25519_scalarmult_base(&R, nonce); in _crypto_sign_ed25519_detached()
101 sc25519_muladd(sig + 32, hram, az, nonce); in _crypto_sign_ed25519_detached()
104 sodium_memzero(nonce, sizeof nonce); in _crypto_sign_ed25519_detached()
/freebsd/contrib/bearssl/src/aead/
H A Deax.c193 br_eax_reset(br_eax_context *ctx, const void *nonce, size_t len) in br_eax_reset() argument
199 do_cbcmac_chunk(ctx, nonce, len); in br_eax_reset()
201 memcpy(ctx->nonce, ctx->cbcmac, sizeof ctx->cbcmac); in br_eax_reset()
218 const void *nonce, size_t len) in br_eax_reset_pre_aad() argument
225 do_cbcmac_chunk(ctx, nonce, len); in br_eax_reset_pre_aad()
228 memcpy(ctx->nonce, ctx->cbcmac, sizeof ctx->cbcmac); in br_eax_reset_pre_aad()
246 const void *nonce, size_t len) in br_eax_reset_post_aad() argument
253 do_cbcmac_chunk(ctx, nonce, len); in br_eax_reset_post_aad()
256 memcpy(ctx->nonce, ctx->cbcmac, sizeof ctx->cbcmac); in br_eax_reset_post_aad()
257 memcpy(ctx->ctr, ctx->nonce, sizeof ctx->nonce); in br_eax_reset_post_aad()
[all …]
/freebsd/contrib/wpa/src/crypto/
H A Daes-ccm.c28 static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce, in aes_ccm_auth_start() argument
40 os_memcpy(&b[1], nonce, 15 - L); in aes_ccm_auth_start()
84 static void aes_ccm_encr_start(size_t L, const u8 *nonce, u8 *a) in aes_ccm_encr_start() argument
88 os_memcpy(&a[1], nonce, 15 - L); in aes_ccm_encr_start()
148 int aes_ccm_ae(const u8 *key, size_t key_len, const u8 *nonce, in aes_ccm_ae() argument
163 aes_ccm_auth_start(aes, M, L, nonce, aad, aad_len, plain_len, x); in aes_ccm_ae()
167 aes_ccm_encr_start(L, nonce, a); in aes_ccm_ae()
178 int aes_ccm_ad(const u8 *key, size_t key_len, const u8 *nonce, in aes_ccm_ad() argument
195 aes_ccm_encr_start(L, nonce, a); in aes_ccm_ad()
201 aes_ccm_auth_start(aes, M, L, nonce, aad, aad_len, crypt_len, x); in aes_ccm_ad()

12345678910