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.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/lib/libssl/ssl_rsa.c b/src/lib/libssl/ssl_rsa.c
index e99ce1e3ae..631aaa5077 100644
--- a/src/lib/libssl/ssl_rsa.c
+++ b/src/lib/libssl/ssl_rsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_rsa.c,v 1.28 2017/02/07 02:08:38 beck Exp $ */ 1/* $OpenBSD: ssl_rsa.c,v 1.29 2018/04/25 07:10:39 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -133,7 +133,7 @@ SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len)
133 X509 *x; 133 X509 *x;
134 int ret; 134 int ret;
135 135
136 x = d2i_X509(NULL, &d,(long)len); 136 x = d2i_X509(NULL, &d, (long)len);
137 if (x == NULL) { 137 if (x == NULL) {
138 SSLerror(ssl, ERR_R_ASN1_LIB); 138 SSLerror(ssl, ERR_R_ASN1_LIB);
139 return (0); 139 return (0);
@@ -254,14 +254,12 @@ end:
254} 254}
255 255
256int 256int
257SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len) 257SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, long len)
258{ 258{
259 int ret; 259 int ret;
260 const unsigned char *p;
261 RSA *rsa; 260 RSA *rsa;
262 261
263 p = d; 262 if ((rsa = d2i_RSAPrivateKey(NULL, &d, (long)len)) == NULL) {
264 if ((rsa = d2i_RSAPrivateKey(NULL, &p,(long)len)) == NULL) {
265 SSLerror(ssl, ERR_R_ASN1_LIB); 263 SSLerror(ssl, ERR_R_ASN1_LIB);
266 return (0); 264 return (0);
267 } 265 }
@@ -332,11 +330,9 @@ int
332SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const unsigned char *d, long len) 330SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const unsigned char *d, long len)
333{ 331{
334 int ret; 332 int ret;
335 const unsigned char *p;
336 EVP_PKEY *pkey; 333 EVP_PKEY *pkey;
337 334
338 p = d; 335 if ((pkey = d2i_PrivateKey(type, NULL, &d, (long)len)) == NULL) {
339 if ((pkey = d2i_PrivateKey(type, NULL, &p,(long)len)) == NULL) {
340 SSLerror(ssl, ERR_R_ASN1_LIB); 336 SSLerror(ssl, ERR_R_ASN1_LIB);
341 return (0); 337 return (0);
342 } 338 }
@@ -465,7 +461,7 @@ SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d)
465 X509 *x; 461 X509 *x;
466 int ret; 462 int ret;
467 463
468 x = d2i_X509(NULL, &d,(long)len); 464 x = d2i_X509(NULL, &d, (long)len);
469 if (x == NULL) { 465 if (x == NULL) {
470 SSLerrorx(ERR_R_ASN1_LIB); 466 SSLerrorx(ERR_R_ASN1_LIB);
471 return (0); 467 return (0);
@@ -547,11 +543,9 @@ int
547SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len) 543SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len)
548{ 544{
549 int ret; 545 int ret;
550 const unsigned char *p;
551 RSA *rsa; 546 RSA *rsa;
552 547
553 p = d; 548 if ((rsa = d2i_RSAPrivateKey(NULL, &d, (long)len)) == NULL) {
554 if ((rsa = d2i_RSAPrivateKey(NULL, &p,(long)len)) == NULL) {
555 SSLerrorx(ERR_R_ASN1_LIB); 549 SSLerrorx(ERR_R_ASN1_LIB);
556 return (0); 550 return (0);
557 } 551 }
@@ -620,11 +614,9 @@ SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, const unsigned char *d,
620 long len) 614 long len)
621{ 615{
622 int ret; 616 int ret;
623 const unsigned char *p;
624 EVP_PKEY *pkey; 617 EVP_PKEY *pkey;
625 618
626 p = d; 619 if ((pkey = d2i_PrivateKey(type, NULL, &d, (long)len)) == NULL) {
627 if ((pkey = d2i_PrivateKey(type, NULL, &p,(long)len)) == NULL) {
628 SSLerrorx(ERR_R_ASN1_LIB); 620 SSLerrorx(ERR_R_ASN1_LIB);
629 return (0); 621 return (0);
630 } 622 }