/freebsd/crypto/openssl/crypto/aes/ |
H A D | aes_ige.c | 28 #define N_WORDS (AES_BLOCK_SIZE / sizeof(unsigned long)) 41 # define load_block(d, s) memcpy((d).data, (s), AES_BLOCK_SIZE) 42 # define store_block(d, s) memcpy((d), (s).data, AES_BLOCK_SIZE) 53 size_t len = length / AES_BLOCK_SIZE; in AES_ige_encrypt() 60 OPENSSL_assert((length % AES_BLOCK_SIZE) == 0); in AES_ige_encrypt() 68 aes_block_t *iv2p = (aes_block_t *) (ivec + AES_BLOCK_SIZE); in AES_ige_encrypt() 83 in += AES_BLOCK_SIZE; in AES_ige_encrypt() 84 out += AES_BLOCK_SIZE; in AES_ige_encrypt() 86 memcpy(ivec, ivp->data, AES_BLOCK_SIZE); in AES_ige_encrypt() 87 memcpy(ivec + AES_BLOCK_SIZE, iv2p->data, AES_BLOCK_SIZE); in AES_ige_encrypt() [all …]
|
/freebsd/contrib/wpa/src/crypto/ |
H A D | aes-ccm.c | 32 u8 aad_buf[2 * AES_BLOCK_SIZE]; in aes_ccm_auth_start() 33 u8 b[AES_BLOCK_SIZE]; in aes_ccm_auth_start() 41 WPA_PUT_BE16(&b[AES_BLOCK_SIZE - L], plain_len); in aes_ccm_auth_start() 43 wpa_hexdump_key(MSG_EXCESSIVE, "CCM B_0", b, AES_BLOCK_SIZE); in aes_ccm_auth_start() 56 if (aad_len > AES_BLOCK_SIZE - 2) { in aes_ccm_auth_start() 57 xor_aes_block(&aad_buf[AES_BLOCK_SIZE], x); in aes_ccm_auth_start() 59 aes_encrypt(aes, &aad_buf[AES_BLOCK_SIZE], x); in aes_ccm_auth_start() 66 size_t last = len % AES_BLOCK_SIZE; in aes_ccm_auth() 69 for (i = 0; i < len / AES_BLOCK_SIZE; i++) { in aes_ccm_auth() 72 data += AES_BLOCK_SIZE; in aes_ccm_auth() [all …]
|
H A D | aes-cbc.c | 27 u8 cbc[AES_BLOCK_SIZE]; in aes_128_cbc_encrypt() 37 os_memcpy(cbc, iv, AES_BLOCK_SIZE); in aes_128_cbc_encrypt() 39 blocks = data_len / AES_BLOCK_SIZE; in aes_128_cbc_encrypt() 41 for (j = 0; j < AES_BLOCK_SIZE; j++) in aes_128_cbc_encrypt() 44 os_memcpy(pos, cbc, AES_BLOCK_SIZE); in aes_128_cbc_encrypt() 45 pos += AES_BLOCK_SIZE; in aes_128_cbc_encrypt() 63 u8 cbc[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE]; in aes_128_cbc_decrypt() 73 os_memcpy(cbc, iv, AES_BLOCK_SIZE); in aes_128_cbc_decrypt() 75 blocks = data_len / AES_BLOCK_SIZE; in aes_128_cbc_decrypt() 77 os_memcpy(tmp, pos, AES_BLOCK_SIZE); in aes_128_cbc_decrypt() [all …]
|
H A D | aes-siv.c | 17 static const u8 zero[AES_BLOCK_SIZE]; 25 for (i = 0; i < AES_BLOCK_SIZE - 1; i++) in dbl() 27 pad[AES_BLOCK_SIZE - 1] <<= 1; in dbl() 29 pad[AES_BLOCK_SIZE - 1] ^= 0x87; in dbl() 37 for (i = 0; i < AES_BLOCK_SIZE; i++) in xor() 56 os_memset(pad, 0, AES_BLOCK_SIZE); in pad_block() 59 if (len < AES_BLOCK_SIZE) in pad_block() 67 u8 tmp[AES_BLOCK_SIZE], tmp2[AES_BLOCK_SIZE]; in aes_s2v() 76 tmp[AES_BLOCK_SIZE - 1] = 1; in aes_s2v() 97 if (len[i] >= AES_BLOCK_SIZE) { in aes_s2v() [all …]
|
H A D | aes-omac1.c | 21 for (i = 0; i < AES_BLOCK_SIZE - 1; i++) in gf_mulx() 23 pad[AES_BLOCK_SIZE - 1] <<= 1; in gf_mulx() 25 pad[AES_BLOCK_SIZE - 1] ^= 0x87; in gf_mulx() 47 u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE]; in omac1_aes_vector() 57 os_memset(cbc, 0, AES_BLOCK_SIZE); in omac1_aes_vector() 68 while (left >= AES_BLOCK_SIZE) { in omac1_aes_vector() 69 for (i = 0; i < AES_BLOCK_SIZE; i++) { in omac1_aes_vector() 76 if (i + 1 == AES_BLOCK_SIZE && in omac1_aes_vector() 77 left == AES_BLOCK_SIZE) in omac1_aes_vector() 84 if (left > AES_BLOCK_SIZE) in omac1_aes_vector() [all …]
|
H A D | aes-gcm.c | 19 val = WPA_GET_BE32(block + AES_BLOCK_SIZE - 4); in inc32() 21 WPA_PUT_BE32(block + AES_BLOCK_SIZE - 4, val); in inc32() 146 u8 cb[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE]; in aes_gctr() 155 os_memcpy(cb, icb, AES_BLOCK_SIZE); in aes_gctr() 160 xpos += AES_BLOCK_SIZE; in aes_gctr() 161 ypos += AES_BLOCK_SIZE; in aes_gctr() 184 os_memset(H, 0, AES_BLOCK_SIZE); in aes_gcm_init_hash_subkey() 187 H, AES_BLOCK_SIZE); in aes_gcm_init_hash_subkey() 199 os_memset(J0 + iv_len, 0, AES_BLOCK_SIZE - iv_len); in aes_gcm_prepare_j0() 200 J0[AES_BLOCK_SIZE - 1] = 0x01; in aes_gcm_prepare_j0() [all …]
|
H A D | crypto_internal-cipher.c | 76 os_memcpy(ctx->u.aes.cbc, iv, AES_BLOCK_SIZE); in crypto_cipher_init() 117 if (len % AES_BLOCK_SIZE) in crypto_cipher_encrypt() 119 blocks = len / AES_BLOCK_SIZE; in crypto_cipher_encrypt() 121 for (j = 0; j < AES_BLOCK_SIZE; j++) in crypto_cipher_encrypt() 125 os_memcpy(crypt, ctx->u.aes.cbc, AES_BLOCK_SIZE); in crypto_cipher_encrypt() 126 plain += AES_BLOCK_SIZE; in crypto_cipher_encrypt() 127 crypt += AES_BLOCK_SIZE; in crypto_cipher_encrypt() 181 if (len % AES_BLOCK_SIZE) in crypto_cipher_decrypt() 183 blocks = len / AES_BLOCK_SIZE; in crypto_cipher_decrypt() 185 os_memcpy(tmp, crypt, AES_BLOCK_SIZE); in crypto_cipher_decrypt() [all …]
|
H A D | aes-ctr.c | 32 u8 counter[AES_BLOCK_SIZE], buf[AES_BLOCK_SIZE]; in aes_ctr_encrypt() 37 os_memcpy(counter, nonce, AES_BLOCK_SIZE); in aes_ctr_encrypt() 42 len = (left < AES_BLOCK_SIZE) ? left : AES_BLOCK_SIZE; in aes_ctr_encrypt() 48 for (i = AES_BLOCK_SIZE - 1; i >= 0; i--) { in aes_ctr_encrypt()
|
H A D | aes-eax.c | 34 u8 nonce_mac[AES_BLOCK_SIZE], hdr_mac[AES_BLOCK_SIZE], in aes_128_eax_encrypt() 35 data_mac[AES_BLOCK_SIZE]; in aes_128_eax_encrypt() 69 for (i = 0; i < AES_BLOCK_SIZE; i++) in aes_128_eax_encrypt() 98 u8 nonce_mac[AES_BLOCK_SIZE], hdr_mac[AES_BLOCK_SIZE], in aes_128_eax_decrypt() 99 data_mac[AES_BLOCK_SIZE]; in aes_128_eax_decrypt() 139 for (i = 0; i < AES_BLOCK_SIZE; i++) { in aes_128_eax_decrypt()
|
/freebsd/contrib/libarchive/libarchive/ |
H A D | archive_cryptor_private.h | 53 #define AES_BLOCK_SIZE 16 macro 60 uint8_t nonce[AES_BLOCK_SIZE]; 61 uint8_t encr_buf[AES_BLOCK_SIZE]; 74 #define AES_BLOCK_SIZE 16 macro 80 uint8_t nonce[AES_BLOCK_SIZE]; 81 uint8_t encr_buf[AES_BLOCK_SIZE]; 91 #define AES_BLOCK_SIZE 16 macro 97 uint8_t nonce[AES_BLOCK_SIZE]; 98 uint8_t encr_buf[AES_BLOCK_SIZE]; 121 uint8_t nonce[AES_BLOCK_SIZE]; [all …]
|
H A D | archive_cryptor.c | 172 ctx->encr_pos = AES_BLOCK_SIZE; in aes_ctr_init() 187 r = CCCryptorUpdate(ref, ctx->nonce, AES_BLOCK_SIZE, ctx->encr_buf, in aes_ctr_encrypt_counter() 188 AES_BLOCK_SIZE, NULL); in aes_ctr_encrypt_counter() 268 ctx->encr_pos = AES_BLOCK_SIZE; in aes_ctr_init() 279 status = BCryptEncrypt(ctx->hKey, (PUCHAR)ctx->nonce, AES_BLOCK_SIZE, in aes_ctr_encrypt_counter() 280 NULL, NULL, 0, (PUCHAR)ctx->encr_buf, AES_BLOCK_SIZE, in aes_ctr_encrypt_counter() 310 ctx->encr_pos = AES_BLOCK_SIZE; in aes_ctr_init() 342 ctx->encr_pos = AES_BLOCK_SIZE; in aes_ctr_init() 352 aes_encrypt(&ctx->ctx, AES_BLOCK_SIZE, ctx->encr_buf, ctx->nonce); in aes_ctr_encrypt_counter() 357 aes128_encrypt(&ctx->ctx.c128, AES_BLOCK_SIZE, ctx->encr_buf, in aes_ctr_encrypt_counter() [all …]
|
/freebsd/crypto/openssl/engines/ |
H A D | e_padlock.c | 186 # define AES_BLOCK_SIZE 16 macro 199 unsigned char iv[AES_BLOCK_SIZE]; /* Initialization vector */ 327 memcpy(cdata->iv, EVP_CIPHER_CTX_iv(ctx), AES_BLOCK_SIZE); in padlock_cbc_cipher() 329 memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), cdata->iv, AES_BLOCK_SIZE); in padlock_cbc_cipher() 343 if (chunk >= AES_BLOCK_SIZE) in padlock_cfb_cipher() 347 while (chunk < AES_BLOCK_SIZE && nbytes != 0) { in padlock_cfb_cipher() 351 while (chunk < AES_BLOCK_SIZE && nbytes != 0) { in padlock_cfb_cipher() 357 EVP_CIPHER_CTX_set_num(ctx, chunk % AES_BLOCK_SIZE); in padlock_cfb_cipher() 363 memcpy(cdata->iv, EVP_CIPHER_CTX_iv(ctx), AES_BLOCK_SIZE); in padlock_cfb_cipher() 365 if ((chunk = nbytes & ~(AES_BLOCK_SIZE - 1))) { in padlock_cfb_cipher() [all …]
|
H A D | e_ossltest.c | 801 if (len % AES_BLOCK_SIZE) in ossltest_aes128_cbc_hmac_sha1_cipher() 809 AES_BLOCK_SIZE) & -AES_BLOCK_SIZE)) in ossltest_aes128_cbc_hmac_sha1_cipher() 831 if (len < (AES_BLOCK_SIZE + SHA_DIGEST_LENGTH + 1)) in ossltest_aes128_cbc_hmac_sha1_cipher() 835 in += AES_BLOCK_SIZE; in ossltest_aes128_cbc_hmac_sha1_cipher() 836 out += AES_BLOCK_SIZE; in ossltest_aes128_cbc_hmac_sha1_cipher() 837 len -= AES_BLOCK_SIZE; in ossltest_aes128_cbc_hmac_sha1_cipher() 878 if (len < AES_BLOCK_SIZE) in ossltest_aes128_cbc_hmac_sha1_ctrl() 880 len -= AES_BLOCK_SIZE; in ossltest_aes128_cbc_hmac_sha1_ctrl() 886 AES_BLOCK_SIZE) & -AES_BLOCK_SIZE) in ossltest_aes128_cbc_hmac_sha1_ctrl()
|
H A D | e_afalg.h | 40 # ifndef AES_BLOCK_SIZE 41 # define AES_BLOCK_SIZE 16 macro
|
/freebsd/crypto/openssl/crypto/evp/ |
H A D | e_aes_cbc_hmac_sha1.c | 424 if (len % AES_BLOCK_SIZE) in aesni_cbc_hmac_sha1_cipher() 432 AES_BLOCK_SIZE) & -AES_BLOCK_SIZE)) in aesni_cbc_hmac_sha1_cipher() 435 iv = AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 497 unsigned char tail_iv[AES_BLOCK_SIZE]; in aesni_cbc_hmac_sha1_cipher() 503 if (len < (AES_BLOCK_SIZE + SHA_DIGEST_LENGTH + 1)) in aesni_cbc_hmac_sha1_cipher() 507 memcpy(ctx->iv, in, AES_BLOCK_SIZE); in aesni_cbc_hmac_sha1_cipher() 509 in += AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 510 out += AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 511 len -= AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 518 memcpy(tail_iv, in + len - 2 * AES_BLOCK_SIZE, in aesni_cbc_hmac_sha1_cipher() [all …]
|
/freebsd/crypto/openssh/ |
H A D | cipher-aesctr.c | 65 memcpy(x->ctr, iv, AES_BLOCK_SIZE); in aesctr_ivsetup() 72 u8 buf[AES_BLOCK_SIZE]; in aesctr_encrypt_bytes() 77 aesctr_inc(x->ctr, AES_BLOCK_SIZE); in aesctr_encrypt_bytes() 80 n = (n + 1) % AES_BLOCK_SIZE; in aesctr_encrypt_bytes()
|
H A D | cipher-aesctr.h | 23 #define AES_BLOCK_SIZE 16 macro 28 u8 ctr[AES_BLOCK_SIZE]; /* counter */
|
/freebsd/crypto/openssl/test/ |
H A D | igetest.c | 33 static unsigned char saved_iv[AES_BLOCK_SIZE * 4]; 154 unsigned char iv[AES_BLOCK_SIZE * 2]; in test_ige_vectors() 226 unsigned char iv[AES_BLOCK_SIZE * 4]; in test_ige_enc_dec() 244 unsigned char iv[AES_BLOCK_SIZE * 4]; in test_ige_enc_chaining() 266 unsigned char iv[AES_BLOCK_SIZE * 4]; in test_ige_dec_chaining() 292 unsigned char iv[AES_BLOCK_SIZE * 4]; in test_ige_garble_forwards() 330 unsigned char iv[AES_BLOCK_SIZE * 4]; in test_bi_ige_enc_dec() 351 unsigned char iv[AES_BLOCK_SIZE * 4]; in test_bi_ige_garble1() 382 unsigned char iv[AES_BLOCK_SIZE * 4]; in test_bi_ige_garble2() 413 unsigned char iv[AES_BLOCK_SIZE * 4]; in test_bi_ige_garble3()
|
/freebsd/crypto/openssl/providers/implementations/ciphers/ |
H A D | cipher_aes_ocb.h | 14 #define OCB_MAX_TAG_LEN AES_BLOCK_SIZE 15 #define OCB_MAX_DATA_LEN AES_BLOCK_SIZE 16 #define OCB_MAX_AAD_LEN AES_BLOCK_SIZE
|
H A D | cipher_aes_cbc_hmac_sha1_hw.c | 64 vctx->removetlsfixed = SHA_DIGEST_LENGTH + AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_init_key() 386 if (len % AES_BLOCK_SIZE) in aesni_cbc_hmac_sha1_cipher() 394 AES_BLOCK_SIZE) & -AES_BLOCK_SIZE)) in aesni_cbc_hmac_sha1_cipher() 397 iv = AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 459 if (len < (AES_BLOCK_SIZE + SHA_DIGEST_LENGTH + 1)) in aesni_cbc_hmac_sha1_cipher() 463 memcpy(ctx->base.iv, in, AES_BLOCK_SIZE); in aesni_cbc_hmac_sha1_cipher() 465 in += AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 466 out += AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 467 len -= AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 680 if (len < AES_BLOCK_SIZE) in aesni_cbc_hmac_sha1_set_tls1_aad() [all …]
|
H A D | cipher_aes_ccm.h | 35 unsigned char b[AES_BLOCK_SIZE]; 39 unsigned char b[AES_BLOCK_SIZE];
|
H A D | cipher_aes_ocb.c | 169 nextblocks = ossl_cipher_fillblock(buf, bufsz, AES_BLOCK_SIZE, &in, &inl); in aes_ocb_block_update_internal() 171 nextblocks = inl & ~(AES_BLOCK_SIZE-1); in aes_ocb_block_update_internal() 173 if (*bufsz == AES_BLOCK_SIZE) { in aes_ocb_block_update_internal() 174 if (outsize < AES_BLOCK_SIZE) { in aes_ocb_block_update_internal() 178 if (!ciph(ctx, buf, out, AES_BLOCK_SIZE)) { in aes_ocb_block_update_internal() 183 outlint = AES_BLOCK_SIZE; in aes_ocb_block_update_internal() 185 out += AES_BLOCK_SIZE; in aes_ocb_block_update_internal() 201 && !ossl_cipher_trailingdata(buf, bufsz, AES_BLOCK_SIZE, &in, &inl)) { in aes_ocb_block_update_internal()
|
/freebsd/crypto/openssl/providers/implementations/rands/ |
H A D | drbg_ctr.c | 103 int i, outlen = AES_BLOCK_SIZE; in ctr_BCC_block() 129 return ctr_BCC_block(ctr, ctr->KX, in_tmp, AES_BLOCK_SIZE * num_of_blk); in ctr_BCC_blocks() 143 bltmp[(AES_BLOCK_SIZE * 1) + 3] = 1; in ctr_BCC_init() 144 bltmp[(AES_BLOCK_SIZE * 2) + 3] = 2; in ctr_BCC_init() 145 return ctr_BCC_block(ctr, ctr->KX, bltmp, num_of_blk * AES_BLOCK_SIZE); in ctr_BCC_init() 204 int outlen = AES_BLOCK_SIZE; in ctr_df() 238 AES_BLOCK_SIZE) in ctr_df() 239 || outlen != AES_BLOCK_SIZE) in ctr_df() 242 AES_BLOCK_SIZE) in ctr_df() 243 || outlen != AES_BLOCK_SIZE) in ctr_df() [all...] |
/freebsd/contrib/wpa/src/eap_common/ |
H A D | eap_eke_common.c | 49 return AES_BLOCK_SIZE + dhlen; in eap_eke_dhcomp_len() 102 return AES_BLOCK_SIZE + 16 + mac_len; in eap_eke_pnonce_len() 117 return AES_BLOCK_SIZE + 2 * 16 + mac_len; in eap_eke_pnonce_ps_len() 347 u8 iv[AES_BLOCK_SIZE]; in eap_eke_dhcomp() 361 if (random_get_bytes(iv, AES_BLOCK_SIZE)) in eap_eke_dhcomp() 364 iv, AES_BLOCK_SIZE); in eap_eke_dhcomp() 368 os_memcpy(ret_dhcomp, iv, AES_BLOCK_SIZE); in eap_eke_dhcomp() 369 os_memcpy(ret_dhcomp + AES_BLOCK_SIZE, pub, dh_len); in eap_eke_dhcomp() 371 ret_dhcomp, AES_BLOCK_SIZE + dh_len); in eap_eke_dhcomp() 391 os_memcpy(peer_pub, peer_dhcomp + AES_BLOCK_SIZE, dh->prime_len); in eap_eke_shared_secret() [all …]
|
/freebsd/contrib/wpa/src/common/ |
H A D | dpp_auth.c | 68 u8 wrapped_data[4 + DPP_MAX_NONCE_LEN + 4 + 1 + AES_BLOCK_SIZE]; in dpp_auth_build_req() 210 siv_len += AES_BLOCK_SIZE; in dpp_auth_build_req() 246 4 + 4 + DPP_MAX_HASH_LEN + AES_BLOCK_SIZE in dpp_auth_build_resp() 248 u8 wrapped_data[DPP_AUTH_RESP_CLEAR_LEN + AES_BLOCK_SIZE]; in dpp_auth_build_resp() 396 siv_len += AES_BLOCK_SIZE; in dpp_auth_build_resp() 424 u8 wrapped_r_auth[4 + DPP_MAX_HASH_LEN + AES_BLOCK_SIZE], *w_r_auth; in dpp_auth_build_resp_ok() 519 wrapped_r_auth_len = 4 + auth->curve->hash_len + AES_BLOCK_SIZE; in dpp_auth_build_resp_ok() 700 if (!wrapped_data || wrapped_data_len < AES_BLOCK_SIZE) { in dpp_auth_req_rx() 802 unwrapped_len = wrapped_data_len - AES_BLOCK_SIZE; in dpp_auth_req_rx() 980 4 + i_auth_len + r_nonce_len + AES_BLOCK_SIZE; in dpp_auth_build_conf() [all …]
|