Merge pull request #7963 from anhu/p11nopin

Check for PIN before saving it.
pull/7968/head
Sean Parkinson 2024-09-12 10:20:47 +10:00 committed by GitHub
commit d23bfd2eb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -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;
@ -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;