| /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() 65 aes_block_t *iv2p = (aes_block_t *)(ivec + AES_BLOCK_SIZE); in AES_ige_encrypt() 80 in += AES_BLOCK_SIZE; in AES_ige_encrypt() 81 out += AES_BLOCK_SIZE; in AES_ige_encrypt() 83 memcpy(ivec, ivp->data, AES_BLOCK_SIZE); in AES_ige_encrypt() 84 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/crypto/krb5/src/lib/crypto/builtin/enc_provider/ |
| H A D | aes.c | 160 for (q = 0; q < AES_BLOCK_SIZE; q += 4) in xorblock() 209 for (; nblocks > 0; nblocks--, data += AES_BLOCK_SIZE) { in cbc_enc() 213 memcpy(iv, data, AES_BLOCK_SIZE); in cbc_enc() 221 unsigned char last_cipherblock[AES_BLOCK_SIZE]; in cbc_dec() 228 data += (nblocks - 1) * AES_BLOCK_SIZE; in cbc_dec() 229 memcpy(last_cipherblock, data, AES_BLOCK_SIZE); in cbc_dec() 230 for (; nblocks > 0; nblocks--, data -= AES_BLOCK_SIZE) { in cbc_dec() 233 xorblock(nblocks == 1 ? iv : data - AES_BLOCK_SIZE, data); in cbc_dec() 235 memcpy(iv, last_cipherblock, AES_BLOCK_SIZE); in cbc_dec() 242 unsigned char iv[AES_BLOCK_SIZE], block[AES_BLOCK_SIZE]; in krb5int_aes_encrypt() [all …]
|
| /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]; 75 #define AES_BLOCK_SIZE 16 macro 81 uint8_t nonce[AES_BLOCK_SIZE]; 82 uint8_t encr_buf[AES_BLOCK_SIZE]; 93 #define AES_BLOCK_SIZE 16 macro 99 uint8_t nonce[AES_BLOCK_SIZE]; 100 uint8_t encr_buf[AES_BLOCK_SIZE]; 128 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/providers/implementations/ciphers/ |
| H A D | cipher_aes_xts_s390x.inc | 112 unsigned char tmp[2][AES_BLOCK_SIZE]; 113 unsigned char nap_n1[AES_BLOCK_SIZE]; 114 unsigned char drop[AES_BLOCK_SIZE]; 118 || inl < AES_BLOCK_SIZE 131 if (inl > XTS_MAX_BLOCKS_PER_DATA_UNIT * AES_BLOCK_SIZE) { 136 len_incomplete = inl % AES_BLOCK_SIZE; 138 (inl / AES_BLOCK_SIZE - 1) * AES_BLOCK_SIZE; 145 memcpy(tmp, in + len_complete, AES_BLOCK_SIZE + len_incomplete); 148 memcpy(nap_n1, km->nap, AES_BLOCK_SIZE); 149 s390x_km(tmp[0], AES_BLOCK_SIZE, drop, fc, param); [all …]
|
| 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() 392 else if (len != ((plen + SHA_DIGEST_LENGTH + AES_BLOCK_SIZE) & -AES_BLOCK_SIZE)) in aesni_cbc_hmac_sha1_cipher() 395 iv = AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 457 if (len < (AES_BLOCK_SIZE + SHA_DIGEST_LENGTH + 1)) in aesni_cbc_hmac_sha1_cipher() 461 memcpy(ctx->base.iv, in, AES_BLOCK_SIZE); in aesni_cbc_hmac_sha1_cipher() 463 in += AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 464 out += AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 465 len -= AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 675 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];
|
| /freebsd/crypto/openssl/engines/ |
| H A D | e_padlock.c | 184 #define AES_BLOCK_SIZE 16 macro 197 unsigned char iv[AES_BLOCK_SIZE]; /* Initialization vector */ 323 memcpy(cdata->iv, EVP_CIPHER_CTX_iv(ctx), AES_BLOCK_SIZE); in padlock_cbc_cipher() 325 memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), cdata->iv, AES_BLOCK_SIZE); in padlock_cbc_cipher() 339 if (chunk >= AES_BLOCK_SIZE) in padlock_cfb_cipher() 343 while (chunk < AES_BLOCK_SIZE && nbytes != 0) { in padlock_cfb_cipher() 348 while (chunk < AES_BLOCK_SIZE && nbytes != 0) { in padlock_cfb_cipher() 354 EVP_CIPHER_CTX_set_num(ctx, chunk % AES_BLOCK_SIZE); in padlock_cfb_cipher() 360 memcpy(cdata->iv, EVP_CIPHER_CTX_iv(ctx), AES_BLOCK_SIZE); in padlock_cfb_cipher() 362 if ((chunk = nbytes & ~(AES_BLOCK_SIZE - 1))) { in padlock_cfb_cipher() [all …]
|
| H A D | e_ossltest.c | 799 if (len % AES_BLOCK_SIZE) in ossltest_aes128_cbc_hmac_sha1_cipher() 805 else if (len != ((plen + SHA_DIGEST_LENGTH + AES_BLOCK_SIZE) & -AES_BLOCK_SIZE)) in ossltest_aes128_cbc_hmac_sha1_cipher() 827 if (len < (AES_BLOCK_SIZE + SHA_DIGEST_LENGTH + 1)) in ossltest_aes128_cbc_hmac_sha1_cipher() 831 in += AES_BLOCK_SIZE; in ossltest_aes128_cbc_hmac_sha1_cipher() 832 out += AES_BLOCK_SIZE; in ossltest_aes128_cbc_hmac_sha1_cipher() 833 len -= AES_BLOCK_SIZE; in ossltest_aes128_cbc_hmac_sha1_cipher() 873 if (len < AES_BLOCK_SIZE) in ossltest_aes128_cbc_hmac_sha1_ctrl() 875 len -= AES_BLOCK_SIZE; in ossltest_aes128_cbc_hmac_sha1_ctrl() 880 return (int)(((len + SHA_DIGEST_LENGTH + AES_BLOCK_SIZE) & -AES_BLOCK_SIZE) in ossltest_aes128_cbc_hmac_sha1_ctrl()
|
| /freebsd/crypto/openssl/crypto/evp/ |
| H A D | e_aes_cbc_hmac_sha1.c | 422 if (len % AES_BLOCK_SIZE) in aesni_cbc_hmac_sha1_cipher() 428 else if (len != ((plen + SHA_DIGEST_LENGTH + AES_BLOCK_SIZE) & -AES_BLOCK_SIZE)) in aesni_cbc_hmac_sha1_cipher() 431 iv = AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 493 unsigned char tail_iv[AES_BLOCK_SIZE]; in aesni_cbc_hmac_sha1_cipher() 505 if (len < (AES_BLOCK_SIZE + SHA_DIGEST_LENGTH + 1)) in aesni_cbc_hmac_sha1_cipher() 509 memcpy(ctx->iv, in, AES_BLOCK_SIZE); in aesni_cbc_hmac_sha1_cipher() 511 in += AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 512 out += AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 513 len -= AES_BLOCK_SIZE; in aesni_cbc_hmac_sha1_cipher() 520 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()
|
| /freebsd/crypto/krb5/src/lib/crypto/builtin/aes/ |
| H A D | aescrypt.c | 107 …if(cx->inf.b[0] != 10 * AES_BLOCK_SIZE && cx->inf.b[0] != 12 * AES_BLOCK_SIZE && cx->inf.b[0] != 1… 117 case 14 * AES_BLOCK_SIZE: 121 case 12 * AES_BLOCK_SIZE: 125 case 10 * AES_BLOCK_SIZE: 239 …if(cx->inf.b[0] != 10 * AES_BLOCK_SIZE && cx->inf.b[0] != 12 * AES_BLOCK_SIZE && cx->inf.b[0] != 1… 250 case 14 * AES_BLOCK_SIZE: 253 case 12 * AES_BLOCK_SIZE: 256 case 10 * AES_BLOCK_SIZE:
|
| /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/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/crypto/openssl/providers/implementations/rands/ |
| H A D | drbg_ctr.c | 111 int i, outlen = AES_BLOCK_SIZE; in ctr_BCC_block() 136 return ctr_BCC_block(ctr, ctr->KX, in_tmp, AES_BLOCK_SIZE * num_of_blk); in ctr_BCC_blocks() 150 bltmp[(AES_BLOCK_SIZE * 1) + 3] = 1; in ctr_BCC_init() 151 bltmp[(AES_BLOCK_SIZE * 2) + 3] = 2; in ctr_BCC_init() 152 return ctr_BCC_block(ctr, ctr->KX, bltmp, num_of_blk * AES_BLOCK_SIZE); in ctr_BCC_init() 211 int outlen = AES_BLOCK_SIZE; in ctr_df() 245 AES_BLOCK_SIZE) in ctr_df() 246 || outlen != AES_BLOCK_SIZE) in ctr_df() 249 AES_BLOCK_SIZE) in ctr_df() 250 || outlen != AES_BLOCK_SIZE) in ctr_df() [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 …]
|