Lines Matching +full:key +full:- +full:int

5  * SPDX-License-Identifier: Apache-2.0
36 int bt_mesh_encrypt(const struct bt_mesh_key *key, const uint8_t plaintext[16], in bt_mesh_encrypt() argument
39 return bt_encrypt_be(key->key, plaintext, enc_data); in bt_mesh_encrypt()
42 int bt_mesh_ccm_encrypt(const struct bt_mesh_key *key, uint8_t nonce[13], const uint8_t *plaintext, in bt_mesh_ccm_encrypt() argument
46 return bt_ccm_encrypt(key->key, nonce, plaintext, len, aad, aad_len, enc_data, mic_size); in bt_mesh_ccm_encrypt()
49 int bt_mesh_ccm_decrypt(const struct bt_mesh_key *key, uint8_t nonce[13], const uint8_t *enc_data, in bt_mesh_ccm_decrypt() argument
53 return bt_ccm_decrypt(key->key, nonce, enc_data, len, aad, aad_len, plaintext, mic_size); in bt_mesh_ccm_decrypt()
56 int bt_mesh_aes_cmac_raw_key(const uint8_t key[16], struct bt_mesh_sg *sg, size_t sg_len, in bt_mesh_aes_cmac_raw_key()
62 if (tc_cmac_setup(&state, key, &sched) == TC_CRYPTO_FAIL) { in bt_mesh_aes_cmac_raw_key()
63 return -EIO; in bt_mesh_aes_cmac_raw_key()
66 for (; sg_len; sg_len--, sg++) { in bt_mesh_aes_cmac_raw_key()
67 if (tc_cmac_update(&state, sg->data, sg->len) == TC_CRYPTO_FAIL) { in bt_mesh_aes_cmac_raw_key()
68 return -EIO; in bt_mesh_aes_cmac_raw_key()
73 return -EIO; in bt_mesh_aes_cmac_raw_key()
79 int bt_mesh_aes_cmac_mesh_key(const struct bt_mesh_key *key, struct bt_mesh_sg *sg, in bt_mesh_aes_cmac_mesh_key() argument
82 return bt_mesh_aes_cmac_raw_key(key->key, sg, sg_len, mac); in bt_mesh_aes_cmac_mesh_key()
85 int bt_mesh_sha256_hmac_raw_key(const uint8_t key[32], struct bt_mesh_sg *sg, size_t sg_len, in bt_mesh_sha256_hmac_raw_key()
90 if (tc_hmac_set_key(&h, key, 32) == TC_CRYPTO_FAIL) { in bt_mesh_sha256_hmac_raw_key()
91 return -EIO; in bt_mesh_sha256_hmac_raw_key()
95 return -EIO; in bt_mesh_sha256_hmac_raw_key()
98 for (; sg_len; sg_len--, sg++) { in bt_mesh_sha256_hmac_raw_key()
99 if (tc_hmac_update(&h, sg->data, sg->len) == TC_CRYPTO_FAIL) { in bt_mesh_sha256_hmac_raw_key()
100 return -EIO; in bt_mesh_sha256_hmac_raw_key()
105 return -EIO; in bt_mesh_sha256_hmac_raw_key()
111 int bt_mesh_pub_key_gen(void) in bt_mesh_pub_key_gen()
113 int rc = uECC_make_key(dh_pair.public_key_be, in bt_mesh_pub_key_gen()
120 return -EIO; in bt_mesh_pub_key_gen()
133 int bt_mesh_dhkey_gen(const uint8_t *pub_key, const uint8_t *priv_key, uint8_t *dhkey) in bt_mesh_dhkey_gen()
136 LOG_ERR("Public key is not valid"); in bt_mesh_dhkey_gen()
137 return -EIO; in bt_mesh_dhkey_gen()
142 return -EIO; in bt_mesh_dhkey_gen()
148 __weak int default_CSPRNG(uint8_t *dst, unsigned int len) in default_CSPRNG()
153 int bt_mesh_crypto_init(void) in bt_mesh_crypto_init()