}
getstring((const char**)blob, len, &q, &qlen);
- if (!q)
- return NULL;
- if (qlen != 64)
+ if (!q || qlen != 64) {
+ ecdsa_freekey(ec);
return NULL;
+ }
ec->privateKey = bignum_from_bytes_le((const unsigned char *)q, 32);
bytes[0] &= 248;
bytes[31] &= 127;
bytes[31] |= 64;
- key->privateKey = bignum_from_bytes(bytes, sizeof(bytes));
+ key->privateKey = bignum_from_bytes_le(bytes, sizeof(bytes));
smemclr(bytes, sizeof(bytes));
if (!key->privateKey) {
sfree(key);