/freebsd/contrib/wpa/src/crypto/ |
H A D | crypto_internal.c | 35 size_t key_len; member 40 size_t key_len) in crypto_hash_init() argument 76 if (key_len > sizeof(k_pad)) { in crypto_hash_init() 78 MD5Update(&ctx->u.md5, key, key_len); in crypto_hash_init() 81 key_len = 16; in crypto_hash_init() 83 os_memcpy(ctx->key, key, key_len); in crypto_hash_init() 84 ctx->key_len = key_len; in crypto_hash_init() 86 os_memcpy(k_pad, key, key_len); in crypto_hash_init() 87 if (key_len < sizeof(k_pad)) in crypto_hash_init() 88 os_memset(k_pad + key_len, 0, sizeof(k_pad) - key_len); in crypto_hash_init() [all …]
|
H A D | aes-siv.c | 64 static int aes_s2v(const u8 *key, size_t key_len, in aes_s2v() argument 79 return omac1_aes_vector(key, key_len, 1, data, data_len, mac); in aes_s2v() 84 ret = omac1_aes_vector(key, key_len, 1, data, data_len, tmp); in aes_s2v() 89 ret = omac1_aes_vector(key, key_len, 1, &addr[i], &len[i], in aes_s2v() 104 ret = omac1_aes_vector(key, key_len, 1, data, &len[i], mac); in aes_s2v() 115 return omac1_aes_vector(key, key_len, 1, data, data_len, mac); in aes_s2v() 119 int aes_siv_encrypt(const u8 *key, size_t key_len, in aes_siv_encrypt() argument 132 (key_len != 32 && key_len != 48 && key_len != 64)) in aes_siv_encrypt() 135 key_len /= 2; in aes_siv_encrypt() 137 k2 = key + key_len; in aes_siv_encrypt() [all …]
|
H A D | crypto_gnutls.c | 101 static int gnutls_hmac_vector(int algo, const u8 *key, size_t key_len, in gnutls_hmac_vector() argument 114 if (gcry_md_setkey(hd, key, key_len) != GPG_ERR_NO_ERROR) { in gnutls_hmac_vector() 128 int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_md5_vector() argument 131 return gnutls_hmac_vector(GCRY_MD_MD5, key, key_len, num_elem, addr, in hmac_md5_vector() 136 int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len, in hmac_md5() argument 139 return hmac_md5_vector(key, key_len, 1, &data, &data_len, mac); in hmac_md5() 143 int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_sha1_vector() argument 146 return gnutls_hmac_vector(GCRY_MD_SHA1, key, key_len, num_elem, addr, in hmac_sha1_vector() 151 int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, in hmac_sha1() argument 154 return hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac); in hmac_sha1() [all …]
|
H A D | sha1.c | 26 int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_sha1_vector() argument 44 if (key_len > 64) { in hmac_sha1_vector() 45 if (sha1_vector(1, &key, &key_len, tk)) in hmac_sha1_vector() 48 key_len = 20; in hmac_sha1_vector() 62 os_memcpy(k_pad, key, key_len); in hmac_sha1_vector() 78 os_memcpy(k_pad, key, key_len); in hmac_sha1_vector() 104 int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, in hmac_sha1() argument 107 return hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac); in hmac_sha1()
|
H A D | sha512.c | 26 int hmac_sha512_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_sha512_vector() argument 43 if (key_len > 128) { in hmac_sha512_vector() 44 if (sha512_vector(1, &key, &key_len, tk) < 0) in hmac_sha512_vector() 47 key_len = 64; in hmac_sha512_vector() 61 os_memcpy(k_pad, key, key_len); in hmac_sha512_vector() 77 os_memcpy(k_pad, key, key_len); in hmac_sha512_vector() 100 int hmac_sha512(const u8 *key, size_t key_len, const u8 *data, in hmac_sha512() argument 103 return hmac_sha512_vector(key, key_len, 1, &data, &data_len, mac); in hmac_sha512()
|
H A D | sha384.c | 26 int hmac_sha384_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_sha384_vector() argument 43 if (key_len > 128) { in hmac_sha384_vector() 44 if (sha384_vector(1, &key, &key_len, tk) < 0) in hmac_sha384_vector() 47 key_len = 48; in hmac_sha384_vector() 61 os_memcpy(k_pad, key, key_len); in hmac_sha384_vector() 77 os_memcpy(k_pad, key, key_len); in hmac_sha384_vector() 100 int hmac_sha384(const u8 *key, size_t key_len, const u8 *data, in hmac_sha384() argument 103 return hmac_sha384_vector(key, key_len, 1, &data, &data_len, mac); in hmac_sha384()
|
H A D | md5.c | 26 int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_md5_vector() argument 44 if (key_len > 64) { in hmac_md5_vector() 45 if (md5_vector(1, &key, &key_len, tk)) in hmac_md5_vector() 48 key_len = 16; in hmac_md5_vector() 62 os_memcpy(k_pad, key, key_len); in hmac_md5_vector() 79 os_memcpy(k_pad, key, key_len); in hmac_md5_vector() 105 int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len, in hmac_md5() argument 108 return hmac_md5_vector(key, key_len, 1, &data, &data_len, mac); in hmac_md5()
|
H A D | sha256.c | 26 int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_sha256_vector() argument 44 if (key_len > 64) { in hmac_sha256_vector() 45 if (sha256_vector(1, &key, &key_len, tk) < 0) in hmac_sha256_vector() 48 key_len = 32; in hmac_sha256_vector() 62 os_memcpy(k_pad, key, key_len); in hmac_sha256_vector() 79 os_memcpy(k_pad, key, key_len); in hmac_sha256_vector() 109 int hmac_sha256(const u8 *key, size_t key_len, const u8 *data, in hmac_sha256() argument 112 return hmac_sha256_vector(key, key_len, 1, &data, &data_len, mac); in hmac_sha256()
|
H A D | crypto_nettle.c | 108 int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_md5_vector() argument 117 hmac_md5_set_key(&ctx, key_len, key); in hmac_md5_vector() 126 int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len, in hmac_md5() argument 129 return hmac_md5_vector(key, key_len, 1, &data, &data_len, mac); in hmac_md5() 133 int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_sha1_vector() argument 142 hmac_sha1_set_key(&ctx, key_len, key); in hmac_sha1_vector() 151 int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, in hmac_sha1() argument 154 return hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac); in hmac_sha1() 160 int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_sha256_vector() argument 169 hmac_sha256_set_key(&ctx, key_len, key); in hmac_sha256_vector() [all …]
|
H A D | crypto_linux.c | 58 size_t key_len, size_t num_elem, in linux_af_alg_hash_vector() argument 71 if (key && setsockopt(s, SOL_ALG, ALG_SET_KEY, key, key_len) < 0) { in linux_af_alg_hash_vector() 171 int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_md5_vector() argument 174 return linux_af_alg_hash_vector("hmac(md5)", key, key_len, num_elem, in hmac_md5_vector() 179 int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len, in hmac_md5() argument 182 return hmac_md5_vector(key, key_len, 1, &data, &data_len, mac); in hmac_md5() 186 int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, in hmac_sha1_vector() argument 189 return linux_af_alg_hash_vector("hmac(sha1)", key, key_len, num_elem, in hmac_sha1_vector() 194 int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, in hmac_sha1() argument 197 return hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac); in hmac_sha1() [all …]
|
H A D | aes_wrap.h | 25 int __must_check omac1_aes_vector(const u8 *key, size_t key_len, 36 int __must_check aes_ctr_encrypt(const u8 *key, size_t key_len, const u8 *nonce, 52 int __must_check aes_gcm_ae(const u8 *key, size_t key_len, 57 int __must_check aes_gcm_ad(const u8 *key, size_t key_len, 62 int __must_check aes_gmac(const u8 *key, size_t key_len, 65 int __must_check aes_ccm_ae(const u8 *key, size_t key_len, const u8 *nonce, 68 int __must_check aes_ccm_ad(const u8 *key, size_t key_len, const u8 *nonce,
|
H A D | sha256-prf.c | 30 int sha256_prf(const u8 *key, size_t key_len, const char *label, in sha256_prf() argument 33 return sha256_prf_bits(key, key_len, label, data, data_len, buf, in sha256_prf() 54 int sha256_prf_bits(const u8 *key, size_t key_len, const char *label, in sha256_prf_bits() argument 81 if (hmac_sha256_vector(key, key_len, 4, addr, len, in sha256_prf_bits() 86 if (hmac_sha256_vector(key, key_len, 4, addr, len, in sha256_prf_bits()
|
H A D | sha384-prf.c | 30 int sha384_prf(const u8 *key, size_t key_len, const char *label, in sha384_prf() argument 33 return sha384_prf_bits(key, key_len, label, data, data_len, buf, in sha384_prf() 54 int sha384_prf_bits(const u8 *key, size_t key_len, const char *label, in sha384_prf_bits() argument 81 if (hmac_sha384_vector(key, key_len, 4, addr, len, in sha384_prf_bits() 86 if (hmac_sha384_vector(key, key_len, 4, addr, len, in sha384_prf_bits()
|
/freebsd/contrib/libfido2/src/ |
H A D | hid.c | 11 get_key_len(uint8_t tag, uint8_t *key, size_t *key_len) in get_key_len() argument 19 *key_len = tag & 0x3; in get_key_len() 20 if (*key_len == 3) { in get_key_len() 21 *key_len = 4; in get_key_len() 28 get_key_val(const void *body, size_t key_len, uint32_t *val) in get_key_val() argument 32 switch (key_len) { in get_key_val() 43 fido_log_debug("%s: key_len=%zu", __func__, key_len); in get_key_val() 63 size_t key_len; in fido_hid_get_usage() local 66 if (get_key_len(tag, &key, &key_len) < 0 || key_len > len || in fido_hid_get_usage() 67 get_key_val(ptr, key_len, &key_val) < 0) { in fido_hid_get_usage() [all …]
|
/freebsd/contrib/ntp/sntp/tests/ |
H A D | crypto.c | 43 sk.key_len = sizeof(KEY) - 1; in test_MakeMd5Mac() 44 memcpy(&sk.key_seq, KEY, min(sizeof(sk.key_seq), sk.key_len)); in test_MakeMd5Mac() 76 sha1.key_len = 7; in test_MakeSHA1Mac() 77 memcpy(&sha1.key_seq, "sha1seq", sha1.key_len); in test_MakeSHA1Mac() 110 cmac.key_len = CMAC_LENGTH; in test_MakeCMac() 111 memcpy(&cmac.key_seq, "aes-128-cmac-seq", cmac.key_len); in test_MakeCMac() 145 sk.key_len = sizeof(KEY) - 1; in test_VerifySHA1() 146 memcpy(&sk.key_seq, KEY, min(sizeof(sk.key_seq), sk.key_len)); in test_VerifySHA1() 180 sha1.key_len = 7; in test_VerifyCMAC() 181 memcpy(&sha1.key_seq, "sha1key", sha1.key_len); in test_VerifyCMAC() [all...] |
H A D | keyFile.c | 11 bool CompareKeysAlternative(int key_id,int key_len,const char* type,const char* key_seq,struct key … 30 if (expected.key_len != actual.key_len) { in CompareKeys() 32 expected.key_len, actual.key_len); in CompareKeys() 41 if (memcmp(expected.key_seq, actual.key_seq, expected.key_len) != 0) { in CompareKeys() 52 int key_len, in CompareKeysAlternative() argument 61 temp.key_len = key_len; in CompareKeysAlternative() 63 memcpy(temp.key_seq, key_seq, key_len); in CompareKeysAlternative()
|
/freebsd/contrib/libarchive/libarchive/ |
H A D | archive_cryptor.c | 165 aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) in aes_ctr_init() argument 169 ctx->key_len = key_len; in aes_ctr_init() 170 memcpy(ctx->key, key, key_len); in aes_ctr_init() 174 ccNoPadding, NULL, key, key_len, NULL, 0, 0, 0, &ctx->ctx); in aes_ctr_init() 195 memset(ctx->key, 0, ctx->key_len); in aes_ctr_release() 203 aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) in aes_ctr_init() argument 216 switch (key_len) { in aes_ctr_init() 257 (PUCHAR)(uintptr_t)key, (ULONG)key_len, 0); in aes_ctr_init() 304 aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) in aes_ctr_init() argument 307 ctx->key_len = key_len; in aes_ctr_init() [all …]
|
H A D | archive_hmac.c | 51 __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) in __hmac_sha1_init() argument 53 CCHmacInit(ctx, kCCHmacAlgSHA1, key, key_len); in __hmac_sha1_init() 84 __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) in __hmac_sha1_init() argument 113 (PUCHAR)key, (ULONG)key_len, BCRYPT_HASH_REUSABLE_FLAG); in __hmac_sha1_init() 156 __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) in __hmac_sha1_init() argument 172 ret = mbedtls_md_hmac_starts(ctx, key, key_len); in __hmac_sha1_init() 203 __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) in __hmac_sha1_init() argument 205 hmac_sha1_set_key(ctx, key_len, key); in __hmac_sha1_init() 231 __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) in __hmac_sha1_init() argument 248 EVP_MAC_init(*ctx, key, key_len, params); in __hmac_sha1_init() [all …]
|
H A D | archive_cryptor_private.h | 59 unsigned key_len; member 96 unsigned key_len; member 120 unsigned key_len; member 135 unsigned key_len; member 153 #define archive_decrypto_aes_ctr_init(ctx, key, key_len) \ argument 154 __archive_cryptor.decrypto_aes_ctr_init(ctx, key, key_len) 160 #define archive_encrypto_aes_ctr_init(ctx, key, key_len) \ argument 161 __archive_cryptor.encrypto_aes_ctr_init(ctx, key, key_len)
|
/freebsd/contrib/wpa/src/wps/ |
H A D | wps_attr_process.c | 170 const u8 *key, size_t key_len) in wps_process_cred_network_key() argument 185 wpa_hexdump_key(MSG_DEBUG, "WPS: Network Key", key, key_len); in wps_process_cred_network_key() 186 if (key_len <= sizeof(cred->key)) { in wps_process_cred_network_key() 187 os_memcpy(cred->key, key, key_len); in wps_process_cred_network_key() 188 cred->key_len = key_len; in wps_process_cred_network_key() 214 cred->key_len > 8 && cred->key_len < 64 && in wps_workaround_cred_key() 215 cred->key[cred->key_len - 1] == 0) { in wps_workaround_cred_key() 220 cred->key, cred->key_len); in wps_workaround_cred_key() 230 cred->key_len--; in wps_workaround_cred_key() 236 (cred->key_len < 8 || has_ctrl_char(cred->key, cred->key_len))) { in wps_workaround_cred_key() [all …]
|
/freebsd/lib/libcrypt/ |
H A D | crypt-sha256.c | 69 size_t salt_len, key_len, cnt, rounds; in crypt_sha256() local 97 key_len = strlen(key); in crypt_sha256() 103 SHA256_Update(&ctx, key, key_len); in crypt_sha256() 115 SHA256_Update(&alt_ctx, key, key_len); in crypt_sha256() 121 SHA256_Update(&alt_ctx, key, key_len); in crypt_sha256() 127 for (cnt = key_len; cnt > 32; cnt -= 32) in crypt_sha256() 133 for (cnt = key_len; cnt > 0; cnt >>= 1) in crypt_sha256() 137 SHA256_Update(&ctx, key, key_len); in crypt_sha256() 146 for (cnt = 0; cnt < key_len; ++cnt) in crypt_sha256() 147 SHA256_Update(&alt_ctx, key, key_len); in crypt_sha256() [all …]
|
H A D | crypt-sha512.c | 69 size_t salt_len, key_len, cnt, rounds; in crypt_sha512() local 97 key_len = strlen(key); in crypt_sha512() 103 SHA512_Update(&ctx, key, key_len); in crypt_sha512() 115 SHA512_Update(&alt_ctx, key, key_len); in crypt_sha512() 121 SHA512_Update(&alt_ctx, key, key_len); in crypt_sha512() 127 for (cnt = key_len; cnt > 64; cnt -= 64) in crypt_sha512() 133 for (cnt = key_len; cnt > 0; cnt >>= 1) in crypt_sha512() 137 SHA512_Update(&ctx, key, key_len); in crypt_sha512() 146 for (cnt = 0; cnt < key_len; ++cnt) in crypt_sha512() 147 SHA512_Update(&alt_ctx, key, key_len); in crypt_sha512() [all …]
|
/freebsd/contrib/bearssl/src/mac/ |
H A D | hmac.c | 39 const void *key, size_t key_len, unsigned bb) in process_key() argument 45 memcpy(tmp, key, key_len); in process_key() 46 for (u = 0; u < key_len; u ++) { in process_key() 49 memset(tmp + key_len, bb, blen - key_len); in process_key() 58 const br_hash_class *dig, const void *key, size_t key_len) in br_hmac_key_init() argument 65 if (key_len > block_size(dig)) { in br_hmac_key_init() 67 dig->update(&hc.vtable, key, key_len); in br_hmac_key_init() 70 key_len = br_digest_size(dig); in br_hmac_key_init() 72 process_key(&hc.vtable, kc->ksi, key, key_len, 0x36); in br_hmac_key_init() 73 process_key(&hc.vtable, kc->kso, key, key_len, 0x5C); in br_hmac_key_init()
|
/freebsd/crypto/openssl/providers/implementations/kdfs/ |
H A D | krb5kdf.c | 46 const unsigned char *key, size_t key_len, 54 size_t key_len; member 90 OPENSSL_clear_free(ctx->key, ctx->key_len); in krb5kdf_reset() 129 return KRB5KDF(cipher, engine, ctx->key, ctx->key_len, in krb5kdf_derive() 147 if (!krb5kdf_set_membuf(&ctx->key, &ctx->key_len, p)) in krb5kdf_set_ctx_params() 328 const unsigned char *key, size_t key_len) in cipher_init() argument 337 if (key_len != (size_t)klen) { in cipher_init() 338 ret = EVP_CIPHER_CTX_set_key_length(ctx, key_len); in cipher_init() 356 const unsigned char *key, size_t key_len, in KRB5KDF() argument 371 if (key_len != okey_len) { in KRB5KDF() [all …]
|
/freebsd/contrib/tcpdump/ |
H A D | signature.c | 50 unsigned int key_len, uint8_t *digest) in signature_compute_hmac_md5() argument 59 if (key_len > 64) { in signature_compute_hmac_md5() 64 MD5_Update(&tctx, key, key_len); in signature_compute_hmac_md5() 68 key_len = 16; in signature_compute_hmac_md5() 85 memcpy(k_ipad, key, key_len); in signature_compute_hmac_md5() 86 memcpy(k_opad, key, key_len); in signature_compute_hmac_md5()
|