From 21ee1904b5c46f314b862eea33d3b86fcf6c7c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Thu, 8 Jan 2004 13:37:13 +0100 Subject: (TMP_DECL, TMP_ALLOC): New macros. When alloca is unavailable, they work by allocating a fix amount of stack and imposing a hard limit on what can be allocated. Updated all users of alloca. Rev: src/nettle/bignum-random.c:1.4 Rev: src/nettle/cbc.c:1.8 Rev: src/nettle/dsa-keygen.c:1.7 Rev: src/nettle/hmac.c:1.6 Rev: src/nettle/pkcs1-rsa-md5.c:1.3 Rev: src/nettle/pkcs1-rsa-sha1.c:1.3 Rev: src/nettle/rsa-decrypt.c:1.5 Rev: src/nettle/rsa-encrypt.c:1.8 Rev: src/nettle/sexp.c:1.15 --- dsa-keygen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'dsa-keygen.c') diff --git a/dsa-keygen.c b/dsa-keygen.c index 2bd9fd66..beb895ed 100644 --- a/dsa-keygen.c +++ b/dsa-keygen.c @@ -35,6 +35,7 @@ #include "bignum.h" #include "memxor.h" +#include "nettle-internal.h" /* The (slow) NIST method of generating DSA primes. Algorithm 4.56 of * Handbook of Applied Cryptography. */ @@ -118,8 +119,10 @@ dsa_nist_gen(mpz_t p, mpz_t q, progress(progress_ctx, '\n'); { + /* Official maximum key size: L = 1024 => n = 6 */ + TMP_DECL(buffer, uint8_t, (6 + 1) * SHA1_DIGEST_SIZE); unsigned size = (n+1) * SHA1_DIGEST_SIZE; - uint8_t *buffer = alloca(size); + TMP_ALLOC(buffer, size); unsigned i, j; for (i = 0, j = 2; i<4096; i++, j+= n+1) -- cgit v1.2.1