mirror of
https://github.com/irssi/irssi.git
synced 2025-04-25 12:31:09 -05:00
Merge pull request #1519 from ailin-nemui/openssl3
deprecated openssl3 function
This commit is contained in:
commit
89f3e1acf5
@ -28,6 +28,7 @@
|
||||
#include <irssi/src/core/tls.h>
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/pem.h>
|
||||
@ -751,31 +752,35 @@ static void set_server_temporary_key_info(TLS_REC *tls, SSL *ssl)
|
||||
#ifdef SSL_get_server_tmp_key
|
||||
/* Show ephemeral key information. */
|
||||
EVP_PKEY *ephemeral_key = NULL;
|
||||
|
||||
/* OPENSSL_NO_EC is for solaris 11.3 (2016), github ticket #598 */
|
||||
#ifndef OPENSSL_NO_EC
|
||||
EC_KEY *ec_key = NULL;
|
||||
#endif
|
||||
char *ephemeral_key_algorithm = NULL;
|
||||
char *cname = NULL;
|
||||
int nid;
|
||||
|
||||
g_return_if_fail(tls != NULL);
|
||||
g_return_if_fail(ssl != NULL);
|
||||
|
||||
if (SSL_get_server_tmp_key(ssl, &ephemeral_key)) {
|
||||
switch (EVP_PKEY_id(ephemeral_key)) {
|
||||
int keytype = EVP_PKEY_id(ephemeral_key);
|
||||
switch (keytype) {
|
||||
case EVP_PKEY_DH:
|
||||
tls_rec_set_ephemeral_key_algorithm(tls, "DH");
|
||||
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
|
||||
break;
|
||||
|
||||
/* OPENSSL_NO_EC is for solaris 11.3 (2016), github ticket #598 */
|
||||
#ifndef OPENSSL_NO_EC
|
||||
case EVP_PKEY_EC:
|
||||
case EVP_PKEY_EC: {
|
||||
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
||||
char cname[50];
|
||||
EVP_PKEY_get_group_name(ephemeral_key, cname, sizeof(cname), NULL);
|
||||
#else
|
||||
EC_KEY *ec_key = NULL;
|
||||
char *cname = NULL;
|
||||
int nid;
|
||||
|
||||
ec_key = EVP_PKEY_get1_EC_KEY(ephemeral_key);
|
||||
nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key));
|
||||
EC_KEY_free(ec_key);
|
||||
cname = (char *)OBJ_nid2sn(nid);
|
||||
cname = (char *) OBJ_nid2sn(nid);
|
||||
#endif
|
||||
ephemeral_key_algorithm = g_strdup_printf("ECDH: %s", cname);
|
||||
|
||||
tls_rec_set_ephemeral_key_algorithm(tls, ephemeral_key_algorithm);
|
||||
@ -783,10 +788,11 @@ static void set_server_temporary_key_info(TLS_REC *tls, SSL *ssl)
|
||||
|
||||
g_free_and_null(ephemeral_key_algorithm);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
tls_rec_set_ephemeral_key_algorithm(tls, "Unknown");
|
||||
tls_rec_set_ephemeral_key_algorithm(tls, OBJ_nid2ln(keytype));
|
||||
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user