andrzej-kaczmarek commented on a change in pull request #499: nimble/mesh: 
Reject invalid remote public key
URL: https://github.com/apache/mynewt-nimble/pull/499#discussion_r297141147
 
 

 ##########
 File path: nimble/host/src/ble_sm_alg.c
 ##########
 @@ -418,6 +418,21 @@ ble_sm_alg_g2(uint8_t *u, uint8_t *v, uint8_t *x, uint8_t 
*y,
     return 0;
 }
 
+int
+ble_sm_alg_valid_pub_key(uint8_t *peer_pub_key_x, uint8_t *peer_pub_key_y)
+{
+    uint8_t pk[64];
+
+    swap_buf(pk, peer_pub_key_x, 32);
+    swap_buf(&pk[32], peer_pub_key_y, 32);
+
+    if (uECC_valid_public_key(pk, &curve_secp256r1) < 0) {
+        return BLE_HS_EUNKNOWN;
 
 Review comment:
   BLE_HS_EINVAL

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to