Skip to content

Commit 63e21d4

Browse files
[nrf fromtree] bluetooth: host/crypto: fix the psa crypto init for host
psa_crypto_init was bounded to CONFIG_BT_HOST_CRYPTO_PRNG and used to be called under prng_init. Updating the ifdef condition and appropriating the function name for crypto init. Also it is better to make sure psa_crypto_init called by host. Signed-off-by: alperen sener <[email protected]> (cherry picked from commit 22de0b3)
1 parent ada2f93 commit 63e21d4

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

subsys/bluetooth/host/crypto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
* SPDX-License-Identifier: Apache-2.0
66
*/
77

8-
int prng_init(void);
8+
int bt_crypto_init(void);

subsys/bluetooth/host/crypto_psa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <zephyr/logging/log.h>
2828
LOG_MODULE_REGISTER(bt_host_crypto);
2929

30-
int prng_init(void)
30+
int bt_crypto_init(void)
3131
{
3232
psa_status_t status = psa_crypto_init();
3333

subsys/bluetooth/host/hci_core.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3287,11 +3287,9 @@ static int common_init(void)
32873287
read_supported_commands_complete(rsp);
32883288
net_buf_unref(rsp);
32893289

3290-
if (IS_ENABLED(CONFIG_BT_HOST_CRYPTO_PRNG)) {
3291-
/* Initialize the PRNG so that it is safe to use it later
3292-
* on in the initialization process.
3293-
*/
3294-
err = prng_init();
3290+
if (IS_ENABLED(CONFIG_BT_HOST_CRYPTO)) {
3291+
/* Initialize crypto for host */
3292+
err = bt_crypto_init();
32953293
if (err) {
32963294
return err;
32973295
}

0 commit comments

Comments
 (0)