mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-01 10:06:53 +03:00
Add RNG params to private key parsing
This is necessary for the case where the public part of an EC keypair needs to be computed from the private part - either because it was not included (it's an optional component) or because it was compressed (a format we can't parse). This changes the API of two public functions: mbedtls_pk_parse_key() and mbedtls_pk_parse_keyfile(). Tests and programs have been adapted. Some programs use a non-secure RNG (from the test library) just to get things to compile and run; in a future commit this should be improved in order to demonstrate best practice. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include "common.h"
|
||||
#include "mbedtls/ssl.h"
|
||||
#include "test/certs.h"
|
||||
#include "test/random.h"
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
#include "mbedtls/entropy.h"
|
||||
#include "mbedtls/ctr_drbg.h"
|
||||
@ -55,7 +56,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
mbedtls_test_cas_pem_len ) != 0)
|
||||
return 1;
|
||||
if (mbedtls_pk_parse_key( &pkey, (const unsigned char *) mbedtls_test_srv_key,
|
||||
mbedtls_test_srv_key_len, NULL, 0 ) != 0)
|
||||
mbedtls_test_srv_key_len, NULL, 0,
|
||||
mbedtls_test_rnd_std_rand, NULL ) != 0)
|
||||
return 1;
|
||||
#endif
|
||||
dummy_init();
|
||||
|
Reference in New Issue
Block a user