diff tim_exptmod.c @ 143:5d99163f7e32 libtomcrypt-orig

import of libtomcrypt 0.99
author Matt Johnston <matt@ucc.asn.au>
date Sun, 19 Dec 2004 11:34:45 +0000
parents 6362d3854bb4
children
line wrap: on
line diff
--- a/tim_exptmod.c	Tue Jun 15 14:07:21 2004 +0000
+++ b/tim_exptmod.c	Sun Dec 19 11:34:45 2004 +0000
@@ -34,13 +34,13 @@
    }
 
    /* pick random r */ 
-   rtmp = XMALLOC(MAX_RSA_SIZE/8);
+   rlen = mp_unsigned_bin_size(n);
+   rtmp = XMALLOC(rlen);
    if (rtmp == NULL) {
       return CRYPT_MEM;
    }
 
-
-   rlen = mp_unsigned_bin_size(n);
+   /* read in random value "r" */
    if (prng_descriptor[prng_idx].read(rtmp, rlen, prng) != rlen) {
       XFREE(rtmp);
       return CRYPT_ERROR_READPRNG;