From f2a75169f1b6dee43b9e651fd21f0611168a55dc Mon Sep 17 00:00:00 2001 From: h2zero Date: Sun, 27 Jul 2025 10:54:10 -0600 Subject: [PATCH] Rename conflicting functions --- src/nimble/nimble/host/mesh/src/mesh.c | 2 +- src/nimble/nimble/host/src/ble_att_clt.c | 4 +- src/nimble/nimble/host/src/ble_att_svr.c | 2 +- src/nimble/nimble/host/src/ble_gatts.c | 2 +- src/nimble/nimble/host/src/ble_hs_resolv.c | 6 +-- src/nimble/nimble/host/src/ble_sm_alg.c | 54 +++++++++++----------- src/nimble/nimble/host/src/ble_sm_lgcy.c | 6 +-- src/nimble/nimble/host/src/ble_sm_priv.h | 22 ++++----- src/nimble/nimble/host/src/ble_sm_sc.c | 18 ++++---- 9 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/nimble/nimble/host/mesh/src/mesh.c b/src/nimble/nimble/host/mesh/src/mesh.c index 8208fe4c..1f6fb16d 100644 --- a/src/nimble/nimble/host/mesh/src/mesh.c +++ b/src/nimble/nimble/host/mesh/src/mesh.c @@ -309,7 +309,7 @@ int bt_mesh_init(uint8_t own_addr_type, const struct bt_mesh_prov *prov, g_mesh_addr_type = own_addr_type; /* initialize SM alg ECC subsystem (it is used directly from mesh code) */ - ble_sm_alg_ecc_init(); + na_ble_sm_alg_ecc_init(); err = bt_mesh_comp_register(comp); if (err) { diff --git a/src/nimble/nimble/host/src/ble_att_clt.c b/src/nimble/nimble/host/src/ble_att_clt.c index b1baa627..72769cdc 100644 --- a/src/nimble/nimble/host/src/ble_att_clt.c +++ b/src/nimble/nimble/host/src/ble_att_clt.c @@ -829,7 +829,7 @@ ble_att_clt_tx_signed_write_cmd(uint16_t conn_handle, uint16_t cid, uint16_t han /** Copying sign counter */ memcpy(&message[BLE_ATT_SIGNED_WRITE_DATA_OFFSET + OS_MBUF_PKTLEN(txom)], &counter, sizeof(counter)); - /* ble_sm_alg_aes_cmac takes data in little-endian format, + /* na_ble_sm_alg_aes_cmac takes data in little-endian format, * so converting it to LE. */ swap_in_place(message, len); @@ -838,7 +838,7 @@ ble_att_clt_tx_signed_write_cmd(uint16_t conn_handle, uint16_t cid, uint16_t han * for the message using our CSRK for this connection. */ memset(cmac, 0, sizeof cmac); - rc = ble_sm_alg_aes_cmac(csrk, message, len, cmac); + rc = na_ble_sm_alg_aes_cmac(csrk, message, len, cmac); if (rc != 0) { goto err; } diff --git a/src/nimble/nimble/host/src/ble_att_svr.c b/src/nimble/nimble/host/src/ble_att_svr.c index 3d2ece37..4e7b212b 100644 --- a/src/nimble/nimble/host/src/ble_att_svr.c +++ b/src/nimble/nimble/host/src/ble_att_svr.c @@ -2467,7 +2467,7 @@ ble_att_svr_rx_signed_write(uint16_t conn_handle, uint16_t cid, struct os_mbuf * /* Using AES-CMAC to get the CMAC from the message and CSRK of this device */ memset(cmac, 0, sizeof cmac); - rc = ble_sm_alg_aes_cmac(csrk, message, len, cmac); + rc = na_ble_sm_alg_aes_cmac(csrk, message, len, cmac); if (rc != 0) { goto err; } diff --git a/src/nimble/nimble/host/src/ble_gatts.c b/src/nimble/nimble/host/src/ble_gatts.c index e0441ad0..31f9b00c 100644 --- a/src/nimble/nimble/host/src/ble_gatts.c +++ b/src/nimble/nimble/host/src/ble_gatts.c @@ -619,7 +619,7 @@ ble_gatts_calculate_hash(uint8_t *out_hash_key) goto done; } - rc = ble_sm_alg_aes_cmac(key, buf, size, out_hash_key); + rc = na_ble_sm_alg_aes_cmac(key, buf, size, out_hash_key); if(rc != 0) { goto done; } diff --git a/src/nimble/nimble/host/src/ble_hs_resolv.c b/src/nimble/nimble/host/src/ble_hs_resolv.c index 3dfa93dd..7dd09d89 100644 --- a/src/nimble/nimble/host/src/ble_hs_resolv.c +++ b/src/nimble/nimble/host/src/ble_hs_resolv.c @@ -410,7 +410,7 @@ ble_hs_resolv_gen_priv_addr(struct ble_hs_resolv_entry *rl, int local) swap_in_place(ecb.plain_text, 16); /* Calculate hash */ - if (ble_sm_alg_encrypt(ecb.key, ecb.plain_text, ecb.cipher_text) != 0) { + if (na_ble_sm_alg_encrypt(ecb.key, ecb.plain_text, ecb.cipher_text) != 0) { /* We can't do much here if the encryption fails */ return; } @@ -768,8 +768,8 @@ ble_hs_resolv_rpa(uint8_t *rpa, uint8_t *irk) swap_in_place(ecb.plain_text, 16); - /* Send the data to ble_sm_alg_encrypt in little-endian style */ - rc = ble_sm_alg_encrypt(ecb.key, ecb.plain_text, ecb.cipher_text); + /* Send the data to na_ble_sm_alg_encrypt in little-endian style */ + rc = na_ble_sm_alg_encrypt(ecb.key, ecb.plain_text, ecb.cipher_text); if (rc != 0) { return rc; } diff --git a/src/nimble/nimble/host/src/ble_sm_alg.c b/src/nimble/nimble/host/src/ble_sm_alg.c index 95748810..ef4d58a2 100644 --- a/src/nimble/nimble/host/src/ble_sm_alg.c +++ b/src/nimble/nimble/host/src/ble_sm_alg.c @@ -91,7 +91,7 @@ ble_sm_alg_xor_128(const uint8_t *p, const uint8_t *q, uint8_t *r) } int -ble_sm_alg_encrypt(const uint8_t *key, const uint8_t *plaintext, +na_ble_sm_alg_encrypt(const uint8_t *key, const uint8_t *plaintext, uint8_t *enc_data) { uint8_t tmp[16]; @@ -135,7 +135,7 @@ ble_sm_alg_encrypt(const uint8_t *key, const uint8_t *plaintext, } int -ble_sm_alg_s1(const uint8_t *k, const uint8_t *r1, const uint8_t *r2, +na_ble_sm_alg_s1(const uint8_t *k, const uint8_t *r1, const uint8_t *r2, uint8_t *out) { int rc; @@ -152,12 +152,12 @@ ble_sm_alg_s1(const uint8_t *k, const uint8_t *r1, const uint8_t *r2, memcpy(out + 8, r1, 8); /* s1(k, r1 , r2) = e(k, r') */ - rc = ble_sm_alg_encrypt(k, out, out); + rc = na_ble_sm_alg_encrypt(k, out, out); if (rc != 0) { return rc; } - BLE_HS_LOG(DEBUG, "ble_sm_alg_s1()\n k="); + BLE_HS_LOG(DEBUG, "na_ble_sm_alg_s1()\n k="); ble_hs_log_flat_buf(k, 16); BLE_HS_LOG(DEBUG, "\n r1="); ble_hs_log_flat_buf(r1, 16); @@ -171,7 +171,7 @@ ble_sm_alg_s1(const uint8_t *k, const uint8_t *r1, const uint8_t *r2, } int -ble_sm_alg_c1(const uint8_t *k, const uint8_t *r, +na_ble_sm_alg_c1(const uint8_t *k, const uint8_t *r, const uint8_t *preq, const uint8_t *pres, uint8_t iat, uint8_t rat, const uint8_t *ia, const uint8_t *ra, @@ -180,7 +180,7 @@ ble_sm_alg_c1(const uint8_t *k, const uint8_t *r, uint8_t p1[16], p2[16]; int rc; - BLE_HS_LOG(DEBUG, "ble_sm_alg_c1()\n k="); + BLE_HS_LOG(DEBUG, "na_ble_sm_alg_c1()\n k="); ble_hs_log_flat_buf(k, 16); BLE_HS_LOG(DEBUG, "\n r="); ble_hs_log_flat_buf(r, 16); @@ -208,7 +208,7 @@ ble_sm_alg_c1(const uint8_t *k, const uint8_t *r, /* Using out_enc_data as temporary output buffer */ ble_sm_alg_xor_128(r, p1, out_enc_data); - rc = ble_sm_alg_encrypt(k, out_enc_data, out_enc_data); + rc = na_ble_sm_alg_encrypt(k, out_enc_data, out_enc_data); if (rc != 0) { rc = BLE_HS_EUNKNOWN; goto done; @@ -224,7 +224,7 @@ ble_sm_alg_c1(const uint8_t *k, const uint8_t *r, ble_sm_alg_xor_128(out_enc_data, p2, out_enc_data); - rc = ble_sm_alg_encrypt(k, out_enc_data, out_enc_data); + rc = na_ble_sm_alg_encrypt(k, out_enc_data, out_enc_data); if (rc != 0) { rc = BLE_HS_EUNKNOWN; goto done; @@ -251,7 +251,7 @@ ble_sm_alg_c1(const uint8_t *k, const uint8_t *r, #if MYNEWT_VAL(BLE_CRYPTO_STACK_MBEDTLS) int -ble_sm_alg_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, +na_ble_sm_alg_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, uint8_t *out) { int rc = BLE_HS_EUNKNOWN; @@ -289,7 +289,7 @@ ble_sm_alg_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, #else int -ble_sm_alg_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, +na_ble_sm_alg_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, uint8_t *out) { struct tc_aes_key_sched_struct sched; @@ -322,14 +322,14 @@ ble_sm_alg_log_buf(const char *name, const uint8_t *buf, int len) } int -ble_sm_alg_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x, +na_ble_sm_alg_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x, uint8_t z, uint8_t *out_enc_data) { uint8_t xs[16]; uint8_t m[65]; int rc; - BLE_HS_LOG(DEBUG, "ble_sm_alg_f4()\n u="); + BLE_HS_LOG(DEBUG, "na_ble_sm_alg_f4()\n u="); ble_hs_log_flat_buf(u, 32); BLE_HS_LOG(DEBUG, "\n v="); ble_hs_log_flat_buf(v, 32); @@ -344,7 +344,7 @@ ble_sm_alg_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x, * Core Spec 4.2 Vol 3 Part H 2.2.5 * * note: - * ble_sm_alg_aes_cmac uses BE data; ble_sm_alg_f4 accepts LE so we swap. + * na_ble_sm_alg_aes_cmac uses BE data; na_ble_sm_alg_f4 accepts LE so we swap. */ swap_buf(m, u, 32); swap_buf(m + 32, v, 32); @@ -352,7 +352,7 @@ ble_sm_alg_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x, swap_buf(xs, x, 16); - rc = ble_sm_alg_aes_cmac(xs, m, sizeof(m), out_enc_data); + rc = na_ble_sm_alg_aes_cmac(xs, m, sizeof(m), out_enc_data); if (rc != 0) { return BLE_HS_EUNKNOWN; } @@ -367,7 +367,7 @@ ble_sm_alg_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x, } int -ble_sm_alg_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, +na_ble_sm_alg_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, uint8_t a1t, const uint8_t *a1, uint8_t a2t, const uint8_t *a2, uint8_t *mackey, uint8_t *ltk) { @@ -389,14 +389,14 @@ ble_sm_alg_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, uint8_t t[16]; int rc; - BLE_HS_LOG(DEBUG, "ble_sm_alg_f5()\n"); + BLE_HS_LOG(DEBUG, "na_ble_sm_alg_f5()\n"); ble_sm_alg_log_buf("w", w, 32); ble_sm_alg_log_buf("n1", n1, 16); ble_sm_alg_log_buf("n2", n2, 16); swap_buf(ws, w, 32); - rc = ble_sm_alg_aes_cmac(salt, ws, 32, t); + rc = na_ble_sm_alg_aes_cmac(salt, ws, 32, t); if (rc != 0) { return BLE_HS_EUNKNOWN; } @@ -410,7 +410,7 @@ ble_sm_alg_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, m[44] = a2t; swap_buf(m + 45, a2, 6); - rc = ble_sm_alg_aes_cmac(t, m, sizeof(m), mackey); + rc = na_ble_sm_alg_aes_cmac(t, m, sizeof(m), mackey); if (rc != 0) { return BLE_HS_EUNKNOWN; } @@ -422,7 +422,7 @@ ble_sm_alg_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, /* Counter for ltk is 1. */ m[0] = 0x01; - rc = ble_sm_alg_aes_cmac(t, m, sizeof(m), ltk); + rc = na_ble_sm_alg_aes_cmac(t, m, sizeof(m), ltk); if (rc != 0) { return BLE_HS_EUNKNOWN; } @@ -435,7 +435,7 @@ ble_sm_alg_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, } int -ble_sm_alg_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, +na_ble_sm_alg_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, const uint8_t *r, const uint8_t *iocap, uint8_t a1t, const uint8_t *a1, uint8_t a2t, const uint8_t *a2, uint8_t *check) @@ -444,7 +444,7 @@ ble_sm_alg_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, uint8_t m[65]; int rc; - BLE_HS_LOG(DEBUG, "ble_sm_alg_f6()\n"); + BLE_HS_LOG(DEBUG, "na_ble_sm_alg_f6()\n"); ble_sm_alg_log_buf("w", w, 16); ble_sm_alg_log_buf("n1", n1, 16); ble_sm_alg_log_buf("n2", n2, 16); @@ -470,7 +470,7 @@ ble_sm_alg_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, swap_buf(ws, w, 16); - rc = ble_sm_alg_aes_cmac(ws, m, sizeof(m), check); + rc = na_ble_sm_alg_aes_cmac(ws, m, sizeof(m), check); if (rc != 0) { return BLE_HS_EUNKNOWN; } @@ -483,13 +483,13 @@ ble_sm_alg_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, } int -ble_sm_alg_g2(const uint8_t *u, const uint8_t *v, const uint8_t *x, +na_ble_sm_alg_g2(const uint8_t *u, const uint8_t *v, const uint8_t *x, const uint8_t *y, uint32_t *passkey) { uint8_t m[80], xs[16]; int rc; - BLE_HS_LOG(DEBUG, "ble_sm_alg_g2()\n"); + BLE_HS_LOG(DEBUG, "na_ble_sm_alg_g2()\n"); ble_sm_alg_log_buf("u", u, 32); ble_sm_alg_log_buf("v", v, 32); ble_sm_alg_log_buf("x", x, 16); @@ -502,7 +502,7 @@ ble_sm_alg_g2(const uint8_t *u, const uint8_t *v, const uint8_t *x, swap_buf(xs, x, 16); /* reuse xs (key) as buffer for result */ - rc = ble_sm_alg_aes_cmac(xs, m, sizeof(m), xs); + rc = na_ble_sm_alg_aes_cmac(xs, m, sizeof(m), xs); if (rc != 0) { return BLE_HS_EUNKNOWN; } @@ -688,7 +688,7 @@ mbedtls_gen_keypair(uint8_t *public_key, uint8_t *private_key) return 0; } -void mbedtls_free_keypair(void) +void na_mbedtls_free_keypair(void) { mbedtls_ecp_keypair_free(&keypair); } @@ -765,7 +765,7 @@ ble_sm_alg_rand(uint8_t *dst, unsigned int size) #endif void -ble_sm_alg_ecc_init(void) +na_ble_sm_alg_ecc_init(void) { #if (!MYNEWT_VAL(BLE_CRYPTO_STACK_MBEDTLS)) uECC_set_rng(ble_sm_alg_rand); diff --git a/src/nimble/nimble/host/src/ble_sm_lgcy.c b/src/nimble/nimble/host/src/ble_sm_lgcy.c index 1a53aa82..3c7ce9ca 100644 --- a/src/nimble/nimble/host/src/ble_sm_lgcy.c +++ b/src/nimble/nimble/host/src/ble_sm_lgcy.c @@ -127,7 +127,7 @@ ble_sm_lgcy_confirm_exec(struct ble_sm_proc *proc, struct ble_sm_result *res) ble_sm_ia_ra(proc, &iat, ia, &rat, ra); - rc = ble_sm_alg_c1(proc->tk, ble_sm_our_pair_rand(proc), proc->pair_req, + rc = na_ble_sm_alg_c1(proc->tk, ble_sm_our_pair_rand(proc), proc->pair_req, proc->pair_rsp, iat, rat, ia, ra, cmd->value); if (rc != 0) { goto err; @@ -160,7 +160,7 @@ ble_sm_gen_stk(struct ble_sm_proc *proc) uint8_t key[16]; int rc; - rc = ble_sm_alg_s1(proc->tk, proc->rands, proc->randm, key); + rc = na_ble_sm_alg_s1(proc->tk, proc->rands, proc->randm, key); if (rc != 0) { return rc; } @@ -215,7 +215,7 @@ ble_sm_lgcy_random_rx(struct ble_sm_proc *proc, struct ble_sm_result *res) ble_sm_ia_ra(proc, &iat, ia, &rat, ra); - rc = ble_sm_alg_c1(proc->tk, ble_sm_peer_pair_rand(proc), proc->pair_req, + rc = na_ble_sm_alg_c1(proc->tk, ble_sm_peer_pair_rand(proc), proc->pair_req, proc->pair_rsp, iat, rat, ia, ra, confirm_val); if (rc != 0) { res->app_status = rc; diff --git a/src/nimble/nimble/host/src/ble_sm_priv.h b/src/nimble/nimble/host/src/ble_sm_priv.h index 59fcc1e0..1b238184 100644 --- a/src/nimble/nimble/host/src/ble_sm_priv.h +++ b/src/nimble/nimble/host/src/ble_sm_priv.h @@ -301,21 +301,21 @@ void ble_sm_dbg_set_sc_keys(uint8_t *pubkey, uint8_t *privkey); int ble_sm_num_procs(void); -int ble_sm_alg_s1(const uint8_t *k, const uint8_t *r1, const uint8_t *r2, +int na_ble_sm_alg_s1(const uint8_t *k, const uint8_t *r1, const uint8_t *r2, uint8_t *out); -int ble_sm_alg_c1(const uint8_t *k, const uint8_t *r, +int na_ble_sm_alg_c1(const uint8_t *k, const uint8_t *r, const uint8_t *preq, const uint8_t *pres, uint8_t iat, uint8_t rat, const uint8_t *ia, const uint8_t *ra, uint8_t *out_enc_data); -int ble_sm_alg_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x, +int na_ble_sm_alg_f4(const uint8_t *u, const uint8_t *v, const uint8_t *x, uint8_t z, uint8_t *out_enc_data); -int ble_sm_alg_g2(const uint8_t *u, const uint8_t *v, const uint8_t *x, +int na_ble_sm_alg_g2(const uint8_t *u, const uint8_t *v, const uint8_t *x, const uint8_t *y, uint32_t *passkey); -int ble_sm_alg_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, +int na_ble_sm_alg_f5(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, uint8_t a1t, const uint8_t *a1, uint8_t a2t, const uint8_t *a2, uint8_t *mackey, uint8_t *ltk); -int ble_sm_alg_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, +int na_ble_sm_alg_f6(const uint8_t *w, const uint8_t *n1, const uint8_t *n2, const uint8_t *r, const uint8_t *iocap, uint8_t a1t, const uint8_t *a1, uint8_t a2t, const uint8_t *a2, uint8_t *check); @@ -323,7 +323,7 @@ int ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y, const uint8_t *our_priv_key, uint8_t *out_dhkey); int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv); -void ble_sm_alg_ecc_init(void); +void na_ble_sm_alg_ecc_init(void); void ble_sm_enc_change_rx(const struct ble_hci_ev_enrypt_chg *ev); void ble_sm_enc_key_refresh_rx(const struct ble_hci_ev_enc_key_refresh *ev); @@ -395,7 +395,7 @@ void ble_sm_ia_ra(struct ble_sm_proc *proc, int ble_sm_incr_our_sign_counter(uint16_t conn_handle); int ble_sm_incr_peer_sign_counter(uint16_t conn_handle); -int ble_sm_alg_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, +int na_ble_sm_alg_aes_cmac(const uint8_t *key, const uint8_t *in, size_t len, uint8_t *out); int32_t ble_sm_timer(void); void ble_sm_connection_broken(uint16_t conn_handle); @@ -404,14 +404,14 @@ int ble_sm_slave_initiate(uint16_t conn_handle); int ble_sm_enc_initiate(uint16_t conn_handle, uint8_t key_size, const uint8_t *ltk, uint16_t ediv, uint64_t rand_val, int auth); -int ble_sm_alg_encrypt(const uint8_t *key, const uint8_t *plaintext, +int na_ble_sm_alg_encrypt(const uint8_t *key, const uint8_t *plaintext, uint8_t *enc_data); int ble_sm_init(void); #else #define ble_sm_incr_our_sign_counter(conn_handle) BLE_HS_ENOTSUP #define ble_sm_incr_peer_sign_counter(conn_handle) BLE_HS_ENOTSUP -#define ble_sm_alg_aes_cmac(key, in, len, out) BLE_HS_ENOTSUP +#define na_ble_sm_alg_aes_cmac(key, in, len, out) BLE_HS_ENOTSUP #define ble_sm_enc_change_rx(evt) ((void)(evt)) #define ble_sm_ltk_req_rx(evt) ((void)(evt)) #define ble_sm_enc_key_refresh_rx(evt) ((void)(evt)) @@ -425,7 +425,7 @@ int ble_sm_init(void); #define ble_sm_init() 0 -#define ble_sm_alg_encrypt(key, plaintext, enc_data) \ +#define na_ble_sm_alg_encrypt(key, plaintext, enc_data) \ BLE_HS_ENOTSUP #endif diff --git a/src/nimble/nimble/host/src/ble_sm_sc.c b/src/nimble/nimble/host/src/ble_sm_sc.c index 9e3cedca..d2b517b3 100644 --- a/src/nimble/nimble/host/src/ble_sm_sc.c +++ b/src/nimble/nimble/host/src/ble_sm_sc.c @@ -269,7 +269,7 @@ ble_sm_sc_oob_confirm(struct ble_sm_proc *proc, struct ble_sm_result *res) /* Authentication stage 1: Step 5 */ if (proc->oob_data_remote) { - err = ble_sm_alg_f4(proc->pub_key_peer.x, proc->pub_key_peer.x, + err = na_ble_sm_alg_f4(proc->pub_key_peer.x, proc->pub_key_peer.x, proc->oob_data_remote->r, 0, c); if (err) { res->sm_err = BLE_SM_ERR_UNSPECIFIED; @@ -321,7 +321,7 @@ ble_sm_sc_confirm_exec(struct ble_sm_proc *proc, struct ble_sm_result *res) return; } - rc = ble_sm_alg_f4(ble_sm_sc_pub_key, proc->pub_key_peer.x, + rc = na_ble_sm_alg_f4(ble_sm_sc_pub_key, proc->pub_key_peer.x, ble_sm_our_pair_rand(proc), proc->ri, cmd->value); if (rc != 0) { os_mbuf_free_chain(txom); @@ -357,7 +357,7 @@ ble_sm_sc_gen_numcmp(struct ble_sm_proc *proc, struct ble_sm_result *res) pka = proc->pub_key_peer.x; pkb = ble_sm_sc_pub_key; } - res->app_status = ble_sm_alg_g2(pka, pkb, proc->randm, proc->rands, + res->app_status = na_ble_sm_alg_g2(pka, pkb, proc->randm, proc->rands, &res->passkey_params.numcmp); if (res->app_status != 0) { res->sm_err = BLE_SM_ERR_UNSPECIFIED; @@ -456,7 +456,7 @@ ble_sm_sc_random_rx(struct ble_sm_proc *proc, struct ble_sm_result *res) ble_hs_log_flat_buf(proc->tk, 16); BLE_HS_LOG(DEBUG, "\n"); - rc = ble_sm_alg_f4(proc->pub_key_peer.x, ble_sm_sc_pub_key, + rc = na_ble_sm_alg_f4(proc->pub_key_peer.x, ble_sm_sc_pub_key, ble_sm_peer_pair_rand(proc), proc->ri, confirm_val); if (rc != 0) { @@ -477,7 +477,7 @@ ble_sm_sc_random_rx(struct ble_sm_proc *proc, struct ble_sm_result *res) /* Calculate the mac key and ltk. */ ble_sm_ia_ra(proc, &iat, ia, &rat, ra); - rc = ble_sm_alg_f5(proc->dhkey, proc->randm, proc->rands, + rc = na_ble_sm_alg_f5(proc->dhkey, proc->randm, proc->rands, iat, ia, rat, ra, proc->mackey, proc->ltk); if (rc != 0) { res->app_status = rc; @@ -725,7 +725,7 @@ ble_sm_sc_dhkey_check_exec(struct ble_sm_proc *proc, struct ble_sm_result *res, goto err; } - rc = ble_sm_alg_f6(proc->mackey, ble_sm_our_pair_rand(proc), + rc = na_ble_sm_alg_f6(proc->mackey, ble_sm_our_pair_rand(proc), ble_sm_peer_pair_rand(proc), proc->tk, iocap, our_addr.type, our_addr.val, peer_addr.type, peer_addr.val, cmd->value); @@ -796,7 +796,7 @@ ble_sm_dhkey_check_process(struct ble_sm_proc *proc, ble_hs_log_flat_buf(proc->tk, 16); BLE_HS_LOG(DEBUG, "\n"); - res->app_status = ble_sm_alg_f6(proc->mackey, + res->app_status = na_ble_sm_alg_f6(proc->mackey, ble_sm_peer_pair_rand(proc), ble_sm_our_pair_rand(proc), proc->tk, iocap, @@ -908,7 +908,7 @@ ble_sm_sc_oob_generate_data(struct ble_sm_sc_oob_data *oob_data) return rc; } - rc = ble_sm_alg_f4(ble_sm_sc_pub_key, ble_sm_sc_pub_key, oob_data->r, 0, + rc = na_ble_sm_alg_f4(ble_sm_sc_pub_key, ble_sm_sc_pub_key, oob_data->r, 0, oob_data->c); if (rc) { return rc; @@ -920,7 +920,7 @@ ble_sm_sc_oob_generate_data(struct ble_sm_sc_oob_data *oob_data) void ble_sm_sc_init(void) { - ble_sm_alg_ecc_init(); + na_ble_sm_alg_ecc_init(); ble_sm_sc_keys_generated = 0; }