/freebsd/sys/crypto/ |
H A D | chacha20_poly1305.c | 39 const size_t src_len, const uint8_t *aad, const size_t aad_len, in chacha20_poly1305_encrypt() argument 52 exf->update(ctx, aad, aad_len); in chacha20_poly1305_encrypt() 53 if (aad_len % POLY1305_BLOCK_LEN != 0) in chacha20_poly1305_encrypt() 55 POLY1305_BLOCK_LEN - aad_len % POLY1305_BLOCK_LEN); in chacha20_poly1305_encrypt() 75 lengths[0] = htole64(aad_len); in chacha20_poly1305_encrypt() 86 const size_t src_len, const uint8_t *aad, const size_t aad_len, in chacha20_poly1305_decrypt() argument 107 exf->update(ctx, aad, aad_len); in chacha20_poly1305_decrypt() 108 if (aad_len % POLY1305_BLOCK_LEN != 0) in chacha20_poly1305_decrypt() 110 POLY1305_BLOCK_LEN - aad_len % POLY1305_BLOCK_LEN); in chacha20_poly1305_decrypt() 116 u.lengths[0] = htole64(aad_len); in chacha20_poly1305_decrypt() [all …]
|
H A D | chacha20_poly1305.h | 39 const size_t src_len, const uint8_t *aad, const size_t aad_len, 43 const size_t src_len, const uint8_t *aad, const size_t aad_len, 47 const size_t src_len, const uint8_t *aad, const size_t aad_len, 51 const size_t src_len, const uint8_t *aad, const size_t aad_len,
|
/freebsd/tools/tools/crypto/ |
H A D | cryptocheck.c | 909 const char *aad, size_t aad_len, const char *input, char *output, in ocf_eta() argument 914 if (aad_len != 0) { in ocf_eta() 920 caead.aadlen = aad_len; in ocf_eta() 949 run_eta_test(const struct alg *alg, size_t aad_len, size_t size) in run_eta_test() argument 965 alg->name, aad_len, size, in run_eta_test() 991 cleartext = alloc_buffer(aad_len + size); in run_eta_test() 992 buffer = malloc(aad_len + size); in run_eta_test() 993 ciphertext = malloc(aad_len + size); in run_eta_test() 996 if (aad_len != 0) in run_eta_test() 997 memcpy(ciphertext, cleartext, aad_len); in run_eta_test() [all …]
|
/freebsd/contrib/wpa/src/crypto/ |
H A D | aes-ccm.c | 29 const u8 *aad, size_t aad_len, size_t plain_len, in aes_ccm_auth_start() argument 37 b[0] = aad_len ? 0x40 : 0 /* Adata */; in aes_ccm_auth_start() 46 if (!aad_len) in aes_ccm_auth_start() 49 WPA_PUT_BE16(aad_buf, aad_len); in aes_ccm_auth_start() 50 os_memcpy(aad_buf + 2, aad, aad_len); in aes_ccm_auth_start() 51 os_memset(aad_buf + 2 + aad_len, 0, sizeof(aad_buf) - 2 - aad_len); in aes_ccm_auth_start() 56 if (aad_len > AES_BLOCK_SIZE - 2) { in aes_ccm_auth_start() 150 const u8 *aad, size_t aad_len, u8 *crypt, u8 *auth) in aes_ccm_ae() argument 156 if (aad_len > 30 || M > AES_BLOCK_SIZE) in aes_ccm_ae() 163 aes_ccm_auth_start(aes, M, L, nonce, aad, aad_len, plain_len, x); in aes_ccm_ae() [all …]
|
H A D | aes-gcm.c | 229 static void aes_gcm_ghash(const u8 *H, const u8 *aad, size_t aad_len, in aes_gcm_ghash() argument 241 ghash(H, aad, aad_len, S); in aes_gcm_ghash() 243 WPA_PUT_BE64(len_buf, aad_len * 8); in aes_gcm_ghash() 256 const u8 *aad, size_t aad_len, u8 *crypt, u8 *tag) in aes_gcm_ae() argument 272 aes_gcm_ghash(H, aad, aad_len, crypt, plain_len, S); in aes_gcm_ae() 290 const u8 *aad, size_t aad_len, const u8 *tag, u8 *plain) in aes_gcm_ad() argument 306 aes_gcm_ghash(H, aad, aad_len, crypt, crypt_len, S); in aes_gcm_ad() 323 const u8 *aad, size_t aad_len, u8 *tag) in aes_gmac() argument 325 return aes_gcm_ae(key, key_len, iv, iv_len, NULL, 0, aad, aad_len, NULL, in aes_gmac()
|
H A D | aes_wrap.h | 55 const u8 *aad, size_t aad_len, 60 const u8 *aad, size_t aad_len, const u8 *tag, 64 const u8 *aad, size_t aad_len, u8 *tag); 67 const u8 *aad, size_t aad_len, u8 *crypt, u8 *auth); 70 const u8 *aad, size_t aad_len, const u8 *auth,
|
/freebsd/contrib/bearssl/src/aead/ |
H A D | ccm.c | 59 uint64_t aad_len, uint64_t data_len, size_t tag_len) in br_ccm_reset() argument 76 tmp[0] = (aad_len > 0 ? 0x40 : 0x00) in br_ccm_reset() 102 if ((aad_len >> 32) != 0) { in br_ccm_reset() 105 br_enc64be(ctx->buf + 2, aad_len); in br_ccm_reset() 107 } else if (aad_len >= 0xFF00) { in br_ccm_reset() 110 br_enc32be(ctx->buf + 2, (uint32_t)aad_len); in br_ccm_reset() 112 } else if (aad_len > 0) { in br_ccm_reset() 113 br_enc16be(ctx->buf, (unsigned)aad_len); in br_ccm_reset()
|
/freebsd/crypto/openssl/providers/implementations/ciphers/ |
H A D | ciphercommon_gcm_hw.c | 21 size_t aad_len) in ossl_gcm_aad_update() argument 23 return CRYPTO_gcm128_aad(&ctx->gcm, aad, aad_len) == 0; in ossl_gcm_aad_update() 51 int ossl_gcm_one_shot(PROV_GCM_CTX *ctx, unsigned char *aad, size_t aad_len, in ossl_gcm_one_shot() argument 58 if (!ctx->hw->aadupdate(ctx, aad, aad_len)) in ossl_gcm_one_shot()
|
H A D | cipher_rc4_hmac_md5_hw.c | 166 unsigned char *aad, size_t aad_len) in cipher_hw_rc4_hmac_md5_tls_init() argument 171 if (aad_len != EVP_AEAD_TLS1_AAD_LEN) in cipher_hw_rc4_hmac_md5_tls_init() 174 len = aad[aad_len - 2] << 8 | aad[aad_len - 1]; in cipher_hw_rc4_hmac_md5_tls_init() 180 aad[aad_len - 2] = len >> 8; in cipher_hw_rc4_hmac_md5_tls_init() 181 aad[aad_len - 1] = len; in cipher_hw_rc4_hmac_md5_tls_init() 185 MD5_Update(&ctx->md, aad, aad_len); in cipher_hw_rc4_hmac_md5_tls_init()
|
H A D | ciphercommon_gcm.c | 19 static int gcm_tls_init(PROV_GCM_CTX *dat, unsigned char *aad, size_t aad_len); 451 static int gcm_tls_init(PROV_GCM_CTX *dat, unsigned char *aad, size_t aad_len) in gcm_tls_init() argument 456 if (!ossl_prov_is_running() || aad_len != EVP_AEAD_TLS1_AAD_LEN) in gcm_tls_init() 461 memcpy(buf, aad, aad_len); in gcm_tls_init() 462 dat->tls_aad_len = aad_len; in gcm_tls_init() 464 len = buf[aad_len - 2] << 8 | buf[aad_len - 1]; in gcm_tls_init() 476 buf[aad_len - 2] = (unsigned char)(len >> 8); in gcm_tls_init() 477 buf[aad_len - 1] = (unsigned char)(len & 0xff); in gcm_tls_init()
|
H A D | cipher_aes_cbc_hmac_sha1_hw.c | 664 unsigned char *aad_rec, int aad_len) in aesni_cbc_hmac_sha1_set_tls1_aad() argument 671 if (aad_len != EVP_AEAD_TLS1_AAD_LEN) in aesni_cbc_hmac_sha1_set_tls1_aad() 674 len = p[aad_len - 2] << 8 | p[aad_len - 1]; in aesni_cbc_hmac_sha1_set_tls1_aad() 679 p[aad_len - 4] << 8 | p[aad_len - 3]) >= TLS1_1_VERSION) { in aesni_cbc_hmac_sha1_set_tls1_aad() 683 p[aad_len - 2] = len >> 8; in aesni_cbc_hmac_sha1_set_tls1_aad() 684 p[aad_len - 1] = len; in aesni_cbc_hmac_sha1_set_tls1_aad() 687 sha1_update(&sctx->md, p, aad_len); in aesni_cbc_hmac_sha1_set_tls1_aad() 693 memcpy(ctx->aux.tls_aad, aad_rec, aad_len); in aesni_cbc_hmac_sha1_set_tls1_aad() 694 ctx->payload_length = aad_len; in aesni_cbc_hmac_sha1_set_tls1_aad()
|
H A D | cipher_aes_cbc_hmac_sha256_hw.c | 717 unsigned char *aad_rec, int aad_len) in aesni_cbc_hmac_sha256_set_tls1_aad() argument 724 if (aad_len != EVP_AEAD_TLS1_AAD_LEN) in aesni_cbc_hmac_sha256_set_tls1_aad() 727 len = p[aad_len - 2] << 8 | p[aad_len - 1]; in aesni_cbc_hmac_sha256_set_tls1_aad() 732 p[aad_len - 4] << 8 | p[aad_len - 3]) >= TLS1_1_VERSION) { in aesni_cbc_hmac_sha256_set_tls1_aad() 736 p[aad_len - 2] = len >> 8; in aesni_cbc_hmac_sha256_set_tls1_aad() 737 p[aad_len - 1] = len; in aesni_cbc_hmac_sha256_set_tls1_aad() 740 sha256_update(&sctx->md, p, aad_len); in aesni_cbc_hmac_sha256_set_tls1_aad() 746 memcpy(ctx->aux.tls_aad, p, aad_len); in aesni_cbc_hmac_sha256_set_tls1_aad() 747 ctx->payload_length = aad_len; in aesni_cbc_hmac_sha256_set_tls1_aad()
|
H A D | cipher_rc4_hmac_md5.h | 27 int (*tls_init)(PROV_CIPHER_CTX *ctx, unsigned char *aad, size_t aad_len);
|
/freebsd/sys/net80211/ |
H A D | ieee80211_crypto_gcmp.c | 399 int aad_len; in gcmp_init_aad() local 443 aad_len = aad[1] = 22 + IEEE80211_ADDR_LEN + 2; in gcmp_init_aad() 446 aad_len = aad[1] = 22 + IEEE80211_ADDR_LEN; in gcmp_init_aad() 454 aad_len = aad[1] = 22 + 2; in gcmp_init_aad() 457 aad_len = aad[1] = 22; in gcmp_init_aad() 464 return (aad_len); in gcmp_init_aad() 508 int data_len, aad_len, iv_len, ret; in gcmp_encrypt() local 541 aad_len = gcmp_init_aad(wh, aad); in gcmp_encrypt() 557 p_pktbuf, data_len, aad + 2, aad_len, c_pktbuf, T); in gcmp_encrypt() 598 int data_len, aad_len, iv_len, ret; in gcmp_decrypt() local [all …]
|
H A D | ieee80211_crypto_gcm.c | 286 aes_gcm_ghash(const uint8_t *H, const uint8_t *aad, size_t aad_len, in aes_gcm_ghash() argument 298 ghash(H, aad, aad_len, S); in aes_gcm_ghash() 300 WPA_PUT_BE64(len_buf, aad_len * 8); in aes_gcm_ghash() 311 const uint8_t *aad, size_t aad_len, uint8_t *crypt, uint8_t *tag) in ieee80211_crypto_aes_gcm_ae() argument 324 aes_gcm_ghash(H, aad, aad_len, crypt, plain_len, S); in ieee80211_crypto_aes_gcm_ae() 340 const uint8_t *aad, size_t aad_len, const uint8_t *tag, uint8_t *plain) in ieee80211_crypto_aes_gcm_ad() argument 353 aes_gcm_ghash(H, aad, aad_len, crypt, crypt_len, S); in ieee80211_crypto_aes_gcm_ad()
|
H A D | ieee80211_crypto_gcm.h | 49 const uint8_t *aad, size_t aad_len, uint8_t *crypt, uint8_t *tag); 53 const uint8_t *aad, size_t aad_len, const uint8_t *tag,
|
/freebsd/sys/contrib/openzfs/module/os/freebsd/zfs/ |
H A D | zio_crypt.c | 435 uint_t enc_len, keydata_len, aad_len; in zio_crypt_key_wrap() local 468 aad_len = sizeof (uint64_t); in zio_crypt_key_wrap() 472 aad_len = sizeof (uint64_t) * 3; in zio_crypt_key_wrap() 479 iovecs[0].iov_len = aad_len; in zio_crypt_key_wrap() 488 iv, enc_len, &cuio, aad_len); in zio_crypt_key_wrap() 514 uint_t enc_len, keydata_len, aad_len; in zio_crypt_key_unwrap() local 545 aad_len = sizeof (uint64_t); in zio_crypt_key_unwrap() 549 aad_len = sizeof (uint64_t) * 3; in zio_crypt_key_unwrap() 557 iovecs[0].iov_len = aad_len; in zio_crypt_key_unwrap() 565 iv, enc_len, &cuio, aad_len); in zio_crypt_key_unwrap() [all …]
|
/freebsd/contrib/bearssl/src/symcipher/ |
H A D | poly1305_i15.c | 130 void *data, size_t len, const void *aad, size_t aad_len, in br_poly1305_i15_run() argument 190 br_enc64le(foot, (uint64_t)aad_len); in br_poly1305_i15_run() 192 poly1305_inner(acc, r, aad, aad_len); in br_poly1305_i15_run()
|
H A D | poly1305_ctmul.c | 149 void *data, size_t len, const void *aad, size_t aad_len, in br_poly1305_ctmul_run() argument 198 br_enc64le(foot, (uint64_t)aad_len); in br_poly1305_ctmul_run() 200 poly1305_inner(acc, r, aad, aad_len); in br_poly1305_ctmul_run()
|
H A D | poly1305_ctmul32.c | 167 void *data, size_t len, const void *aad, size_t aad_len, in br_poly1305_ctmul32_run() argument 232 br_enc64le(foot, (uint64_t)aad_len); in br_poly1305_ctmul32_run() 234 poly1305_inner(acc, r, aad, aad_len); in br_poly1305_ctmul32_run()
|
/freebsd/sys/contrib/openzfs/module/os/linux/zfs/ |
H A D | zio_crypt.c | 496 uint_t enc_len, keydata_len, aad_len; in zio_crypt_key_wrap() local 526 aad_len = sizeof (uint64_t); in zio_crypt_key_wrap() 530 aad_len = sizeof (uint64_t) * 3; in zio_crypt_key_wrap() 546 &puio, &cuio, (uint8_t *)aad, aad_len); in zio_crypt_key_wrap() 565 uint_t enc_len, keydata_len, aad_len; in zio_crypt_key_unwrap() local 588 aad_len = sizeof (uint64_t); in zio_crypt_key_unwrap() 592 aad_len = sizeof (uint64_t) * 3; in zio_crypt_key_unwrap() 608 &puio, &cuio, (uint8_t *)aad, aad_len); in zio_crypt_key_unwrap() 1037 zio_crypt_bp_do_aad_updates(uint8_t **aadp, uint_t *aad_len, uint64_t version, in zio_crypt_bp_do_aad_updates() argument 1046 *aad_len += bab_len; in zio_crypt_bp_do_aad_updates() [all …]
|
H A D | qat_crypt.c | 157 Cpa64U crypt, Cpa32U aad_len) in qat_init_crypt_session_ctx() argument 178 sd.hashSetupData.authModeSetupData.aadLenInBytes = aad_len; in qat_init_crypt_session_ctx() 294 uint8_t *aad_buf, uint32_t aad_len, uint8_t *iv_buf, uint8_t *digest_buf, in qat_crypt() argument 331 &cy_session_ctx, key, crypt, aad_len); in qat_crypt() 365 if (aad_len > 0) { in qat_crypt() 367 aad_len); in qat_crypt() 370 memcpy(op_data.pAdditionalAuthData, aad_buf, aad_len); in qat_crypt() 454 if (aad_len > 0) in qat_crypt()
|
/freebsd/crypto/openssl/providers/implementations/include/prov/ |
H A D | ciphercommon_gcm.h | 92 size_t aad_len, const unsigned char *in, 116 size_t aad_len); 118 int ossl_gcm_one_shot(PROV_GCM_CTX *ctx, unsigned char *aad, size_t aad_len,
|
/freebsd/contrib/bearssl/test/ |
H A D | test_crypto.c | 5118 size_t len, aad_len; in test_Poly1305_inner() local 5121 aad_len = hextobin(aad, KAT_POLY1305[u].saad); in test_Poly1305_inner() 5129 aad, aad_len, tmp, br_chacha20_ct_run, 1); in test_Poly1305_inner() 5133 aad, aad_len, tmp, br_chacha20_ct_run, 0); in test_Poly1305_inner() 7458 size_t key_len, plain_len, aad_len, iv_len; in test_GCM() local 7466 aad_len = hextobin(aad, KAT_GCM[u + 2]); in test_GCM() 7481 br_gcm_aad_inject(&gc, aad, aad_len); in test_GCM() 7489 br_gcm_aad_inject(&gc, aad, aad_len); in test_GCM() 7509 for (v = 0; v < aad_len; v ++) { in test_GCM() 7523 for (v = 0; v < aad_len; v ++) { in test_GCM() [all …]
|
/freebsd/contrib/bearssl/inc/ |
H A D | bearssl_block.h | 2514 void *data, size_t len, const void *aad, size_t aad_len, 2533 void *data, size_t len, const void *aad, size_t aad_len, 2552 void *data, size_t len, const void *aad, size_t aad_len, 2577 void *data, size_t len, const void *aad, size_t aad_len, 2601 void *data, size_t len, const void *aad, size_t aad_len,
|