get ECC curve OID before calling wc_CreatePKCS8Key for size
parent
ccd5d805d6
commit
6822bb5cb8
|
@ -1032,6 +1032,14 @@ JNIEXPORT jbyteArray JNICALL Java_com_wolfssl_wolfcrypt_Ecc_wc_1ecc_1private_1ke
|
|||
}
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
ret = wc_ecc_get_oid(ecc->dp->oidSum, &curveOID, &oidSz);
|
||||
if (ret > 0) {
|
||||
/* reset ret, returns oid as well as setting curveOID */
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
/* get pkcs8 output size, into pkcs8Sz */
|
||||
ret = wc_CreatePKCS8Key(NULL, &pkcs8Sz, derKey, derKeySz, algoID,
|
||||
|
@ -1049,14 +1057,6 @@ JNIEXPORT jbyteArray JNICALL Java_com_wolfssl_wolfcrypt_Ecc_wc_1ecc_1private_1ke
|
|||
}
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
ret = wc_ecc_get_oid(ecc->dp->oidSum, &curveOID, &oidSz);
|
||||
if (ret > 0) {
|
||||
/* reset ret, returns oid as well as setting curveOID */
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
ret = wc_CreatePKCS8Key(pkcs8, &pkcs8Sz, derKey, derKeySz,
|
||||
algoID, curveOID, oidSz);
|
||||
|
|
Loading…
Reference in New Issue