padding: Do not set wrong flags if the raw capability is not available

Thanks Doug Engert for pointing the issue out
This commit is contained in:
Jakub Jelen 2018-12-12 11:56:31 +01:00 committed by Frank Morgner
parent 070190d72e
commit 26aed9441a
1 changed files with 4 additions and 4 deletions

View File

@ -492,10 +492,10 @@ int sc_get_encoding_flags(sc_context_t *ctx,
(iflags & SC_ALGORITHM_RSA_PAD_PSS)) {
*sflags |= SC_ALGORITHM_RSA_PAD_PSS;
} else if (((caps & SC_ALGORITHM_RSA_RAW) &&
(iflags & SC_ALGORITHM_RSA_PAD_PKCS1))
|| iflags & SC_ALGORITHM_RSA_PAD_PSS
|| iflags & SC_ALGORITHM_RSA_PAD_NONE) {
} else if ((caps & SC_ALGORITHM_RSA_RAW) &&
(iflags & SC_ALGORITHM_RSA_PAD_PKCS1
|| iflags & SC_ALGORITHM_RSA_PAD_PSS
|| iflags & SC_ALGORITHM_RSA_PAD_NONE)) {
/* Use the card's raw RSA capability on the padded input */
*sflags = SC_ALGORITHM_RSA_PAD_NONE;
*pflags = iflags;