ECDH: add missing f_rng parameter validation to mbedtls_ecdh_calc_secret #294

Closed
AndrzejKurek wants to merge 1 commit from iotssl-2853-f-rng-validation into development
AndrzejKurek commented 2019-10-10 05:51:44 -05:00 (Migrated from github.com)

Internal reference: IOTSSL-2853
Since NULL p_rng is a valid and used case, only f_rng validation to one place was added.

Internal reference: IOTSSL-2853 Since `NULL` `p_rng` is a valid and used case, only `f_rng` validation to one place was added.
Patater (Migrated from github.com) approved these changes 2019-10-11 03:38:40 -05:00
k-stachowiak (Migrated from github.com) approved these changes 2019-10-11 03:39:56 -05:00
Patater commented 2019-10-11 05:59:28 -05:00 (Migrated from github.com)

CI failures look related to this PR

34/81 Test #34: ecdh-suite .............................***Failed    0.49 sec

         ECDH - Valid parameters ........................................... PASS

         ECDH - Invalid parameters ......................................... ----

            Test Suite not enabled

         ECDH primitive random #1 .......................................... PASS

         ECDH primitive random #2 .......................................... PASS

         ECDH primitive random #3 .......................................... PASS

         ECDH primitive random #4 .......................................... PASS

         ECDH primitive random #5 .......................................... PASS

         ECDH primitive rfc 5903 p256 ...................................... PASS

         ECDH primitive rfc 5903 p384 ...................................... PASS

         ECDH primitive rfc 5903 p521 ...................................... PASS

         ECDH exchange #1 .................................................. Assertion failed: f_rng != ((void *)0), file C:\builds\ws\-294-merge-YQZ7KDW42PN7C2D5BQIMX\worktrees\tmpf8y1j624\library\ecdh.c, line 708
CI failures look related to this PR ``` 34/81 Test #34: ecdh-suite .............................***Failed 0.49 sec ECDH - Valid parameters ........................................... PASS ECDH - Invalid parameters ......................................... ---- Test Suite not enabled ECDH primitive random #1 .......................................... PASS ECDH primitive random #2 .......................................... PASS ECDH primitive random #3 .......................................... PASS ECDH primitive random #4 .......................................... PASS ECDH primitive random #5 .......................................... PASS ECDH primitive rfc 5903 p256 ...................................... PASS ECDH primitive rfc 5903 p384 ...................................... PASS ECDH primitive rfc 5903 p521 ...................................... PASS ECDH exchange #1 .................................................. Assertion failed: f_rng != ((void *)0), file C:\builds\ws\-294-merge-YQZ7KDW42PN7C2D5BQIMX\worktrees\tmpf8y1j624\library\ecdh.c, line 708 ```
gilles-peskine-arm (Migrated from github.com) requested changes 2019-10-11 10:26:29 -05:00
gilles-peskine-arm (Migrated from github.com) left a comment

I don't think anything is missing here.

I don't think anything is missing here.
@ -705,6 +705,7 @@ int mbedtls_ecdh_calc_secret( mbedtls_ecdh_context *ctx, size_t *olen,
ECDH_VALIDATE_RET( ctx != NULL );
ECDH_VALIDATE_RET( olen != NULL );
ECDH_VALIDATE_RET( buf != NULL );
ECDH_VALIDATE_RET( f_rng != NULL );
gilles-peskine-arm (Migrated from github.com) commented 2019-10-11 10:26:11 -05:00

The documentation of this function says:

 * \param f_rng     The RNG function, for blinding purposes. This may
 *                  b \c NULL if blinding isn't needed.
The documentation of this function says: ``` * \param f_rng The RNG function, for blinding purposes. This may * b \c NULL if blinding isn't needed. ```
AndrzejKurek commented 2019-10-14 02:18:10 -05:00 (Migrated from github.com)

Closing, since this change is not needed.

Closing, since this change is not needed.

Pull request closed

Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-ARMmbed/mbed-crypto!294
No description provided.