summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_both.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_both.c')
-rw-r--r--src/lib/libssl/ssl_both.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/lib/libssl/ssl_both.c b/src/lib/libssl/ssl_both.c
index 9894648db8..ad16d2175b 100644
--- a/src/lib/libssl/ssl_both.c
+++ b/src/lib/libssl/ssl_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_both.c,v 1.40 2022/01/08 12:43:44 jsing Exp $ */ 1/* $OpenBSD: ssl_both.c,v 1.41 2022/02/03 16:33:12 jsing 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 *
@@ -522,32 +522,22 @@ ssl3_get_message(SSL *s, int st1, int stn, int mt, long max)
522} 522}
523 523
524int 524int
525ssl_cert_type(X509 *x, EVP_PKEY *pkey) 525ssl_cert_type(EVP_PKEY *pkey)
526{ 526{
527 EVP_PKEY *pk;
528 int ret = -1, i;
529
530 if (pkey == NULL) 527 if (pkey == NULL)
531 pk = X509_get_pubkey(x); 528 return -1;
532 else 529
533 pk = pkey; 530 switch (EVP_PKEY_id(pkey)) {
534 if (pk == NULL) 531 case EVP_PKEY_EC:
535 goto err; 532 return SSL_PKEY_ECC;
536 533 case NID_id_GostR3410_2001:
537 i = EVP_PKEY_id(pk); 534 case NID_id_GostR3410_2001_cc:
538 if (i == EVP_PKEY_RSA) { 535 return SSL_PKEY_GOST01;
539 ret = SSL_PKEY_RSA; 536 case EVP_PKEY_RSA:
540 } else if (i == EVP_PKEY_EC) { 537 return SSL_PKEY_RSA;
541 ret = SSL_PKEY_ECC;
542 } else if (i == NID_id_GostR3410_2001 ||
543 i == NID_id_GostR3410_2001_cc) {
544 ret = SSL_PKEY_GOST01;
545 } 538 }
546 539
547 err: 540 return -1;
548 if (!pkey)
549 EVP_PKEY_free(pk);
550 return (ret);
551} 541}
552 542
553int 543int