Skip to content

Commit

Permalink
essentially revert 1bb2547
Browse files Browse the repository at this point in the history
fixes #2199

returns not allowed PKCS#11 codes to applications, however
  • Loading branch information
frankmorgner committed Jan 22, 2021
1 parent 219c6cc commit 7a090b9
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/pkcs11/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,6 @@ static struct sc_to_cryptoki_error_conversion sc_to_cryptoki_error_map[] = {
{ "C_GenerateKeyPair", SC_ERROR_INVALID_PIN_LENGTH, CKR_GENERAL_ERROR },
{ "C_Sign", SC_ERROR_NOT_ALLOWED, CKR_FUNCTION_FAILED},
{ "C_Decrypt", SC_ERROR_NOT_ALLOWED, CKR_FUNCTION_FAILED},
{ "C_GetTokenInfo", SC_ERROR_INVALID_CARD, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_GetTokenInfo", SC_ERROR_WRONG_CARD, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_GetTokenInfo", SC_ERROR_NO_CARD_SUPPORT, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_GetMechanismList", SC_ERROR_INVALID_CARD, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_GetMechanismList", SC_ERROR_WRONG_CARD, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_GetMechanismList", SC_ERROR_NO_CARD_SUPPORT, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_GetMechanismInfo", SC_ERROR_INVALID_CARD, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_GetMechanismInfo", SC_ERROR_WRONG_CARD, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_GetMechanismInfo", SC_ERROR_NO_CARD_SUPPORT, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_InitToken", SC_ERROR_INVALID_CARD, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_InitToken", SC_ERROR_WRONG_CARD, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_InitToken", SC_ERROR_NO_CARD_SUPPORT, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_OpenSession", SC_ERROR_INVALID_CARD, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_OpenSession", SC_ERROR_WRONG_CARD, CKR_TOKEN_NOT_RECOGNIZED},
{ "C_OpenSession", SC_ERROR_NO_CARD_SUPPORT, CKR_TOKEN_NOT_RECOGNIZED},
{NULL, 0, 0}
};

Expand Down Expand Up @@ -102,8 +87,7 @@ static CK_RV sc_to_cryptoki_error_common(int rc)
case SC_ERROR_INVALID_CARD:
case SC_ERROR_WRONG_CARD:
case SC_ERROR_NO_CARD_SUPPORT:
/* CKR_TOKEN_NOT_RECOGNIZED is handled in sc_to_cryptoki_error() */
return CKR_FUNCTION_NOT_SUPPORTED;
return CKR_TOKEN_NOT_RECOGNIZED;
case SC_ERROR_WRONG_LENGTH:
return CKR_DATA_LEN_RANGE;
case SC_ERROR_INVALID_PIN_LENGTH:
Expand Down

0 comments on commit 7a090b9

Please sign in to comment.