Home
last modified time | relevance | path

Searched refs:hmac (Results 1 – 20 of 20) sorted by relevance

/optee_os/core/lib/libtomcrypt/src/mac/hmac/
H A Dhmac_init.c22 int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned long keylen) in hmac_init() argument
29 LTC_ARGCHK(hmac != NULL); in hmac_init()
36 hmac->hash = hash; in hmac_init()
51 if (sizeof(hmac->key) < LTC_HMAC_BLOCKSIZE) { in hmac_init()
59 if ((err = hash_memory(hash, key, keylen, hmac->key, &z)) != CRYPT_OK) { in hmac_init()
64 XMEMCPY(hmac->key, key, (size_t)keylen); in hmac_init()
68 zeromem((hmac->key) + keylen, (size_t)(LTC_HMAC_BLOCKSIZE - keylen)); in hmac_init()
73 buf[i] = hmac->key[i] ^ 0x36; in hmac_init()
77 if ((err = hash_descriptor[hash]->init(&hmac->md)) != CRYPT_OK) { in hmac_init()
81 if ((err = hash_descriptor[hash]->process(&hmac->md, buf, LTC_HMAC_BLOCKSIZE)) != CRYPT_OK) { in hmac_init()
H A Dhmac_done.c21 int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen) in hmac_done() argument
27 LTC_ARGCHK(hmac != NULL); in hmac_done()
31 hash = hmac->hash; in hmac_done()
53 if ((err = hash_descriptor[hash]->done(&hmac->md, isha)) != CRYPT_OK) { in hmac_done()
59 buf[i] = hmac->key[i] ^ 0x5C; in hmac_done()
63 if ((err = hash_descriptor[hash]->init(&hmac->md)) != CRYPT_OK) { in hmac_done()
66 if ((err = hash_descriptor[hash]->process(&hmac->md, buf, LTC_HMAC_BLOCKSIZE)) != CRYPT_OK) { in hmac_done()
69 if ((err = hash_descriptor[hash]->process(&hmac->md, isha, hashsize)) != CRYPT_OK) { in hmac_done()
72 if ((err = hash_descriptor[hash]->done(&hmac->md, buf)) != CRYPT_OK) { in hmac_done()
87 zeromem(hmac, sizeof(*hmac)); in hmac_done()
H A Dhmac_memory.c28 hmac_state *hmac; in hmac_memory() local
48 hmac = XMALLOC(sizeof(hmac_state)); in hmac_memory()
49 if (hmac == NULL) { in hmac_memory()
53 if ((err = hmac_init(hmac, hash, key, keylen)) != CRYPT_OK) { in hmac_memory()
57 if ((err = hmac_process(hmac, in, inlen)) != CRYPT_OK) { in hmac_memory()
61 if ((err = hmac_done(hmac, out, outlen)) != CRYPT_OK) { in hmac_memory()
68 zeromem(hmac, sizeof(hmac_state)); in hmac_memory()
71 XFREE(hmac); in hmac_memory()
H A Dhmac_memory_multi.c31 hmac_state *hmac; in hmac_memory_multi() local
43 hmac = XMALLOC(sizeof(hmac_state)); in hmac_memory_multi()
44 if (hmac == NULL) { in hmac_memory_multi()
48 if ((err = hmac_init(hmac, hash, key, keylen)) != CRYPT_OK) { in hmac_memory_multi()
57 if ((err = hmac_process(hmac, curptr, curlen)) != CRYPT_OK) { in hmac_memory_multi()
67 if ((err = hmac_done(hmac, out, outlen)) != CRYPT_OK) { in hmac_memory_multi()
72 zeromem(hmac, sizeof(hmac_state)); in hmac_memory_multi()
74 XFREE(hmac); in hmac_memory_multi()
H A Dhmac_process.c19 int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen) in hmac_process() argument
22 LTC_ARGCHK(hmac != NULL); in hmac_process()
24 if ((err = hash_is_valid(hmac->hash)) != CRYPT_OK) { in hmac_process()
27 return hash_descriptor[hmac->hash]->process(&hmac->md, in, inlen); in hmac_process()
H A Dhmac_file.c35 hmac_state hmac; in hmac_file()
54 if ((err = hmac_init(&hmac, hash, key, keylen)) != CRYPT_OK) { in hmac_file()
66 if ((err = hmac_process(&hmac, buf, (unsigned long)x)) != CRYPT_OK) { in hmac_file()
77 err = hmac_done(&hmac, out, outlen); in hmac_file()
83 zeromem(&hmac, sizeof(hmac_state)); in hmac_file()
/optee_os/core/lib/libtomcrypt/src/misc/pkcs5/
H A Dpkcs_5_2.c32 hmac_state *hmac; in pkcs_5_alg2() local
49 hmac = XMALLOC(sizeof(hmac_state)); in pkcs_5_alg2()
50 if (hmac == NULL || buf[0] == NULL) { in pkcs_5_alg2()
51 if (hmac != NULL) { in pkcs_5_alg2()
52 XFREE(hmac); in pkcs_5_alg2()
74 if ((err = hmac_init(hmac, hash_idx, password, password_len)) != CRYPT_OK) { in pkcs_5_alg2()
77 if ((err = hmac_process(hmac, salt, salt_len)) != CRYPT_OK) { in pkcs_5_alg2()
80 if ((err = hmac_process(hmac, buf[1], 4)) != CRYPT_OK) { in pkcs_5_alg2()
84 if ((err = hmac_done(hmac, buf[0], &x)) != CRYPT_OK) { in pkcs_5_alg2()
111 zeromem(hmac, sizeof(hmac_state)); in pkcs_5_alg2()
[all …]
/optee_os/lib/libmbedtls/mbedtls/library/
H A Dpsa_crypto_mac.c25 mbedtls_psa_hmac_operation_t *hmac) in psa_hmac_abort_internal() argument
27 mbedtls_platform_zeroize(hmac->opad, sizeof(hmac->opad)); in psa_hmac_abort_internal()
28 return psa_hash_abort(&hmac->hash_ctx); in psa_hmac_abort_internal()
32 mbedtls_psa_hmac_operation_t *hmac, in psa_hmac_setup_internal() argument
43 hmac->alg = hash_alg; in psa_hmac_setup_internal()
54 if (block_size > sizeof(hmac->opad)) { in psa_hmac_setup_internal()
86 hmac->opad[i] = ipad[i] ^ 0x36 ^ 0x5C; in psa_hmac_setup_internal()
88 memset(hmac->opad + key_length, 0x5C, block_size - key_length); in psa_hmac_setup_internal()
90 status = psa_hash_setup(&hmac->hash_ctx, hash_alg); in psa_hmac_setup_internal()
95 status = psa_hash_update(&hmac->hash_ctx, ipad, block_size); in psa_hmac_setup_internal()
[all …]
H A Dmd.c421 int mbedtls_md_setup(mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info, int hmac) in mbedtls_md_setup() argument
437 if (hmac != 0) { in mbedtls_md_setup()
500 if (hmac != 0) { in mbedtls_md_setup()
H A Dpsa_crypto.c5719 status = psa_mac_abort(&operation->ctx.hkdf.hmac); in psa_key_derivation_abort()
5855 status = psa_key_derivation_start_hmac(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5864 status = psa_mac_update(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5871 status = psa_mac_update(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5877 status = psa_mac_update(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5882 status = psa_mac_sign_finish(&hkdf->hmac, in psa_key_derivation_hkdf_read()
5903 psa_mac_operation_t hmac; in psa_key_derivation_tls12_prf_generate_next_block() local
5937 status = psa_key_derivation_start_hmac(&hmac, in psa_key_derivation_tls12_prf_generate_next_block()
5950 status = psa_mac_update(&hmac, in psa_key_derivation_tls12_prf_generate_next_block()
5956 status = psa_mac_update(&hmac, in psa_key_derivation_tls12_prf_generate_next_block()
[all …]
/optee_os/scripts/
H A Dderive_rpmb_key.py58 from cryptography.hazmat.primitives import hashes, hmac
70 h = hmac.HMAC(huk, hashes.SHA256())
/optee_os/core/drivers/crypto/stm32/
H A Dsub.mk9 srcs-$(CFG_CRYPTO_DRV_MAC) += hmac.c
/optee_os/lib/libmbedtls/core/
H A Dsub.mk21 srcs-$(CFG_CRYPTO_HMAC) += hmac.c
/optee_os/core/crypto/
H A Dsub.mk33 srcs-$(CFG_CRYPTO_HMAC) += sm3-hmac.c
/optee_os/lib/libmbedtls/mbedtls/include/psa/
H A Dcrypto_builtin_key_derivation.h42 struct psa_mac_operation_s MBEDTLS_PRIVATE(hmac);
H A Dcrypto_builtin_composites.h62 mbedtls_psa_hmac_operation_t MBEDTLS_PRIVATE(hmac);
/optee_os/lib/libmbedtls/mbedtls/include/mbedtls/
H A Dmd.h197 int mbedtls_md_setup(mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_info, int hmac);
/optee_os/core/lib/libtomcrypt/
H A Dsub.mk138 srcs-$(_CFG_CORE_LTC_HMAC) += hmac.c
139 srcs-$(_CFG_CORE_LTC_HMAC) += src/mac/hmac/hmac_done.c
140 srcs-$(_CFG_CORE_LTC_HMAC) += src/mac/hmac/hmac_init.c
141 srcs-$(_CFG_CORE_LTC_HMAC) += src/mac/hmac/hmac_memory.c
142 srcs-$(_CFG_CORE_LTC_HMAC) += src/mac/hmac/hmac_memory_multi.c
143 srcs-$(_CFG_CORE_LTC_HMAC) += src/mac/hmac/hmac_process.c
/optee_os/core/lib/libtomcrypt/src/headers/
H A Dtomcrypt_mac.h11 int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned long keylen);
12 int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen);
13 int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen);
/optee_os/core/tee/
H A Dtee_rpmb_fs.c1002 uint8_t hmac[RPMB_KEY_MAC_SIZE]; in tee_rpmb_init_read_wr_cnt() local
1039 rawdata.key_mac = hmac; in tee_rpmb_init_read_wr_cnt()
1311 uint8_t hmac[RPMB_KEY_MAC_SIZE]; in tee_rpmb_read() local
1368 rawdata.key_mac = hmac; in tee_rpmb_read()
1384 uint8_t hmac[RPMB_KEY_MAC_SIZE] = { }; in write_req() local
1401 rawdata.key_mac = hmac; in write_req()
1443 rawdata.key_mac = hmac; in write_req()