summaryrefslogtreecommitdiff
path: root/pkcs1-rsa-md5.c
diff options
context:
space:
mode:
Diffstat (limited to 'pkcs1-rsa-md5.c')
-rw-r--r--pkcs1-rsa-md5.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkcs1-rsa-md5.c b/pkcs1-rsa-md5.c
index c337232d..d3ccd8b0 100644
--- a/pkcs1-rsa-md5.c
+++ b/pkcs1-rsa-md5.c
@@ -38,6 +38,8 @@
#include "bignum.h"
#include "pkcs1.h"
+#include "nettle-internal.h"
+
/* From pkcs-1v2
*
* md5 OBJECT IDENTIFIER ::=
@@ -64,7 +66,8 @@ md5_prefix[] =
void
pkcs1_rsa_md5_encode(mpz_t m, unsigned length, struct md5_ctx *hash)
{
- uint8_t *em = alloca(length);
+ TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_BITS / 8);
+ TMP_ALLOC(em, length);
assert(length >= MD5_DIGEST_SIZE);
pkcs1_signature_prefix(length - MD5_DIGEST_SIZE, em,
@@ -78,7 +81,8 @@ pkcs1_rsa_md5_encode(mpz_t m, unsigned length, struct md5_ctx *hash)
void
pkcs1_rsa_md5_encode_digest(mpz_t m, unsigned length, const uint8_t *digest)
{
- uint8_t *em = alloca(length);
+ TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_BITS / 8);
+ TMP_ALLOC(em, length);
assert(length >= MD5_DIGEST_SIZE);
pkcs1_signature_prefix(length - MD5_DIGEST_SIZE, em,