fixed padding bug in RSA_encrypt()
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 27 Jan 2008 20:17:15 +0000 (20:17 -0000)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 27 Jan 2008 20:17:15 +0000 (20:17 -0000)
src/pluto/pkcs1.c

index f02dc29..bc07848 100644 (file)
@@ -442,11 +442,13 @@ RSA_encrypt(const RSA_public_key_t *key, chunk_t in)
     *pos++ = 0x02;
 
     /* pad with pseudo random bytes unequal to zero */
-    get_rnd_bytes(pos, padding);
     for (i = 0; i < padding; i++)
     {
+       get_rnd_bytes(pos, padding);
        while (!*pos)
-         get_rnd_bytes(pos, 1);
+       {
+           get_rnd_bytes(pos, 1);
+       }
        pos++;
     }