Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement implicit rejection for RSA PKCS#1 v1.5 de-padding #737

Merged
merged 3 commits into from Jan 23, 2024

Conversation

ifranzki
Copy link
Contributor

No description provided.

@ifranzki ifranzki linked an issue Jan 19, 2024 that may be closed by this pull request
@ifranzki
Copy link
Contributor Author

Fixed segfaults in travis runs.
It seems that OpenSSL 1.1.1 does not support re-init of EVP_DigestSignInit with HMAC.

Return code handling of C_Decrypt, C_DecryptUpdate, and C_DecryptFinal must
be performed in a constant time manner for RSA mechanisms. Otherwise it
may cause a timing side channel that may be used to perform a Bleichenbacher
style attack.

Handling of error situations with CKR_BUFFER_TOO_SMALL or size-query calls,
where the output buffer is NULL and the required size of the output buffer
is to be returned, do not need to be performed in constant time, since
these cases are shortcut anyway, and the result is only dependent on the
modulus size of the RSA key (which is public information anyway).

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
usr/lib/common/mech_rsa.c Outdated Show resolved Hide resolved
COPYRIGHTS Outdated Show resolved Hide resolved
COPYRIGHTS Outdated Show resolved Hide resolved
Copy link
Contributor

@jschmidb jschmidb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good besides of the two last typos ...

…ding

Implicit rejection returns a pseudo random message in case the RSA PKCS#1 v1.5
padding is incorrect, but returns no error. The pseudo random message is based
on static secret data (the private exponent) and the provided ciphertext, so
that the attacker cannot determine that the returned value is randomly generated
instead of the result of decryption and de-padding.

The implicit rejection algorithm is the same as used by OpenSSL.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
@ifranzki ifranzki merged commit b833f2f into opencryptoki:master Jan 23, 2024
1 check passed
@ifranzki ifranzki deleted the consttime-fixes branch January 23, 2024 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

opencryptoki vulnerable to the Marvin Attack
2 participants