Fixed wrong free.

This commit is contained in:
Alessio Di Mauro
2015-08-12 17:05:47 +02:00
parent 9c082be082
commit de083bb27a
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -305,7 +305,7 @@ CK_RV do_get_public_key(EVP_PKEY *key, CK_BYTE_PTR data, CK_ULONG_PTR len) {
ecg = EC_KEY_get0_group(eck); ecg = EC_KEY_get0_group(eck);
ecp = EC_KEY_get0_public_key(eck); ecp = EC_KEY_get0_public_key(eck);
// Adde the DER structure with length after extracting the point // Add the DER structure with length after extracting the point
data[0] = 0x04; data[0] = 0x04;
if ((*len = EC_POINT_point2oct(ecg, ecp, pcf, data + 2, *len - 2, NULL)) == 0) if ((*len = EC_POINT_point2oct(ecg, ecp, pcf, data + 2, *len - 2, NULL)) == 0)
@@ -315,14 +315,15 @@ CK_RV do_get_public_key(EVP_PKEY *key, CK_BYTE_PTR data, CK_ULONG_PTR len) {
*len += 2; *len += 2;
// TODO: free ecg and ecp?
break; break;
default: default:
return CKR_FUNCTION_FAILED; return CKR_FUNCTION_FAILED;
} }
EC_KEY_free(eck); EVP_PKEY_free(key);
eck = NULL; key = NULL;
return CKR_OK; return CKR_OK;
+1 -1
View File
@@ -1274,7 +1274,7 @@ CK_DEFINE_FUNCTION(CK_RV, C_SignInit)(
return CKR_KEY_HANDLE_INVALID; return CKR_KEY_HANDLE_INVALID;
} }
DBG(("Key algorithm is %lu\n", type)); DBG(("Key type is %lu\n", type));
// Get key length and algorithm type // Get key length and algorithm type
if (type == CKK_RSA) { if (type == CKK_RSA) {