Skip to content

Commit

Permalink
p5-Crypt-OpenSSL-RSA: don't rely on libcrypto returning static buffers
Browse files Browse the repository at this point in the history
Upstream is currently in the painful process of adapting their code to
OpenSSL 3.0. This diff clashes with those efforts. I'll upstram a version
once the dust will have settled.
  • Loading branch information
botovq committed May 30, 2024
1 parent 67c77ed commit 3d43305
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions security/p5-Crypt-OpenSSL-RSA/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
COMMENT = RSA encoding and decoding using OpenSSL

DISTNAME = Crypt-OpenSSL-RSA-0.33
REVISION = 0

CATEGORIES = security

Expand Down
53 changes: 53 additions & 0 deletions security/p5-Crypt-OpenSSL-RSA/patches/patch-RSA_xs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Passing in a NULL md is no longer supported

Index: RSA.xs
--- RSA.xs.orig
+++ RSA.xs
@@ -115,6 +115,7 @@ int get_digest_length(int hash_method)
unsigned char* get_message_digest(SV* text_SV, int hash_method)
{
STRLEN text_length;
+ static unsigned char md[EVP_MAX_MD_SIZE];
unsigned char* text;

text = (unsigned char*) SvPV(text_SV, text_length);
@@ -122,31 +123,31 @@ unsigned char* get_message_digest(SV* text_SV, int has
switch(hash_method)
{
case NID_md5:
- return MD5(text, text_length, NULL);
+ return MD5(text, text_length, md);
break;
case NID_sha1:
- return SHA1(text, text_length, NULL);
+ return SHA1(text, text_length, md);
break;
#ifdef SHA512_DIGEST_LENGTH
case NID_sha224:
- return SHA224(text, text_length, NULL);
+ return SHA224(text, text_length, md);
break;
case NID_sha256:
- return SHA256(text, text_length, NULL);
+ return SHA256(text, text_length, md);
break;
case NID_sha384:
- return SHA384(text, text_length, NULL);
+ return SHA384(text, text_length, md);
break;
case NID_sha512:
- return SHA512(text, text_length, NULL);
+ return SHA512(text, text_length, md);
break;
#endif
case NID_ripemd160:
- return RIPEMD160(text, text_length, NULL);
+ return RIPEMD160(text, text_length, md);
break;
#ifdef WHIRLPOOL_DIGEST_LENGTH
case NID_whirlpool:
- return WHIRLPOOL(text, text_length, NULL);
+ return WHIRLPOOL(text, text_length, md);
break;
#endif
default:

0 comments on commit 3d43305

Please sign in to comment.