Decrypt test vector data even if previous decryption failed to get
[openssl.git] / ssl / ssl_rsa.c
index 8579c51fc6234863daaa2e1a13a3c966274a4777..a2db46e05f2cb60e17bc6601c253dff4c54cfb1b 100644 (file)
  */
 
 #include <stdio.h>
-#include "bio.h"
-#include "objects.h"
-#include "evp.h"
-#include "x509.h"
-#include "pem.h"
+#include <openssl/bio.h>
+#include <openssl/objects.h>
+#include <openssl/evp.h>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
 #include "ssl_locl.h"
 
-#ifndef NOPROTO
 static int ssl_set_cert(CERT *c, X509 *x509);
 static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey);
-#else
-static int ssl_set_cert();
-static int ssl_set_pkey();
-#endif
-
-int SSL_use_certificate(ssl, x)
-SSL *ssl;
-X509 *x;
+int SSL_use_certificate(SSL *ssl, X509 *x)
        {
        if (x == NULL)
                {
@@ -90,10 +82,7 @@ X509 *x;
        }
 
 #ifndef NO_STDIO
-int SSL_use_certificate_file(ssl, file, type)
-SSL *ssl;
-char *file;
-int type;
+int SSL_use_certificate_file(SSL *ssl, char *file, int type)
        {
        int j;
        BIO *in;
@@ -142,10 +131,7 @@ end:
        }
 #endif
 
-int SSL_use_certificate_ASN1(ssl, d,len)
-SSL *ssl;
-unsigned char *d;
-int len;
+int SSL_use_certificate_ASN1(SSL *ssl, unsigned char *d, int len)
        {
        X509 *x;
        int ret;
@@ -163,9 +149,7 @@ int len;
        }
 
 #ifndef NO_RSA
-int SSL_use_RSAPrivateKey(ssl, rsa)
-SSL *ssl;
-RSA *rsa;
+int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa)
        {
        EVP_PKEY *pkey;
        int ret;
@@ -195,9 +179,7 @@ RSA *rsa;
        }
 #endif
 
-static int ssl_set_pkey(c,pkey)
-CERT *c;
-EVP_PKEY *pkey;
+static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey)
        {
        int i,ok=0,bad=0;
 
@@ -271,10 +253,7 @@ EVP_PKEY *pkey;
 
 #ifndef NO_RSA
 #ifndef NO_STDIO
-int SSL_use_RSAPrivateKey_file(ssl, file, type)
-SSL *ssl;
-char *file;
-int type;
+int SSL_use_RSAPrivateKey_file(SSL *ssl, char *file, int type)
        {
        int j,ret=0;
        BIO *in;
@@ -321,10 +300,7 @@ end:
        }
 #endif
 
-int SSL_use_RSAPrivateKey_ASN1(ssl,d,len)
-SSL *ssl;
-unsigned char *d;
-long len;
+int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len)
        {
        int ret;
        unsigned char *p;
@@ -343,9 +319,7 @@ long len;
        }
 #endif /* !NO_RSA */
 
-int SSL_use_PrivateKey(ssl, pkey)
-SSL *ssl;
-EVP_PKEY *pkey;
+int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey)
        {
        int ret;
 
@@ -364,10 +338,7 @@ EVP_PKEY *pkey;
        }
 
 #ifndef NO_STDIO
-int SSL_use_PrivateKey_file(ssl, file, type)
-SSL *ssl;
-char *file;
-int type;
+int SSL_use_PrivateKey_file(SSL *ssl, char *file, int type)
        {
        int j,ret=0;
        BIO *in;
@@ -409,11 +380,7 @@ end:
        }
 #endif
 
-int SSL_use_PrivateKey_ASN1(type,ssl,d,len)
-int type;
-SSL *ssl;
-unsigned char *d;
-long len;
+int SSL_use_PrivateKey_ASN1(int type, SSL *ssl, unsigned char *d, long len)
        {
        int ret;
        unsigned char *p;
@@ -431,9 +398,7 @@ long len;
        return(ret);
        }
 
-int SSL_CTX_use_certificate(ctx, x)
-SSL_CTX *ctx;
-X509 *x;
+int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x)
        {
        if (x == NULL)
                {
@@ -448,9 +413,7 @@ X509 *x;
        return(ssl_set_cert(ctx->default_cert,x));
        }
 
-static int ssl_set_cert(c,x)
-CERT *c;
-X509 *x;
+static int ssl_set_cert(CERT *c, X509 *x)
        {
        EVP_PKEY *pkey;
        int i,ok=0,bad=0;
@@ -531,10 +494,7 @@ X509 *x;
        }
 
 #ifndef NO_STDIO
-int SSL_CTX_use_certificate_file(ctx, file, type)
-SSL_CTX *ctx;
-char *file;
-int type;
+int SSL_CTX_use_certificate_file(SSL_CTX *ctx, char *file, int type)
        {
        int j;
        BIO *in;
@@ -583,10 +543,7 @@ end:
        }
 #endif
 
-int SSL_CTX_use_certificate_ASN1(ctx, len, d)
-SSL_CTX *ctx;
-int len;
-unsigned char *d;
+int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d)
        {
        X509 *x;
        int ret;
@@ -604,9 +561,7 @@ unsigned char *d;
        }
 
 #ifndef NO_RSA
-int SSL_CTX_use_RSAPrivateKey(ctx, rsa)
-SSL_CTX *ctx;
-RSA *rsa;
+int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa)
        {
        int ret;
        EVP_PKEY *pkey;
@@ -636,10 +591,7 @@ RSA *rsa;
        }
 
 #ifndef NO_STDIO
-int SSL_CTX_use_RSAPrivateKey_file(ctx, file, type)
-SSL_CTX *ctx;
-char *file;
-int type;
+int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, char *file, int type)
        {
        int j,ret=0;
        BIO *in;
@@ -686,10 +638,7 @@ end:
        }
 #endif
 
-int SSL_CTX_use_RSAPrivateKey_ASN1(ctx,d,len)
-SSL_CTX *ctx;
-unsigned char *d;
-long len;
+int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len)
        {
        int ret;
        unsigned char *p;
@@ -708,9 +657,7 @@ long len;
        }
 #endif /* !NO_RSA */
 
-int SSL_CTX_use_PrivateKey(ctx, pkey)
-SSL_CTX *ctx;
-EVP_PKEY *pkey;
+int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey)
        {
        if (pkey == NULL)
                {
@@ -726,10 +673,7 @@ EVP_PKEY *pkey;
        }
 
 #ifndef NO_STDIO
-int SSL_CTX_use_PrivateKey_file(ctx, file, type)
-SSL_CTX *ctx;
-char *file;
-int type;
+int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, char *file, int type)
        {
        int j,ret=0;
        BIO *in;
@@ -771,11 +715,8 @@ end:
        }
 #endif
 
-int SSL_CTX_use_PrivateKey_ASN1(type,ctx,d,len)
-int type;
-SSL_CTX *ctx;
-unsigned char *d;
-long len;
+int SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, unsigned char *d,
+            long len)
        {
        int ret;
        unsigned char *p;