| /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 | 914 const char *aad, size_t aad_len, const char *input, char *output, in ocf_eta() argument 919 if (aad_len != 0) { in ocf_eta() 925 caead.aadlen = aad_len; in ocf_eta() 954 run_eta_test(const struct alg *alg, size_t aad_len, size_t size) in run_eta_test() argument 970 alg->name, aad_len, size, in run_eta_test() 996 cleartext = alloc_buffer(aad_len + size); in run_eta_test() 997 buffer = malloc(aad_len + size); in run_eta_test() 998 ciphertext = malloc(aad_len + size); in run_eta_test() 1001 if (aad_len != 0) in run_eta_test() 1002 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/crypto/openssl/providers/implementations/ciphers/ |
| H A D | cipher_aes_gcm_siv_hw.c | 118 ctx->aad_len = 0; in aes_gcm_siv_aad() 121 to_alloc = UP16(ctx->aad_len + len); in aes_gcm_siv_aad() 130 memcpy(&ctx->aad[ctx->aad_len], aad, len); in aes_gcm_siv_aad() 131 ctx->aad_len += len; in aes_gcm_siv_aad() 132 if (to_alloc > ctx->aad_len) in aes_gcm_siv_aad() 133 memset(&ctx->aad[ctx->aad_len], 0, to_alloc - ctx->aad_len); in aes_gcm_siv_aad() 169 len_blk[0] = (uint64_t)ctx->aad_len * 8; in aes_gcm_siv_encrypt() 172 len_blk[0] = GSWAP8((uint64_t)ctx->aad_len * 8); in aes_gcm_siv_encrypt() 180 ossl_polyval_ghash_hash(ctx->Htable, S_s, ctx->aad, UP16(ctx->aad_len)); in aes_gcm_siv_encrypt() 235 len_blk[0] = (uint64_t)ctx->aad_len * 8; in aes_gcm_siv_decrypt() [all …]
|
| H A D | cipher_aes_gcm_hw_vaes_avx512.inc | 86 size_t aad_len) 97 alen += aad_len; 99 if ((alen > (U64(1) << 61)) || (alen < aad_len)) 111 while (ares > 0 && aad_len > 0) { 113 --aad_len; 126 lenBlks = aad_len & ((size_t)(-AES_BLOCK_SIZE)); 130 aad_len -= lenBlks; 134 if (aad_len > 0) { 135 ares = aad_len; 136 for (i = 0; i < aad_len; i++)
|
| H A D | ciphercommon_gcm_hw.c | 20 size_t aad_len) in ossl_gcm_aad_update() argument 22 return CRYPTO_gcm128_aad(&ctx->gcm, aad, aad_len) == 0; in ossl_gcm_aad_update() 50 int ossl_gcm_one_shot(PROV_GCM_CTX *ctx, unsigned char *aad, size_t aad_len, in ossl_gcm_one_shot() argument 57 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 | 20 static int gcm_tls_init(PROV_GCM_CTX *dat, unsigned char *aad, size_t aad_len); 469 static int gcm_tls_init(PROV_GCM_CTX *dat, unsigned char *aad, size_t aad_len) in gcm_tls_init() argument 474 if (!ossl_prov_is_running() || aad_len != EVP_AEAD_TLS1_AAD_LEN) in gcm_tls_init() 479 memcpy(buf, aad, aad_len); in gcm_tls_init() 480 dat->tls_aad_len = aad_len; in gcm_tls_init() 482 len = buf[aad_len - 2] << 8 | buf[aad_len - 1]; in gcm_tls_init() 494 buf[aad_len - 2] = (unsigned char)(len >> 8); in gcm_tls_init() 495 buf[aad_len - 1] = (unsigned char)(len & 0xff); in gcm_tls_init()
|
| H A D | cipher_aes_cbc_hmac_sha1_hw.c | 660 unsigned char *aad_rec, int aad_len) in aesni_cbc_hmac_sha1_set_tls1_aad() argument 667 if (aad_len != EVP_AEAD_TLS1_AAD_LEN) in aesni_cbc_hmac_sha1_set_tls1_aad() 670 len = p[aad_len - 2] << 8 | p[aad_len - 1]; in aesni_cbc_hmac_sha1_set_tls1_aad() 674 if ((ctx->aux.tls_ver = p[aad_len - 4] << 8 | p[aad_len - 3]) >= TLS1_1_VERSION) { in aesni_cbc_hmac_sha1_set_tls1_aad() 678 p[aad_len - 2] = len >> 8; in aesni_cbc_hmac_sha1_set_tls1_aad() 679 p[aad_len - 1] = len; in aesni_cbc_hmac_sha1_set_tls1_aad() 682 sha1_update(&sctx->md, p, aad_len); in aesni_cbc_hmac_sha1_set_tls1_aad() 687 memcpy(ctx->aux.tls_aad, aad_rec, aad_len); in aesni_cbc_hmac_sha1_set_tls1_aad() 688 ctx->payload_length = aad_len; in aesni_cbc_hmac_sha1_set_tls1_aad()
|
| H A D | cipher_aes_cbc_hmac_sha256_hw.c | 712 unsigned char *aad_rec, int aad_len) in aesni_cbc_hmac_sha256_set_tls1_aad() argument 719 if (aad_len != EVP_AEAD_TLS1_AAD_LEN) in aesni_cbc_hmac_sha256_set_tls1_aad() 722 len = p[aad_len - 2] << 8 | p[aad_len - 1]; in aesni_cbc_hmac_sha256_set_tls1_aad() 726 if ((ctx->aux.tls_ver = p[aad_len - 4] << 8 | p[aad_len - 3]) >= TLS1_1_VERSION) { in aesni_cbc_hmac_sha256_set_tls1_aad() 730 p[aad_len - 2] = len >> 8; in aesni_cbc_hmac_sha256_set_tls1_aad() 731 p[aad_len - 1] = len; in aesni_cbc_hmac_sha256_set_tls1_aad() 734 sha256_update(&sctx->md, p, aad_len); in aesni_cbc_hmac_sha256_set_tls1_aad() 739 memcpy(ctx->aux.tls_aad, p, aad_len); in aesni_cbc_hmac_sha256_set_tls1_aad() 740 ctx->payload_length = aad_len; in aesni_cbc_hmac_sha256_set_tls1_aad()
|
| /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/sys/net80211/ |
| 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,
|
| H A D | ieee80211_crypto_gcmp.c | 424 int data_len, aad_len, iv_len, ret; in gcmp_encrypt() local 457 aad_len = ieee80211_crypto_init_aad(wh, aad, GCM_AAD_LEN); in gcmp_encrypt() 473 p_pktbuf, data_len, aad + 2, aad_len, c_pktbuf, T); in gcmp_encrypt() 514 int data_len, aad_len, iv_len, ret; in gcmp_decrypt() local 548 aad_len = ieee80211_crypto_init_aad(wh, aad, GCM_AAD_LEN); in gcmp_decrypt() 567 c_pktbuf, data_len, aad + 2, aad_len, T, p_pktbuf); in gcmp_decrypt()
|
| H A D | ieee80211_crypto.c | 1021 uint16_t aad_len; in ieee80211_crypto_init_aad() local 1061 aad_len = aad[1] = 22 + IEEE80211_ADDR_LEN + 2; in ieee80211_crypto_init_aad() 1064 aad_len = aad[1] = 22 + IEEE80211_ADDR_LEN; in ieee80211_crypto_init_aad() 1073 aad_len = aad[1] = 22 + 2; in ieee80211_crypto_init_aad() 1076 aad_len = aad[1] = 22; in ieee80211_crypto_init_aad() 1082 return (aad_len); in ieee80211_crypto_init_aad()
|
| /freebsd/sys/contrib/openzfs/module/os/freebsd/zfs/ |
| H A D | zio_crypt.c | 433 uint_t enc_len, keydata_len, aad_len; in zio_crypt_key_wrap() local 467 aad_len = sizeof (uint64_t); in zio_crypt_key_wrap() 471 aad_len = sizeof (uint64_t) * 3; in zio_crypt_key_wrap() 478 iovecs[0].iov_len = aad_len; in zio_crypt_key_wrap() 487 iv, enc_len, &cuio, aad_len); in zio_crypt_key_wrap() 513 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()
|
| /freebsd/crypto/openssl/providers/implementations/include/prov/ |
| H A D | ciphercommon_gcm.h | 89 PROV_CIPHER_FUNC(int, GCM_oneshot, (PROV_GCM_CTX *ctx, unsigned char *aad, size_t aad_len, const un… 111 size_t aad_len); 113 int ossl_gcm_one_shot(PROV_GCM_CTX *ctx, unsigned char *aad, size_t aad_len,
|
| /freebsd/sys/contrib/openzfs/module/os/linux/zfs/ |
| H A D | zio_crypt.c | 497 uint_t enc_len, keydata_len, aad_len; in zio_crypt_key_wrap() local 527 aad_len = sizeof (uint64_t); in zio_crypt_key_wrap() 531 aad_len = sizeof (uint64_t) * 3; in zio_crypt_key_wrap() 547 &puio, &cuio, (uint8_t *)aad, aad_len); in zio_crypt_key_wrap() 566 uint_t enc_len, keydata_len, aad_len; in zio_crypt_key_unwrap() local 589 aad_len = sizeof (uint64_t); in zio_crypt_key_unwrap() 593 aad_len = sizeof (uint64_t) * 3; in zio_crypt_key_unwrap() 609 &puio, &cuio, (uint8_t *)aad, aad_len); in zio_crypt_key_unwrap() 1038 zio_crypt_bp_do_aad_updates(uint8_t **aadp, uint_t *aad_len, uint64_t version, in zio_crypt_bp_do_aad_updates() argument 1047 *aad_len += bab_len; in zio_crypt_bp_do_aad_updates() [all …]
|
| H A D | qat_crypt.c | 158 Cpa64U crypt, Cpa32U aad_len) in qat_init_crypt_session_ctx() argument 179 sd.hashSetupData.authModeSetupData.aadLenInBytes = aad_len; in qat_init_crypt_session_ctx() 295 uint8_t *aad_buf, uint32_t aad_len, uint8_t *iv_buf, uint8_t *digest_buf, in qat_crypt() argument 332 &cy_session_ctx, key, crypt, aad_len); in qat_crypt() 366 if (aad_len > 0) { in qat_crypt() 368 aad_len); in qat_crypt() 371 memcpy(op_data.pAdditionalAuthData, aad_buf, aad_len); in qat_crypt() 455 if (aad_len > 0) in qat_crypt()
|
| /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 …]
|