Fixed issue with compressed keys and custom curves. The inLen adjustment for compressed curves was only be done for built-in curves.

This commit is contained in:
David Garske
2016-06-21 15:55:17 -07:00
parent dd52af0872
commit 1db880b6bf

View File

@@ -3014,6 +3014,9 @@ int wc_ecc_import_x963_ex(const byte* in, word32 inLen, ecc_key* key,
}
if (err == MP_OKAY) {
if (compressed)
inLen = (inLen-1)*2 + 1; /* used uncompressed len */
/* determine the idx */
if (dp) {
/* set the idx */
@@ -3022,9 +3025,6 @@ int wc_ecc_import_x963_ex(const byte* in, word32 inLen, ecc_key* key,
key->type = ECC_PUBLICKEY;
}
else {
if (compressed)
inLen = (inLen-1)*2 + 1; /* used uncompressed len */
for (x = 0; ecc_sets[x].size != 0; x++) {
if ((unsigned)ecc_sets[x].size >= ((inLen-1)>>1)) {
break;