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

lib/openssl/rsaes.c: Fix issue where jose_hook_alg_find failed to f… #145

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

sunil-dhayal
Copy link
Contributor

…ind the … …existance of RSA_OAEP algorithm

After upgrading to openssl 3.x, decryption of cipher started failing with error decryption algorithm not found, could not decode key.

After investigation it was found that before openssl 3.x, EVP_PKEY_CTX_set_rsa_oaep_md used to be a MACRO but with openssl 3.x, it became a function.

To fix this, modify the check for MACRO to make it work with openssl version 3.x or higher.

'''
Without this patch, algorithms listed by jose_hook_alg_find function:
PS512, PS384, PS256, RS512, RS384, RS256, HS512, HS384, HS256, S1, S224, S256, S384, S512, ES512, ES384, ES256, ECMR, ECDH, A256GCM, A192GCM, A128GCM, A256CBC-HS512, A192CBC-HS384, A128CBC-HS256, DEF

After appling this patch algorithms listed by jose_hook_alg_find function:
PS512, PS384, PS256, RS512, RS384, RS256, PS512, PS384, PS256, RS512, RS384, RS256, RSA-OAEP-512, RSA-OAEP-384, RSA-OAEP-256, RSA-OAEP-224, RSA-OAEP, RSA1_5, PBES2-HS512+A256KW, PBES2-HS384+A192KW, PBES2-HS256+A128KW, HS512, HS384, HS256, S1, S224, S256, S384, S512, ES512, ES384, ES256, ECMR, ECDH-ES+A256KW, ECDH-ES+A192KW, ECDH-ES+A128KW, ECDH-ES, ECDH, dir, A256KW, A192KW, A128KW, A256GCMKW, A192GCMKW, A128GCMKW '''

…ind the … …existance of RSA_OAEP algorithm

After upgrading to  openssl 3.x, decryption of cipher started failing
with error `decryption algorithm not found, could not decode key`.

After investigation it was found that before openssl 3.x,
EVP_PKEY_CTX_set_rsa_oaep_md used to be a MACRO but with
openssl 3.x, it became a function.

To fix this, modify the check for MACRO to make it work with
openssl version 3.x or higher.

'''
Without this patch, algorithms listed by `jose_hook_alg_find`
function:
PS512, PS384, PS256, RS512, RS384, RS256, HS512, HS384, HS256,
S1, S224, S256, S384, S512, ES512, ES384, ES256, ECMR, ECDH, A256GCM,
A192GCM, A128GCM, A256CBC-HS512, A192CBC-HS384, A128CBC-HS256, DEF

After appling this patch algorithms listed by `jose_hook_alg_find`
function:
PS512, PS384, PS256, RS512, RS384, RS256, PS512, PS384, PS256,
RS512, RS384, RS256, RSA-OAEP-512, RSA-OAEP-384, RSA-OAEP-256,
RSA-OAEP-224, RSA-OAEP, RSA1_5, PBES2-HS512+A256KW, PBES2-HS384+A192KW,
PBES2-HS256+A128KW, HS512, HS384, HS256, S1, S224, S256, S384, S512,
ES512, ES384, ES256, ECMR, ECDH-ES+A256KW, ECDH-ES+A192KW, ECDH-ES+A128KW,
ECDH-ES, ECDH, dir, A256KW, A192KW, A128KW, A256GCMKW, A192GCMKW, A128GCMKW
'''

Signed-off-by: sunil-dhayal <sunildhayal3001@gmail.com>
@sunil-dhayal
Copy link
Contributor Author

@sergio-correia please have a look at this PR

@sergio-correia sergio-correia merged commit 58112df into latchset:master Jan 17, 2024
18 checks passed
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.

2 participants