| /netbsd/src/external/bsd/wpa/dist/src/crypto/ |
| 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 …]
|
| 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 …]
|
| 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 …]
|
| 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 …]
|
| 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()
|
| 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()
|
| 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()
|
| 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()
|
| 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()
|
| 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 …]
|
| 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,
|
| 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()
|
| D | sha512-prf.c | 30 int sha512_prf(const u8 *key, size_t key_len, const char *label, in sha512_prf() argument 33 return sha512_prf_bits(key, key_len, label, data, data_len, buf, in sha512_prf() 54 int sha512_prf_bits(const u8 *key, size_t key_len, const char *label, in sha512_prf_bits() argument 81 if (hmac_sha512_vector(key, key_len, 4, addr, len, in sha512_prf_bits() 86 if (hmac_sha512_vector(key, key_len, 4, addr, len, in sha512_prf_bits()
|
| /netbsd/src/sys/netinet/ |
| D | sctp_hashdriver.c | 69 void sctp_hash_digest(char *key, int key_len, char *text, int text_len, in sctp_hash_digest() argument 84 if (key_len > 64) { in sctp_hash_digest() 88 MD5Update(&tctx, key, key_len); in sctp_hash_digest() 91 key_len = 16; in sctp_hash_digest() 95 SHA1Update(&tctx, key, key_len); in sctp_hash_digest() 98 key_len = 20; in sctp_hash_digest() 116 bcopy(key, k_ipad, key_len); in sctp_hash_digest() 117 bcopy(key, k_opad, key_len); in sctp_hash_digest() 155 void sctp_hash_digest_m(char *key, int key_len, struct mbuf *m, int offset, in sctp_hash_digest_m() argument 171 if (key_len > 64) { in sctp_hash_digest_m() [all …]
|
| /netbsd/src/external/ibm-public/postfix/dist/src/util/ |
| D | binhash.c | 177 BINHASH_INFO **_h = table->data + binhash_hash(elm->key, elm->key_len, table->size);\ 236 BINHASH_INFO *binhash_enter(BINHASH *table, const void *key, ssize_t key_len, void *value) in binhash_enter() argument 243 ht->key = mymemdup(key, key_len); in binhash_enter() 244 ht->key_len = key_len; in binhash_enter() 252 void *binhash_find(BINHASH *table, const void *key, ssize_t key_len) in binhash_find() argument 259 for (ht = table->data[binhash_hash(key, key_len, table->size)]; ht; ht = ht->next) in binhash_find() 260 if (key_len == ht->key_len && KEY_EQ(key, ht->key, key_len)) in binhash_find() 267 BINHASH_INFO *binhash_locate(BINHASH *table, const void *key, ssize_t key_len) in binhash_locate() argument 272 for (ht = table->data[binhash_hash(key, key_len, table->size)]; ht; ht = ht->next) in binhash_locate() 273 if (key_len == ht->key_len && KEY_EQ(key, ht->key, key_len)) in binhash_locate() [all …]
|
| /netbsd/src/external/bsd/libarchive/dist/libarchive/ |
| 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 …]
|
| 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 …]
|
| 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)
|
| /netbsd/src/external/bsd/wpa/dist/src/wps/ |
| 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 …]
|
| /netbsd/src/external/bsd/ntp/dist/sntp/tests/ |
| D | crypto.c | 45 sk.key_len = sizeof(KEY) - 1; in test_MakeSHAKE128Mac() 46 memcpy(&sk.key_seq, KEY, min(sizeof(sk.key_seq), sk.key_len)); in test_MakeSHAKE128Mac() 78 sha1.key_len = 7; in test_MakeSHA1Mac() 79 memcpy(&sha1.key_seq, "sha1seq", sha1.key_len); in test_MakeSHA1Mac() 112 cmac.key_len = CMAC_LENGTH; in test_MakeCMac() 113 memcpy(&cmac.key_seq, "aes-128-cmac-seq", cmac.key_len); in test_MakeCMac() 147 sk.key_len = sizeof(KEY) - 1; in test_VerifySHAKE128() 148 memcpy(&sk.key_seq, KEY, min(sizeof(sk.key_seq), sk.key_len)); in test_VerifySHAKE128() 182 sha1.key_len = 7; in test_VerifySHA1() 183 memcpy(&sha1.key_seq, "sha1key", sha1.key_len); in test_VerifySHA1() [all …]
|
| D | keyFile.c | 13 bool CompareKeysAlternative(int key_id,int key_len,const char* type,const char* key_seq,struct key … 32 if (expected.key_len != actual.key_len) { in CompareKeys() 34 expected.key_len, actual.key_len); in CompareKeys() 43 if (memcmp(expected.key_seq, actual.key_seq, expected.key_len) != 0) { in CompareKeys() 54 int key_len, in CompareKeysAlternative() argument 63 temp.key_len = key_len; in CompareKeysAlternative() 65 memcpy(temp.key_seq, key_seq, key_len); in CompareKeysAlternative()
|
| /netbsd/src/lib/libresolv/ |
| D | hmac_link.c | 272 int len, key_len; in dst_hmac_md5_key_to_file_format() local 296 for (key_len = 0; key_len < HMAC_LEN; key_len++) in dst_hmac_md5_key_to_file_format() 297 key[key_len] = hkey->hk_ipad[key_len] ^ HMAC_IPAD; in dst_hmac_md5_key_to_file_format() 298 for (key_len = HMAC_LEN - 1; key_len >= 0; key_len--) in dst_hmac_md5_key_to_file_format() 299 if (key[key_len] != 0) in dst_hmac_md5_key_to_file_format() 301 key_len++; in dst_hmac_md5_key_to_file_format() 303 len = b64_ntop(key, key_len, bp, BUF_LEFT); in dst_hmac_md5_key_to_file_format() 340 int key_len, len; in dst_hmac_md5_key_from_file_format() local 361 key_len = b64_pton((char *)tmp, key, HMAC_LEN+1); /*%< see above */ in dst_hmac_md5_key_from_file_format() 364 if (dst_buffer_to_hmac_md5(dkey, key, key_len) < 0) { in dst_hmac_md5_key_from_file_format()
|
| /netbsd/src/lib/libcrypt/ |
| D | hmac.c | 68 const unsigned char *key, size_t key_len, in HMAC_FUNC() argument 84 if (key_len > HMAC_BLOCKSZ) { in HMAC_FUNC() 88 HASH_Update(&tctx, key, key_len); in HMAC_FUNC() 92 key_len = HASH_LENGTH; in HMAC_FUNC() 111 for (i = 0; i < key_len; i++) { in HMAC_FUNC() 287 int key_len; in main() local 303 key_len = strlen(key); in main() 305 HMAC_FUNC(data, data_len, key, key_len, digest); in main()
|
| /netbsd/src/external/bsd/wpa/dist/src/eap_common/ |
| D | ikev2_common.c | 56 int ikev2_integ_hash(int alg, const u8 *key, size_t key_len, const u8 *data, in ikev2_integ_hash() argument 63 if (key_len != 20) in ikev2_integ_hash() 65 if (hmac_sha1(key, key_len, data, data_len, tmphash) < 0) in ikev2_integ_hash() 70 if (key_len != 16) in ikev2_integ_hash() 72 if (hmac_md5(key, key_len, data, data_len, tmphash) < 0) in ikev2_integ_hash() 97 int ikev2_prf_hash(int alg, const u8 *key, size_t key_len, in ikev2_prf_hash() argument 103 return hmac_sha1_vector(key, key_len, num_elem, addr, len, in ikev2_prf_hash() 106 return hmac_md5_vector(key, key_len, num_elem, addr, len, hash); in ikev2_prf_hash() 113 int ikev2_prf_plus(int alg, const u8 *key, size_t key_len, in ikev2_prf_plus() argument 143 res = ikev2_prf_hash(alg, key, key_len, 2, &addr[1], in ikev2_prf_plus() [all …]
|
| /netbsd/src/external/bsd/tcpdump/dist/ |
| D | signature.c | 55 unsigned int key_len, uint8_t *digest) in signature_compute_hmac_md5() argument 64 if (key_len > 64) { in signature_compute_hmac_md5() 69 MD5_Update(&tctx, key, key_len); in signature_compute_hmac_md5() 73 key_len = 16; in signature_compute_hmac_md5() 90 memcpy(k_ipad, key, key_len); in signature_compute_hmac_md5() 91 memcpy(k_opad, key, key_len); in signature_compute_hmac_md5()
|