-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
p5-Crypt-OpenSSL-RSA: don't rely on libcrypto returning static buffers
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
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |