Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FelixWolf/b89e7096502b1a85f46316e2ec661217 to your computer and use it in GitHub Desktop.
Save FelixWolf/b89e7096502b1a85f46316e2ec661217 to your computer and use it in GitHub Desktop.
Fix for OpenSSL deprecation on quickbms v0.12.0
From 2add8423816e98c76419a8aeb22b599e4f5097a1 Mon Sep 17 00:00:00 2001
From: Kyler Eastridge <felix.wolfz@gmail.com>
Date: Wed, 19 Jul 2023 14:00:35 -0400
Subject: [PATCH] Fix OpenSSL V21 padding deprecation
---
perform.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/perform.c b/perform.c
index 175da81..6055bd7 100644
--- a/perform.c
+++ b/perform.c
@@ -1539,6 +1539,7 @@ int perform_encryption(u8 *data, int datalen) {
if(!g_encrypt_mode) {
// X = public or private Y = decrypt or encrypt
+ #ifdef RSA_SSLV23_PADDING
#define QUICKBMS_OPENSSL_RSA(X, Y) \
if(!rsa_ctx->openssl_rsa || RSA_##X##_##Y (datalen, data, data, rsa_ctx->openssl_rsa, RSA_PKCS1_PADDING) < 0) \
if(!rsa_ctx->openssl_rsa || RSA_##X##_##Y (datalen, data, data, rsa_ctx->openssl_rsa, RSA_SSLV23_PADDING) < 0) \
@@ -1546,6 +1547,14 @@ int perform_encryption(u8 *data, int datalen) {
if(!rsa_ctx->openssl_rsa || RSA_##X##_##Y (datalen, data, data, rsa_ctx->openssl_rsa, RSA_PKCS1_OAEP_PADDING) < 0) \
if(!rsa_ctx->openssl_rsa || RSA_##X##_##Y (datalen, data, data, rsa_ctx->openssl_rsa, RSA_X931_PADDING) < 0) \
if(!rsa_ctx->openssl_rsa || RSA_##X##_##Y (datalen, data, data, rsa_ctx->openssl_rsa, RSA_PKCS1_PSS_PADDING) < 0)
+ #else
+ #define QUICKBMS_OPENSSL_RSA(X, Y) \
+ if(!rsa_ctx->openssl_rsa || RSA_##X##_##Y (datalen, data, data, rsa_ctx->openssl_rsa, RSA_PKCS1_PADDING) < 0) \
+ if(!rsa_ctx->openssl_rsa || RSA_##X##_##Y (datalen, data, data, rsa_ctx->openssl_rsa, RSA_NO_PADDING) < 0) \
+ if(!rsa_ctx->openssl_rsa || RSA_##X##_##Y (datalen, data, data, rsa_ctx->openssl_rsa, RSA_PKCS1_OAEP_PADDING) < 0) \
+ if(!rsa_ctx->openssl_rsa || RSA_##X##_##Y (datalen, data, data, rsa_ctx->openssl_rsa, RSA_X931_PADDING) < 0) \
+ if(!rsa_ctx->openssl_rsa || RSA_##X##_##Y (datalen, data, data, rsa_ctx->openssl_rsa, RSA_PKCS1_PSS_PADDING) < 0)
+ #endif
// X = function name ... = arguments
#define QUICKBMS_TOMCRYPT_RSA(X, ...) \
--
2.41.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment