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.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/src/lib/libssl/ssl_rsa.c b/src/lib/libssl/ssl_rsa.c
index 03eedc0d8a..3efed227f0 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.25 2017/01/24 14:57:31 jsing Exp $ */ 1/* $OpenBSD: ssl_rsa.c,v 1.26 2017/01/26 10:40:21 beck 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 *
@@ -74,11 +74,11 @@ int
74SSL_use_certificate(SSL *ssl, X509 *x) 74SSL_use_certificate(SSL *ssl, X509 *x)
75{ 75{
76 if (x == NULL) { 76 if (x == NULL) {
77 SSLerr(SSL_F_SSL_USE_CERTIFICATE, ERR_R_PASSED_NULL_PARAMETER); 77 SSLerror(ERR_R_PASSED_NULL_PARAMETER);
78 return (0); 78 return (0);
79 } 79 }
80 if (!ssl_cert_inst(&ssl->cert)) { 80 if (!ssl_cert_inst(&ssl->cert)) {
81 SSLerr(SSL_F_SSL_USE_CERTIFICATE, ERR_R_MALLOC_FAILURE); 81 SSLerror(ERR_R_MALLOC_FAILURE);
82 return (0); 82 return (0);
83 } 83 }
84 return (ssl_set_cert(ssl->cert, x)); 84 return (ssl_set_cert(ssl->cert, x));
@@ -94,12 +94,12 @@ SSL_use_certificate_file(SSL *ssl, const char *file, int type)
94 94
95 in = BIO_new(BIO_s_file_internal()); 95 in = BIO_new(BIO_s_file_internal());
96 if (in == NULL) { 96 if (in == NULL) {
97 SSLerr(SSL_F_SSL_USE_CERTIFICATE_FILE, ERR_R_BUF_LIB); 97 SSLerror(ERR_R_BUF_LIB);
98 goto end; 98 goto end;
99 } 99 }
100 100
101 if (BIO_read_filename(in, file) <= 0) { 101 if (BIO_read_filename(in, file) <= 0) {
102 SSLerr(SSL_F_SSL_USE_CERTIFICATE_FILE, ERR_R_SYS_LIB); 102 SSLerror(ERR_R_SYS_LIB);
103 goto end; 103 goto end;
104 } 104 }
105 if (type == SSL_FILETYPE_ASN1) { 105 if (type == SSL_FILETYPE_ASN1) {
@@ -111,12 +111,12 @@ SSL_use_certificate_file(SSL *ssl, const char *file, int type)
111 ssl->ctx->default_passwd_callback, 111 ssl->ctx->default_passwd_callback,
112 ssl->ctx->default_passwd_callback_userdata); 112 ssl->ctx->default_passwd_callback_userdata);
113 } else { 113 } else {
114 SSLerr(SSL_F_SSL_USE_CERTIFICATE_FILE, SSL_R_BAD_SSL_FILETYPE); 114 SSLerror(SSL_R_BAD_SSL_FILETYPE);
115 goto end; 115 goto end;
116 } 116 }
117 117
118 if (x == NULL) { 118 if (x == NULL) {
119 SSLerr(SSL_F_SSL_USE_CERTIFICATE_FILE, j); 119 SSLerror(j);
120 goto end; 120 goto end;
121 } 121 }
122 122
@@ -135,7 +135,7 @@ SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len)
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 SSLerr(SSL_F_SSL_USE_CERTIFICATE_ASN1, ERR_R_ASN1_LIB); 138 SSLerror(ERR_R_ASN1_LIB);
139 return (0); 139 return (0);
140 } 140 }
141 141
@@ -151,15 +151,15 @@ SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa)
151 int ret; 151 int ret;
152 152
153 if (rsa == NULL) { 153 if (rsa == NULL) {
154 SSLerr(SSL_F_SSL_USE_RSAPRIVATEKEY, ERR_R_PASSED_NULL_PARAMETER); 154 SSLerror(ERR_R_PASSED_NULL_PARAMETER);
155 return (0); 155 return (0);
156 } 156 }
157 if (!ssl_cert_inst(&ssl->cert)) { 157 if (!ssl_cert_inst(&ssl->cert)) {
158 SSLerr(SSL_F_SSL_USE_RSAPRIVATEKEY, ERR_R_MALLOC_FAILURE); 158 SSLerror(ERR_R_MALLOC_FAILURE);
159 return (0); 159 return (0);
160 } 160 }
161 if ((pkey = EVP_PKEY_new()) == NULL) { 161 if ((pkey = EVP_PKEY_new()) == NULL) {
162 SSLerr(SSL_F_SSL_USE_RSAPRIVATEKEY, ERR_R_EVP_LIB); 162 SSLerror(ERR_R_EVP_LIB);
163 return (0); 163 return (0);
164 } 164 }
165 165
@@ -178,7 +178,7 @@ ssl_set_pkey(CERT *c, EVP_PKEY *pkey)
178 178
179 i = ssl_cert_type(NULL, pkey); 179 i = ssl_cert_type(NULL, pkey);
180 if (i < 0) { 180 if (i < 0) {
181 SSLerr(SSL_F_SSL_SET_PKEY, SSL_R_UNKNOWN_CERTIFICATE_TYPE); 181 SSLerror(SSL_R_UNKNOWN_CERTIFICATE_TYPE);
182 return (0); 182 return (0);
183 } 183 }
184 184
@@ -222,12 +222,12 @@ SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type)
222 222
223 in = BIO_new(BIO_s_file_internal()); 223 in = BIO_new(BIO_s_file_internal());
224 if (in == NULL) { 224 if (in == NULL) {
225 SSLerr(SSL_F_SSL_USE_RSAPRIVATEKEY_FILE, ERR_R_BUF_LIB); 225 SSLerror(ERR_R_BUF_LIB);
226 goto end; 226 goto end;
227 } 227 }
228 228
229 if (BIO_read_filename(in, file) <= 0) { 229 if (BIO_read_filename(in, file) <= 0) {
230 SSLerr(SSL_F_SSL_USE_RSAPRIVATEKEY_FILE, ERR_R_SYS_LIB); 230 SSLerror(ERR_R_SYS_LIB);
231 goto end; 231 goto end;
232 } 232 }
233 if (type == SSL_FILETYPE_ASN1) { 233 if (type == SSL_FILETYPE_ASN1) {
@@ -239,11 +239,11 @@ SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type)
239 ssl->ctx->default_passwd_callback, 239 ssl->ctx->default_passwd_callback,
240 ssl->ctx->default_passwd_callback_userdata); 240 ssl->ctx->default_passwd_callback_userdata);
241 } else { 241 } else {
242 SSLerr(SSL_F_SSL_USE_RSAPRIVATEKEY_FILE, SSL_R_BAD_SSL_FILETYPE); 242 SSLerror(SSL_R_BAD_SSL_FILETYPE);
243 goto end; 243 goto end;
244 } 244 }
245 if (rsa == NULL) { 245 if (rsa == NULL) {
246 SSLerr(SSL_F_SSL_USE_RSAPRIVATEKEY_FILE, j); 246 SSLerror(j);
247 goto end; 247 goto end;
248 } 248 }
249 ret = SSL_use_RSAPrivateKey(ssl, rsa); 249 ret = SSL_use_RSAPrivateKey(ssl, rsa);
@@ -262,7 +262,7 @@ SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len)
262 262
263 p = d; 263 p = d;
264 if ((rsa = d2i_RSAPrivateKey(NULL, &p,(long)len)) == NULL) { 264 if ((rsa = d2i_RSAPrivateKey(NULL, &p,(long)len)) == NULL) {
265 SSLerr(SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1, ERR_R_ASN1_LIB); 265 SSLerror(ERR_R_ASN1_LIB);
266 return (0); 266 return (0);
267 } 267 }
268 268
@@ -277,11 +277,11 @@ SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey)
277 int ret; 277 int ret;
278 278
279 if (pkey == NULL) { 279 if (pkey == NULL) {
280 SSLerr(SSL_F_SSL_USE_PRIVATEKEY, ERR_R_PASSED_NULL_PARAMETER); 280 SSLerror(ERR_R_PASSED_NULL_PARAMETER);
281 return (0); 281 return (0);
282 } 282 }
283 if (!ssl_cert_inst(&ssl->cert)) { 283 if (!ssl_cert_inst(&ssl->cert)) {
284 SSLerr(SSL_F_SSL_USE_PRIVATEKEY, ERR_R_MALLOC_FAILURE); 284 SSLerror(ERR_R_MALLOC_FAILURE);
285 return (0); 285 return (0);
286 } 286 }
287 ret = ssl_set_pkey(ssl->cert, pkey); 287 ret = ssl_set_pkey(ssl->cert, pkey);
@@ -297,12 +297,12 @@ SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type)
297 297
298 in = BIO_new(BIO_s_file_internal()); 298 in = BIO_new(BIO_s_file_internal());
299 if (in == NULL) { 299 if (in == NULL) {
300 SSLerr(SSL_F_SSL_USE_PRIVATEKEY_FILE, ERR_R_BUF_LIB); 300 SSLerror(ERR_R_BUF_LIB);
301 goto end; 301 goto end;
302 } 302 }
303 303
304 if (BIO_read_filename(in, file) <= 0) { 304 if (BIO_read_filename(in, file) <= 0) {
305 SSLerr(SSL_F_SSL_USE_PRIVATEKEY_FILE, ERR_R_SYS_LIB); 305 SSLerror(ERR_R_SYS_LIB);
306 goto end; 306 goto end;
307 } 307 }
308 if (type == SSL_FILETYPE_PEM) { 308 if (type == SSL_FILETYPE_PEM) {
@@ -314,11 +314,11 @@ SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type)
314 j = ERR_R_ASN1_LIB; 314 j = ERR_R_ASN1_LIB;
315 pkey = d2i_PrivateKey_bio(in, NULL); 315 pkey = d2i_PrivateKey_bio(in, NULL);
316 } else { 316 } else {
317 SSLerr(SSL_F_SSL_USE_PRIVATEKEY_FILE, SSL_R_BAD_SSL_FILETYPE); 317 SSLerror(SSL_R_BAD_SSL_FILETYPE);
318 goto end; 318 goto end;
319 } 319 }
320 if (pkey == NULL) { 320 if (pkey == NULL) {
321 SSLerr(SSL_F_SSL_USE_PRIVATEKEY_FILE, j); 321 SSLerror(j);
322 goto end; 322 goto end;
323 } 323 }
324 ret = SSL_use_PrivateKey(ssl, pkey); 324 ret = SSL_use_PrivateKey(ssl, pkey);
@@ -337,7 +337,7 @@ SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const unsigned char *d, long len)
337 337
338 p = d; 338 p = d;
339 if ((pkey = d2i_PrivateKey(type, NULL, &p,(long)len)) == NULL) { 339 if ((pkey = d2i_PrivateKey(type, NULL, &p,(long)len)) == NULL) {
340 SSLerr(SSL_F_SSL_USE_PRIVATEKEY_ASN1, ERR_R_ASN1_LIB); 340 SSLerror(ERR_R_ASN1_LIB);
341 return (0); 341 return (0);
342 } 342 }
343 343
@@ -350,11 +350,11 @@ int
350SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) 350SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x)
351{ 351{
352 if (x == NULL) { 352 if (x == NULL) {
353 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE, ERR_R_PASSED_NULL_PARAMETER); 353 SSLerror(ERR_R_PASSED_NULL_PARAMETER);
354 return (0); 354 return (0);
355 } 355 }
356 if (!ssl_cert_inst(&ctx->internal->cert)) { 356 if (!ssl_cert_inst(&ctx->internal->cert)) {
357 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE, ERR_R_MALLOC_FAILURE); 357 SSLerror(ERR_R_MALLOC_FAILURE);
358 return (0); 358 return (0);
359 } 359 }
360 return (ssl_set_cert(ctx->internal->cert, x)); 360 return (ssl_set_cert(ctx->internal->cert, x));
@@ -368,13 +368,13 @@ ssl_set_cert(CERT *c, X509 *x)
368 368
369 pkey = X509_get_pubkey(x); 369 pkey = X509_get_pubkey(x);
370 if (pkey == NULL) { 370 if (pkey == NULL) {
371 SSLerr(SSL_F_SSL_SET_CERT, SSL_R_X509_LIB); 371 SSLerror(SSL_R_X509_LIB);
372 return (0); 372 return (0);
373 } 373 }
374 374
375 i = ssl_cert_type(x, pkey); 375 i = ssl_cert_type(x, pkey);
376 if (i < 0) { 376 if (i < 0) {
377 SSLerr(SSL_F_SSL_SET_CERT, SSL_R_UNKNOWN_CERTIFICATE_TYPE); 377 SSLerror(SSL_R_UNKNOWN_CERTIFICATE_TYPE);
378 EVP_PKEY_free(pkey); 378 EVP_PKEY_free(pkey);
379 return (0); 379 return (0);
380 } 380 }
@@ -427,12 +427,12 @@ SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type)
427 427
428 in = BIO_new(BIO_s_file_internal()); 428 in = BIO_new(BIO_s_file_internal());
429 if (in == NULL) { 429 if (in == NULL) {
430 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_FILE, ERR_R_BUF_LIB); 430 SSLerror(ERR_R_BUF_LIB);
431 goto end; 431 goto end;
432 } 432 }
433 433
434 if (BIO_read_filename(in, file) <= 0) { 434 if (BIO_read_filename(in, file) <= 0) {
435 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_FILE, ERR_R_SYS_LIB); 435 SSLerror(ERR_R_SYS_LIB);
436 goto end; 436 goto end;
437 } 437 }
438 if (type == SSL_FILETYPE_ASN1) { 438 if (type == SSL_FILETYPE_ASN1) {
@@ -443,12 +443,12 @@ SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type)
443 x = PEM_read_bio_X509(in, NULL, ctx->default_passwd_callback, 443 x = PEM_read_bio_X509(in, NULL, ctx->default_passwd_callback,
444 ctx->default_passwd_callback_userdata); 444 ctx->default_passwd_callback_userdata);
445 } else { 445 } else {
446 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_FILE, SSL_R_BAD_SSL_FILETYPE); 446 SSLerror(SSL_R_BAD_SSL_FILETYPE);
447 goto end; 447 goto end;
448 } 448 }
449 449
450 if (x == NULL) { 450 if (x == NULL) {
451 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_FILE, j); 451 SSLerror(j);
452 goto end; 452 goto end;
453 } 453 }
454 454
@@ -467,7 +467,7 @@ SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d)
467 467
468 x = d2i_X509(NULL, &d,(long)len); 468 x = d2i_X509(NULL, &d,(long)len);
469 if (x == NULL) { 469 if (x == NULL) {
470 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1, ERR_R_ASN1_LIB); 470 SSLerror(ERR_R_ASN1_LIB);
471 return (0); 471 return (0);
472 } 472 }
473 473
@@ -483,15 +483,15 @@ SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa)
483 EVP_PKEY *pkey; 483 EVP_PKEY *pkey;
484 484
485 if (rsa == NULL) { 485 if (rsa == NULL) {
486 SSLerr(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY, ERR_R_PASSED_NULL_PARAMETER); 486 SSLerror(ERR_R_PASSED_NULL_PARAMETER);
487 return (0); 487 return (0);
488 } 488 }
489 if (!ssl_cert_inst(&ctx->internal->cert)) { 489 if (!ssl_cert_inst(&ctx->internal->cert)) {
490 SSLerr(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY, ERR_R_MALLOC_FAILURE); 490 SSLerror(ERR_R_MALLOC_FAILURE);
491 return (0); 491 return (0);
492 } 492 }
493 if ((pkey = EVP_PKEY_new()) == NULL) { 493 if ((pkey = EVP_PKEY_new()) == NULL) {
494 SSLerr(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY, ERR_R_EVP_LIB); 494 SSLerror(ERR_R_EVP_LIB);
495 return (0); 495 return (0);
496 } 496 }
497 497
@@ -512,12 +512,12 @@ SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type)
512 512
513 in = BIO_new(BIO_s_file_internal()); 513 in = BIO_new(BIO_s_file_internal());
514 if (in == NULL) { 514 if (in == NULL) {
515 SSLerr(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE, ERR_R_BUF_LIB); 515 SSLerror(ERR_R_BUF_LIB);
516 goto end; 516 goto end;
517 } 517 }
518 518
519 if (BIO_read_filename(in, file) <= 0) { 519 if (BIO_read_filename(in, file) <= 0) {
520 SSLerr(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE, ERR_R_SYS_LIB); 520 SSLerror(ERR_R_SYS_LIB);
521 goto end; 521 goto end;
522 } 522 }
523 if (type == SSL_FILETYPE_ASN1) { 523 if (type == SSL_FILETYPE_ASN1) {
@@ -529,11 +529,11 @@ SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type)
529 ctx->default_passwd_callback, 529 ctx->default_passwd_callback,
530 ctx->default_passwd_callback_userdata); 530 ctx->default_passwd_callback_userdata);
531 } else { 531 } else {
532 SSLerr(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE, SSL_R_BAD_SSL_FILETYPE); 532 SSLerror(SSL_R_BAD_SSL_FILETYPE);
533 goto end; 533 goto end;
534 } 534 }
535 if (rsa == NULL) { 535 if (rsa == NULL) {
536 SSLerr(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE, j); 536 SSLerror(j);
537 goto end; 537 goto end;
538 } 538 }
539 ret = SSL_CTX_use_RSAPrivateKey(ctx, rsa); 539 ret = SSL_CTX_use_RSAPrivateKey(ctx, rsa);
@@ -552,7 +552,7 @@ SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len)
552 552
553 p = d; 553 p = d;
554 if ((rsa = d2i_RSAPrivateKey(NULL, &p,(long)len)) == NULL) { 554 if ((rsa = d2i_RSAPrivateKey(NULL, &p,(long)len)) == NULL) {
555 SSLerr(SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1, ERR_R_ASN1_LIB); 555 SSLerror(ERR_R_ASN1_LIB);
556 return (0); 556 return (0);
557 } 557 }
558 558
@@ -565,12 +565,12 @@ int
565SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) 565SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey)
566{ 566{
567 if (pkey == NULL) { 567 if (pkey == NULL) {
568 SSLerr(SSL_F_SSL_CTX_USE_PRIVATEKEY, 568 SSLerror(
569 ERR_R_PASSED_NULL_PARAMETER); 569 ERR_R_PASSED_NULL_PARAMETER);
570 return (0); 570 return (0);
571 } 571 }
572 if (!ssl_cert_inst(&ctx->internal->cert)) { 572 if (!ssl_cert_inst(&ctx->internal->cert)) {
573 SSLerr(SSL_F_SSL_CTX_USE_PRIVATEKEY, ERR_R_MALLOC_FAILURE); 573 SSLerror(ERR_R_MALLOC_FAILURE);
574 return (0); 574 return (0);
575 } 575 }
576 return (ssl_set_pkey(ctx->internal->cert, pkey)); 576 return (ssl_set_pkey(ctx->internal->cert, pkey));
@@ -585,12 +585,12 @@ SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type)
585 585
586 in = BIO_new(BIO_s_file_internal()); 586 in = BIO_new(BIO_s_file_internal());
587 if (in == NULL) { 587 if (in == NULL) {
588 SSLerr(SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE, ERR_R_BUF_LIB); 588 SSLerror(ERR_R_BUF_LIB);
589 goto end; 589 goto end;
590 } 590 }
591 591
592 if (BIO_read_filename(in, file) <= 0) { 592 if (BIO_read_filename(in, file) <= 0) {
593 SSLerr(SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE, ERR_R_SYS_LIB); 593 SSLerror(ERR_R_SYS_LIB);
594 goto end; 594 goto end;
595 } 595 }
596 if (type == SSL_FILETYPE_PEM) { 596 if (type == SSL_FILETYPE_PEM) {
@@ -602,12 +602,12 @@ SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type)
602 j = ERR_R_ASN1_LIB; 602 j = ERR_R_ASN1_LIB;
603 pkey = d2i_PrivateKey_bio(in, NULL); 603 pkey = d2i_PrivateKey_bio(in, NULL);
604 } else { 604 } else {
605 SSLerr(SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE, 605 SSLerror(
606 SSL_R_BAD_SSL_FILETYPE); 606 SSL_R_BAD_SSL_FILETYPE);
607 goto end; 607 goto end;
608 } 608 }
609 if (pkey == NULL) { 609 if (pkey == NULL) {
610 SSLerr(SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE, j); 610 SSLerror(j);
611 goto end; 611 goto end;
612 } 612 }
613 ret = SSL_CTX_use_PrivateKey(ctx, pkey); 613 ret = SSL_CTX_use_PrivateKey(ctx, pkey);
@@ -627,7 +627,7 @@ SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, const unsigned char *d,
627 627
628 p = d; 628 p = d;
629 if ((pkey = d2i_PrivateKey(type, NULL, &p,(long)len)) == NULL) { 629 if ((pkey = d2i_PrivateKey(type, NULL, &p,(long)len)) == NULL) {
630 SSLerr(SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1, ERR_R_ASN1_LIB); 630 SSLerror(ERR_R_ASN1_LIB);
631 return (0); 631 return (0);
632 } 632 }
633 633
@@ -653,7 +653,7 @@ ssl_ctx_use_certificate_chain_bio(SSL_CTX *ctx, BIO *in)
653 x = PEM_read_bio_X509_AUX(in, NULL, ctx->default_passwd_callback, 653 x = PEM_read_bio_X509_AUX(in, NULL, ctx->default_passwd_callback,
654 ctx->default_passwd_callback_userdata); 654 ctx->default_passwd_callback_userdata);
655 if (x == NULL) { 655 if (x == NULL) {
656 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE, ERR_R_PEM_LIB); 656 SSLerror(ERR_R_PEM_LIB);
657 goto end; 657 goto end;
658 } 658 }
659 659
@@ -713,12 +713,12 @@ SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file)
713 713
714 in = BIO_new(BIO_s_file_internal()); 714 in = BIO_new(BIO_s_file_internal());
715 if (in == NULL) { 715 if (in == NULL) {
716 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE, ERR_R_BUF_LIB); 716 SSLerror(ERR_R_BUF_LIB);
717 goto end; 717 goto end;
718 } 718 }
719 719
720 if (BIO_read_filename(in, file) <= 0) { 720 if (BIO_read_filename(in, file) <= 0) {
721 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE, ERR_R_SYS_LIB); 721 SSLerror(ERR_R_SYS_LIB);
722 goto end; 722 goto end;
723 } 723 }
724 724
@@ -737,7 +737,7 @@ SSL_CTX_use_certificate_chain_mem(SSL_CTX *ctx, void *buf, int len)
737 737
738 in = BIO_new_mem_buf(buf, len); 738 in = BIO_new_mem_buf(buf, len);
739 if (in == NULL) { 739 if (in == NULL) {
740 SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE, ERR_R_BUF_LIB); 740 SSLerror(ERR_R_BUF_LIB);
741 goto end; 741 goto end;
742 } 742 }
743 743