Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:ohollmann:branches:security:tls:gcc
openssl-3
openssl-FIPS-RSA-disable-shake.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File openssl-FIPS-RSA-disable-shake.patch of Package openssl-3
From 2306fde5556cbcb875d095c09fed01a0f16fe7ec Mon Sep 17 00:00:00 2001 From: Dmitry Belyavskiy <dbelyavs@redhat.com> Date: Mon, 21 Aug 2023 15:51:55 +0200 Subject: [PATCH 40/48] 0085-FIPS-RSA-disable-shake.patch Patch-name: 0085-FIPS-RSA-disable-shake.patch Patch-id: 85 --- crypto/rsa/rsa_oaep.c | 28 ++++++++++++++++++++++++++++ crypto/rsa/rsa_pss.c | 16 ++++++++++++++++ 2 files changed, 44 insertions(+) Index: openssl-3.1.7/crypto/rsa/rsa_oaep.c =================================================================== --- openssl-3.1.7.orig/crypto/rsa/rsa_oaep.c +++ openssl-3.1.7/crypto/rsa/rsa_oaep.c @@ -78,9 +78,23 @@ int ossl_rsa_padding_add_PKCS1_OAEP_mgf1 return 0; #endif } + +#ifdef FIPS_MODULE + if (EVP_MD_is_a(md, "SHAKE-128") || EVP_MD_is_a(md, "SHAKE-256")) { + ERR_raise(ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED); + return 0; + } +#endif if (mgf1md == NULL) mgf1md = md; +#ifdef FIPS_MODULE + if (EVP_MD_is_a(mgf1md, "SHAKE-128") || EVP_MD_is_a(mgf1md, "SHAKE-256")) { + ERR_raise(ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED); + return 0; + } +#endif + mdlen = EVP_MD_get_size(md); if (mdlen <= 0) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_LENGTH); @@ -203,9 +217,23 @@ int RSA_padding_check_PKCS1_OAEP_mgf1(un #endif } +#ifdef FIPS_MODULE + if (EVP_MD_is_a(md, "SHAKE-128") || EVP_MD_is_a(md, "SHAKE-256")) { + ERR_raise(ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED); + return -1; + } +#endif + if (mgf1md == NULL) mgf1md = md; +#ifdef FIPS_MODULE + if (EVP_MD_is_a(mgf1md, "SHAKE-128") || EVP_MD_is_a(mgf1md, "SHAKE-256")) { + ERR_raise(ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED); + return -1; + } +#endif + mdlen = EVP_MD_get_size(md); if (tlen <= 0 || flen <= 0 || mdlen <= 0) Index: openssl-3.1.7/crypto/rsa/rsa_pss.c =================================================================== --- openssl-3.1.7.orig/crypto/rsa/rsa_pss.c +++ openssl-3.1.7/crypto/rsa/rsa_pss.c @@ -53,6 +53,14 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, if (mgf1Hash == NULL) mgf1Hash = Hash; +#ifdef FIPS_MODULE + if (EVP_MD_is_a(Hash, "SHAKE-128") || EVP_MD_is_a(Hash, "SHAKE-256")) + goto err; + + if (EVP_MD_is_a(mgf1Hash, "SHAKE-128") || EVP_MD_is_a(mgf1Hash, "SHAKE-256")) + goto err; +#endif + hLen = EVP_MD_get_size(Hash); if (hLen < 0) goto err; @@ -168,6 +176,14 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA * if (mgf1Hash == NULL) mgf1Hash = Hash; +#ifdef FIPS_MODULE + if (EVP_MD_is_a(Hash, "SHAKE-128") || EVP_MD_is_a(Hash, "SHAKE-256")) + goto err; + + if (EVP_MD_is_a(mgf1Hash, "SHAKE-128") || EVP_MD_is_a(mgf1Hash, "SHAKE-256")) + goto err; +#endif + hLen = EVP_MD_get_size(Hash); if (hLen < 0) goto err;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor