forked from wolfSSL/wolfssl
Ed make public key wasn't checking whether private key set
Ed25519 and Ed448 make public key APIs now check whether the private key was set. The private key and public key flags setting and clearing also updated. Testing of unset private key and calling make public key added for Ed25519 and Ed448.
This commit is contained in:
20
tests/api.c
20
tests/api.c
@@ -21426,11 +21426,21 @@ static int test_wc_ed25519_make_key(void)
|
||||
#if defined(HAVE_ED25519)
|
||||
ed25519_key key;
|
||||
WC_RNG rng;
|
||||
unsigned char pubkey[ED25519_PUB_KEY_SIZE];
|
||||
|
||||
ret = wc_InitRng(&rng);
|
||||
if (ret == 0) {
|
||||
ret = wc_ed25519_init(&key);
|
||||
}
|
||||
if (ret == 0) {
|
||||
ret = wc_ed25519_make_public(&key, pubkey, sizeof(pubkey));
|
||||
if (ret == ECC_PRIV_KEY_E) {
|
||||
ret = 0;
|
||||
}
|
||||
else if (ret == 0) {
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
printf(testingFmt, "wc_ed25519_make_key()");
|
||||
if (ret == 0) {
|
||||
ret = wc_ed25519_make_key(&rng, ED25519_KEY_SIZE, &key);
|
||||
@@ -23249,11 +23259,21 @@ static int test_wc_ed448_make_key(void)
|
||||
#if defined(HAVE_ED448)
|
||||
ed448_key key;
|
||||
WC_RNG rng;
|
||||
unsigned char pubkey[ED448_PUB_KEY_SIZE];
|
||||
|
||||
ret = wc_InitRng(&rng);
|
||||
if (ret == 0) {
|
||||
ret = wc_ed448_init(&key);
|
||||
}
|
||||
if (ret == 0) {
|
||||
ret = wc_ed448_make_public(&key, pubkey, sizeof(pubkey));
|
||||
if (ret == ECC_PRIV_KEY_E) {
|
||||
ret = 0;
|
||||
}
|
||||
else if (ret == 0) {
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
printf(testingFmt, "wc_ed448_make_key()");
|
||||
if (ret == 0) {
|
||||
ret = wc_ed448_make_key(&rng, ED448_KEY_SIZE, &key);
|
||||
|
Reference in New Issue
Block a user