'make update'
[openssl.git] / rsaref / rsaref.c
index b070c5684c217ed27a9593deb1307d29264b8ad1..ae70feb3e9b0e246d07d0891ef0087cb34c96d61 100644 (file)
@@ -78,7 +78,8 @@ int RSA_ref_public_encrypt(int len, unsigned char *from,
        unsigned char *to, RSA *rsa, int padding);
 int RSA_ref_public_decrypt(int len, unsigned char *from,
        unsigned char *to, RSA *rsa, int padding);
-static int BN_ref_mod_exp(BIGNUM *r,BIGNUM *a,BIGNUM *p,BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+static int BN_ref_mod_exp(BIGNUM *r,BIGNUM *a,const BIGNUM *p,const BIGNUM *m,
+                         BN_CTX *ctx, BN_MONT_CTX *m_ctx);
 static int RSA_ref_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa);
 static RSA_METHOD rsa_pkcs1_ref_meth={
        "RSAref PKCS#1 RSA",
@@ -105,8 +106,8 @@ static int RSA_ref_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa)
        return(0);
        }
 
-static int BN_ref_mod_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m,
-            BN_CTX *ctx, BN_MONT_CTX *m_ctx)
+static int BN_ref_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p,
+                         const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
        {
        RSAREFerr(RSAREF_F_BN_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
        return(0);
@@ -278,7 +279,8 @@ int RSA_ref_public_encrypt(int len, unsigned char *from, unsigned char *to,
        R_GetRandomBytesNeeded((unsigned int *)&i,&rnd);
        while (i > 0)
                {
-               RAND_bytes(buf,16);
+               if (RAND_bytes(buf,16) <= 0)
+                       goto err;
                R_RandomUpdate(&rnd,buf,(unsigned int)((i>16)?16:i));
                i-=16;
                }
@@ -297,4 +299,10 @@ err:
        memset(&rnd,0,sizeof(rnd));
        return(outlen);
        }
+#else /* !NO_RSA */
+
+# if PEDANTIC
+static void *dummy=&dummy;
+# endif
+
 #endif