"print" is GNU bc specific.
[oweals/openssl.git] / crypto / rsa / rsa_eay.c
index 4525e6676c4d6f2edbdbfaf411341cf4a8e41ca3..b7d2460754e6225f3edd8f8dec7a0fd6c5757079 100644 (file)
@@ -62,6 +62,8 @@
 #include <openssl/rsa.h>
 #include <openssl/rand.h>
 
+#ifndef RSA_NULL
+
 static int RSA_eay_public_encrypt(int flen, unsigned char *from,
                unsigned char *to, RSA *rsa,int padding);
 static int RSA_eay_private_encrypt(int flen, unsigned char *from,
@@ -205,11 +207,12 @@ static int RSA_eay_private_encrypt(int flen, unsigned char *from,
        if (rsa->flags & RSA_FLAG_BLINDING)
                if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;
 
-       if (    (rsa->p != NULL) &&
+       if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
+               ((rsa->p != NULL) &&
                (rsa->q != NULL) &&
                (rsa->dmp1 != NULL) &&
                (rsa->dmq1 != NULL) &&
-               (rsa->iqmp != NULL))
+               (rsa->iqmp != NULL)) )
                { if (!rsa->meth->rsa_mod_exp(&ret,&f,rsa)) goto err; }
        else
                {
@@ -261,7 +264,7 @@ static int RSA_eay_private_decrypt(int flen, unsigned char *from,
                goto err;
                }
 
-       /* This check was for equallity but PGP does evil things
+       /* This check was for equality but PGP does evil things
         * and chops off the top '0' bytes */
        if (flen > num)
                {
@@ -278,11 +281,12 @@ static int RSA_eay_private_decrypt(int flen, unsigned char *from,
                if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;
 
        /* do the decrypt */
-       if (    (rsa->p != NULL) &&
+       if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
+               ((rsa->p != NULL) &&
                (rsa->q != NULL) &&
                (rsa->dmp1 != NULL) &&
                (rsa->dmq1 != NULL) &&
-               (rsa->iqmp != NULL))
+               (rsa->iqmp != NULL)) )
                { if (!rsa->meth->rsa_mod_exp(&ret,&f,rsa)) goto err; }
        else
                {
@@ -353,7 +357,7 @@ static int RSA_eay_public_decrypt(int flen, unsigned char *from,
                goto err;
                }
 
-       /* This check was for equallity but PGP does evil things
+       /* This check was for equality but PGP does evil things
         * and chops off the top '0' bytes */
        if (flen > num)
                {
@@ -484,4 +488,4 @@ static int RSA_eay_finish(RSA *rsa)
        return(1);
        }
 
-
+#endif