update
authorPekka Riikonen <priikone@silcnet.org>
Tue, 20 Feb 2001 20:23:47 +0000 (20:23 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 20 Feb 2001 20:23:47 +0000 (20:23 +0000)
lib/silccrypt/pkcs1.c

index 8420b8b100416359a287d395e68fa0ca703574fc..146e6618993a9ff1932e2e3790a9679098f294a3 100644 (file)
@@ -33,9 +33,9 @@
                ftp://ftp.rsasecurity.com/pub/pkcs/ascii/pkcs-1.asc,
               and RFC 2437.
 
-   Copyright notice: All code, including the SILC PKCS API code that is
-   not part of the Mozilla code, falls under the same license (MPL or GPL)
-   found attached to this file, below.
+   Copyright notice: All code in this file, including the SILC PKCS API
+   code that is not part of the Mozilla code, falls under the same license
+   (MPL or GPL) found attached to this file, below.
 */
 
 /*
@@ -110,6 +110,7 @@ RSA_FormatOneBlock(unsigned int modulusLen, RSA_BlockType blockType,
     unsigned char *block;
     unsigned char *bp;
     int padLen;
+    int i;
 
     block = (unsigned char *) silc_malloc(modulusLen);
     if (block == NULL)
@@ -152,15 +153,6 @@ RSA_FormatOneBlock(unsigned int modulusLen, RSA_BlockType blockType,
        * Blocks intended for public-key operation.
        */
       case RSA_BlockPublic:
-
-       /* XXX For now we can't do this because we can't get the
-          SilcRNG object down to this level. */
-       silc_free(block);
-       return NULL;
-
-#if 0
-       int i;
-
        /*
         * 0x00 || BT || Pad || 0x00 || ActualData
         *   1      1   padLen    1      data_len
@@ -171,14 +163,12 @@ RSA_FormatOneBlock(unsigned int modulusLen, RSA_BlockType blockType,
        for (i = 0; i < padLen; i++) {
            /* Pad with non-zero random data. */
            do {
-               RNG_GenerateGlobalRandomBytes(bp + i, 1);
+               silc_rng_global_get_byte(bp + i);
            } while (bp[i] == RSA_BLOCK_AFTER_PAD_OCTET);
        }
        bp += padLen;
        *bp++ = RSA_BLOCK_AFTER_PAD_OCTET;
        memcpy(bp, data, data_len);
-#endif
-
        break;
 
       default: