Skip to content

Commit

Permalink
catch the case when mutex is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
ducnguyen-sb committed Jan 9, 2024
1 parent 3fc56ef commit efccbe5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/sig_stfl/sig_stfl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,11 @@ OQS_API OQS_STATUS OQS_SIG_STFL_SECRET_KEY_lock(OQS_SIG_STFL_SECRET_KEY *sk) {
return OQS_SUCCESS;
}

// Try to unlock the private key but the mutex is unset.
if (sk->mutex == NULL) {
return OQS_ERROR;
}

return (sk->lock_key(sk->mutex));
}

Expand All @@ -1389,5 +1394,11 @@ OQS_API OQS_STATUS OQS_SIG_STFL_SECRET_KEY_unlock(OQS_SIG_STFL_SECRET_KEY *sk) {
if (sk->unlock_key == NULL) {
return OQS_SUCCESS;
}

// Try to unlock the private key but the mutex is unset.
if (sk->mutex == NULL) {
return OQS_ERROR;
}

return (sk->unlock_key(sk->mutex));
}

0 comments on commit efccbe5

Please sign in to comment.