Skip to content

Commit

Permalink
padding: Exclude PKCS#1 v1.5 type 02 flag to correctly detect type 01
Browse files Browse the repository at this point in the history
  • Loading branch information
xhanulik committed Mar 18, 2024
1 parent d2cbd63 commit 722cd6b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libopensc/padding.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,8 @@ int sc_pkcs1_encode(sc_context_t *ctx, unsigned long flags,
pad_algo = flags & SC_ALGORITHM_RSA_PADS;
if (pad_algo == 0)
pad_algo = SC_ALGORITHM_RSA_PAD_NONE;
/* exclude PKCS#1 v1.5 type 02 padding to correctly detect type 01 */
pad_algo &= ~SC_ALGORITHM_RSA_PAD_PKCS1_TYPE_02;
sc_log(ctx, "hash algorithm 0x%X, pad algorithm 0x%X", hash_algo, pad_algo);

if ((pad_algo == SC_ALGORITHM_RSA_PAD_PKCS1_TYPE_01 || pad_algo == SC_ALGORITHM_RSA_PAD_NONE) &&
Expand Down

0 comments on commit 722cd6b

Please sign in to comment.