Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix corePKCS11 pal implementation (CA-204) #107

Open
wants to merge 1 commit into
base: release/beta
Choose a base branch
from
Open
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
9 changes: 4 additions & 5 deletions port/pkcs11/core_pkcs11_pal.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ CK_OBJECT_HANDLE PKCS11_PAL_FindObject( CK_BYTE_PTR pxLabel,
{
CK_OBJECT_HANDLE xHandle = eInvalidHandle;
char * pcFileName = NULL;
CK_BYTE_PTR pxZeroedData = NULL;
CK_BYTE_PTR pxObject = NULL;
CK_BBOOL xIsPrivate = ( CK_BBOOL ) CK_TRUE;
CK_ULONG ulObjectLength = sizeof( CK_BYTE );
Expand All @@ -252,7 +251,7 @@ CK_OBJECT_HANDLE PKCS11_PAL_FindObject( CK_BYTE_PTR pxLabel,
}

size_t required_size = 0;
err = nvs_get_str(handle, pcFileName, NULL, &required_size);
err = nvs_get_blob(handle, pcFileName, NULL, &required_size);
if (err != ESP_OK || required_size == 0) {
ESP_LOGE(TAG, "failed nvs get file size %d %d", err, required_size);
xHandle = eInvalidHandle;
Expand Down Expand Up @@ -353,7 +352,7 @@ CK_RV PKCS11_PAL_GetObjectValue( CK_OBJECT_HANDLE xHandle,
}

size_t required_size = 0;
err = nvs_get_str(handle, pcFileName, NULL, &required_size);
err = nvs_get_blob(handle, pcFileName, NULL, &required_size);
if (err != ESP_OK || required_size == 0) {
ESP_LOGE(TAG, "failed nvs get file size %d %d", err, required_size);
ulReturn = CKR_OBJECT_HANDLE_INVALID;
Expand All @@ -368,7 +367,7 @@ CK_RV PKCS11_PAL_GetObjectValue( CK_OBJECT_HANDLE xHandle,
}
*ppucData = data;

err = nvs_get_str(handle, pcFileName, (char*) data, &required_size);
err = nvs_get_blob(handle, pcFileName, data, &required_size);
if (err != ESP_OK) {
ESP_LOGE(TAG, "failed nvs get file %d", err);
vPortFree(data);
Expand Down Expand Up @@ -490,4 +489,4 @@ CK_RV PKCS11_PAL_DestroyObject( CK_OBJECT_HANDLE xHandle )
}

return xResult;
}
}