summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_rsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_rsa.c')
-rw-r--r--src/lib/libssl/ssl_rsa.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/lib/libssl/ssl_rsa.c b/src/lib/libssl/ssl_rsa.c
index 6ec7a5cdb1..1cf8e20934 100644
--- a/src/lib/libssl/ssl_rsa.c
+++ b/src/lib/libssl/ssl_rsa.c
@@ -81,7 +81,7 @@ int SSL_use_certificate(SSL *ssl, X509 *x)
81 return(ssl_set_cert(ssl->cert,x)); 81 return(ssl_set_cert(ssl->cert,x));
82 } 82 }
83 83
84#ifndef NO_STDIO 84#ifndef OPENSSL_NO_STDIO
85int SSL_use_certificate_file(SSL *ssl, const char *file, int type) 85int SSL_use_certificate_file(SSL *ssl, const char *file, int type)
86 { 86 {
87 int j; 87 int j;
@@ -148,7 +148,7 @@ int SSL_use_certificate_ASN1(SSL *ssl, unsigned char *d, int len)
148 return(ret); 148 return(ret);
149 } 149 }
150 150
151#ifndef NO_RSA 151#ifndef OPENSSL_NO_RSA
152int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa) 152int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa)
153 { 153 {
154 EVP_PKEY *pkey; 154 EVP_PKEY *pkey;
@@ -170,7 +170,7 @@ int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa)
170 return(0); 170 return(0);
171 } 171 }
172 172
173 CRYPTO_add(&rsa->references,1,CRYPTO_LOCK_RSA); 173 RSA_up_ref(rsa);
174 EVP_PKEY_assign_RSA(pkey,rsa); 174 EVP_PKEY_assign_RSA(pkey,rsa);
175 175
176 ret=ssl_set_pkey(ssl->cert,pkey); 176 ret=ssl_set_pkey(ssl->cert,pkey);
@@ -198,7 +198,7 @@ static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey)
198 EVP_PKEY_free(pktmp); 198 EVP_PKEY_free(pktmp);
199 ERR_clear_error(); 199 ERR_clear_error();
200 200
201#ifndef NO_RSA 201#ifndef OPENSSL_NO_RSA
202 /* Don't check the public/private key, this is mostly 202 /* Don't check the public/private key, this is mostly
203 * for smart cards. */ 203 * for smart cards. */
204 if ((pkey->type == EVP_PKEY_RSA) && 204 if ((pkey->type == EVP_PKEY_RSA) &&
@@ -251,8 +251,8 @@ static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey)
251 return(1); 251 return(1);
252 } 252 }
253 253
254#ifndef NO_RSA 254#ifndef OPENSSL_NO_RSA
255#ifndef NO_STDIO 255#ifndef OPENSSL_NO_STDIO
256int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type) 256int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type)
257 { 257 {
258 int j,ret=0; 258 int j,ret=0;
@@ -303,7 +303,7 @@ end:
303int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len) 303int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len)
304 { 304 {
305 int ret; 305 int ret;
306 unsigned char *p; 306 const unsigned char *p;
307 RSA *rsa; 307 RSA *rsa;
308 308
309 p=d; 309 p=d;
@@ -317,7 +317,7 @@ int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len)
317 RSA_free(rsa); 317 RSA_free(rsa);
318 return(ret); 318 return(ret);
319 } 319 }
320#endif /* !NO_RSA */ 320#endif /* !OPENSSL_NO_RSA */
321 321
322int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey) 322int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey)
323 { 323 {
@@ -337,7 +337,7 @@ int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey)
337 return(ret); 337 return(ret);
338 } 338 }
339 339
340#ifndef NO_STDIO 340#ifndef OPENSSL_NO_STDIO
341int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type) 341int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type)
342 { 342 {
343 int j,ret=0; 343 int j,ret=0;
@@ -438,7 +438,7 @@ static int ssl_set_cert(CERT *c, X509 *x)
438 EVP_PKEY_copy_parameters(pkey,c->pkeys[i].privatekey); 438 EVP_PKEY_copy_parameters(pkey,c->pkeys[i].privatekey);
439 ERR_clear_error(); 439 ERR_clear_error();
440 440
441#ifndef NO_RSA 441#ifndef OPENSSL_NO_RSA
442 /* Don't check the public/private key, this is mostly 442 /* Don't check the public/private key, this is mostly
443 * for smart cards. */ 443 * for smart cards. */
444 if ((c->pkeys[i].privatekey->type == EVP_PKEY_RSA) && 444 if ((c->pkeys[i].privatekey->type == EVP_PKEY_RSA) &&
@@ -471,7 +471,7 @@ static int ssl_set_cert(CERT *c, X509 *x)
471 } 471 }
472 else 472 else
473 ok=1; 473 ok=1;
474 } /* NO_RSA */ 474 } /* OPENSSL_NO_RSA */
475 } 475 }
476 else 476 else
477 ok=1; 477 ok=1;
@@ -493,7 +493,7 @@ static int ssl_set_cert(CERT *c, X509 *x)
493 return(1); 493 return(1);
494 } 494 }
495 495
496#ifndef NO_STDIO 496#ifndef OPENSSL_NO_STDIO
497int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type) 497int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type)
498 { 498 {
499 int j; 499 int j;
@@ -560,7 +560,7 @@ int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d)
560 return(ret); 560 return(ret);
561 } 561 }
562 562
563#ifndef NO_RSA 563#ifndef OPENSSL_NO_RSA
564int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa) 564int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa)
565 { 565 {
566 int ret; 566 int ret;
@@ -582,7 +582,7 @@ int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa)
582 return(0); 582 return(0);
583 } 583 }
584 584
585 CRYPTO_add(&rsa->references,1,CRYPTO_LOCK_RSA); 585 RSA_up_ref(rsa);
586 EVP_PKEY_assign_RSA(pkey,rsa); 586 EVP_PKEY_assign_RSA(pkey,rsa);
587 587
588 ret=ssl_set_pkey(ctx->cert, pkey); 588 ret=ssl_set_pkey(ctx->cert, pkey);
@@ -590,7 +590,7 @@ int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa)
590 return(ret); 590 return(ret);
591 } 591 }
592 592
593#ifndef NO_STDIO 593#ifndef OPENSSL_NO_STDIO
594int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type) 594int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type)
595 { 595 {
596 int j,ret=0; 596 int j,ret=0;
@@ -641,7 +641,7 @@ end:
641int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len) 641int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len)
642 { 642 {
643 int ret; 643 int ret;
644 unsigned char *p; 644 const unsigned char *p;
645 RSA *rsa; 645 RSA *rsa;
646 646
647 p=d; 647 p=d;
@@ -655,7 +655,7 @@ int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len)
655 RSA_free(rsa); 655 RSA_free(rsa);
656 return(ret); 656 return(ret);
657 } 657 }
658#endif /* !NO_RSA */ 658#endif /* !OPENSSL_NO_RSA */
659 659
660int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) 660int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey)
661 { 661 {
@@ -672,7 +672,7 @@ int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey)
672 return(ssl_set_pkey(ctx->cert,pkey)); 672 return(ssl_set_pkey(ctx->cert,pkey));
673 } 673 }
674 674
675#ifndef NO_STDIO 675#ifndef OPENSSL_NO_STDIO
676int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type) 676int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type)
677 { 677 {
678 int j,ret=0; 678 int j,ret=0;
@@ -735,7 +735,7 @@ int SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, unsigned char *d,
735 } 735 }
736 736
737 737
738#ifndef NO_STDIO 738#ifndef OPENSSL_NO_STDIO
739/* Read a file that contains our certificate in "PEM" format, 739/* Read a file that contains our certificate in "PEM" format,
740 * possibly followed by a sequence of CA certificates that should be 740 * possibly followed by a sequence of CA certificates that should be
741 * sent to the peer in the Certificate message. 741 * sent to the peer in the Certificate message.
@@ -800,9 +800,9 @@ int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file)
800 * by SSL_CTX_use_certificate). */ 800 * by SSL_CTX_use_certificate). */
801 } 801 }
802 /* When the while loop ends, it's usually just EOF. */ 802 /* When the while loop ends, it's usually just EOF. */
803 err = ERR_peek_error(); 803 err = ERR_peek_last_error();
804 if (ERR_GET_LIB(err) == ERR_LIB_PEM && ERR_GET_REASON(err) == PEM_R_NO_START_LINE) 804 if (ERR_GET_LIB(err) == ERR_LIB_PEM && ERR_GET_REASON(err) == PEM_R_NO_START_LINE)
805 (void) ERR_get_error(); 805 (void)ERR_get_error();
806 else 806 else
807 ret = 0; /* some real error */ 807 ret = 0; /* some real error */
808 } 808 }