Skip to content

Commit

Permalink
Merge pull request #7963 from anhu/p11nopin
Browse files Browse the repository at this point in the history
Check for PIN before saving it.
  • Loading branch information
SparkiDev authored Sep 12, 2024
2 parents 1c8f1e6 + 246228e commit d23bfd2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wolfcrypt/src/wc_pkcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ int wc_Pkcs11Token_Init(Pkcs11Token* token, Pkcs11Dev* dev, int slotId,
tokenNameSz = XSTRLEN(tokenName);
}
ret = Pkcs11Token_Init(token, dev, slotId, tokenName, tokenNameSz);
if (ret == 0) {
if (ret == 0 && userPin != NULL) {
token->userPin = (CK_UTF8CHAR_PTR)userPin;
token->userPinSz = (CK_ULONG)userPinSz;
token->userPinLogin = 1;
Expand Down Expand Up @@ -708,7 +708,7 @@ int wc_Pkcs11Token_InitName(Pkcs11Token* token, Pkcs11Dev* dev,
const unsigned char* userPin, int userPinSz)
{
int ret = Pkcs11Token_Init(token, dev, -1, tokenName, (size_t)tokenNameSz);
if (ret == 0) {
if (ret == 0 && userPin != NULL) {
token->userPin = (CK_UTF8CHAR_PTR)userPin;
token->userPinSz = (CK_ULONG)userPinSz;
token->userPinLogin = 1;
Expand Down

0 comments on commit d23bfd2

Please sign in to comment.