Massive constification.
[openssl.git] / rsaref / rsaref.c
index 324460327d46703c2347a62af7c90e4d6bf531d0..84486dd1b5f6c224c95329019e3668c4e3694b79 100644 (file)
@@ -96,7 +96,7 @@ 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);
+static int BN_ref_mod_exp(BIGNUM *r,BIGNUM *a,BIGNUM *p,BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
 static int RSA_ref_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa);
 #else
 
@@ -144,9 +144,10 @@ RSA *rsa;
        return(0);
        }
 
-static int BN_ref_mod_exp(r,a,p,m,ctx)
+static int BN_ref_mod_exp(r,a,p,m,ctx,m_ctx)
 BIGNUM *r,*a,*p,*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);
@@ -282,6 +283,11 @@ int padding;
        int i,outlen= -1;
        RSArefPrivateKey RSAkey;
 
+       if (padding != RSA_PKCS1_PADDING)
+               {
+               RSAREFerr(RSAREF_F_RSA_REF_PRIVATE_ENCRYPT, RSA_R_UNKNOWN_PADDING_TYPE);
+               goto err;
+       }
        if (!RSAref_Private_eay2ref(rsa,&RSAkey))
                goto err;
        if ((i=RSAPrivateEncrypt(to,&outlen,from,len,&RSAkey)) != 0)
@@ -327,6 +333,12 @@ int padding;
        RSARandomState rnd;
        unsigned char buf[16];
 
+       if (padding != RSA_PKCS1_PADDING && padding != RSA_SSLV23_PADDING) 
+               {
+               RSAREFerr(RSAREF_F_RSA_REF_PUBLIC_ENCRYPT, RSA_R_UNKNOWN_PADDING_TYPE);
+               goto err;
+               }
+       
        R_RandomInit(&rnd);
        R_GetRandomBytesNeeded((unsigned int *)&i,&rnd);
        while (i > 0)