Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/wp_ecc_kmgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2377,7 +2377,9 @@ static int wp_ecc_encode_pki_size(const wp_Ecc *ecc, size_t* keyLen)
int rc;
word32 len;

PRIVATE_KEY_UNLOCK();
rc = wc_EccKeyToPKCS8((ecc_key*)&ecc->key, NULL, &len);
PRIVATE_KEY_LOCK();
if (rc != LENGTH_ONLY_E) {
ok = 0;
}
Expand Down Expand Up @@ -2407,7 +2409,9 @@ static int wp_ecc_encode_pki(const wp_Ecc *ecc, unsigned char* keyData,
word32 len = (word32)*keyLen;

/* TODO: for older versions, curve is always included! */
PRIVATE_KEY_UNLOCK();
rc = wc_EccKeyToPKCS8((ecc_key*)&ecc->key, keyData, &len);
PRIVATE_KEY_LOCK();
if (rc <= 0) {
ok = 0;
}
Expand All @@ -2434,7 +2438,9 @@ static int wp_ecc_encode_epki_size(const wp_Ecc *ecc, size_t* keyLen)
int rc;
word32 len;

PRIVATE_KEY_UNLOCK();
rc = wc_EccKeyToPKCS8((ecc_key*)&ecc->key, NULL, &len);
PRIVATE_KEY_LOCK();
if (rc != LENGTH_ONLY_E) {
ok = 0;
}
Expand Down Expand Up @@ -2469,7 +2475,9 @@ static int wp_ecc_encode_epki(const wp_EccEncDecCtx* ctx, const wp_Ecc *ecc,
word32 len = (word32)*keyLen;

/* Encode key. */
PRIVATE_KEY_UNLOCK();
rc = wc_EccKeyToPKCS8((ecc_key*)&ecc->key, keyData, &len);
PRIVATE_KEY_LOCK();
if (rc <= 0) {
ok = 0;
}
Expand Down