Skip to content
This repository was archived by the owner on Oct 29, 2021. It is now read-only.

Commit 1175a41

Browse files
committed
Merge remote-tracking branch 'jelly/openssl1.1' into openssl1.1
2 parents a34397d + 5ab52ed commit 1175a41

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/tls_openssl.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,15 @@ static struct _tlscert_t *_x509_to_tlscert(xmpp_ctx_t *ctx, X509 *cert)
168168
}
169169

170170
tlscert->keyalg = NULL;
171+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
171172
int alg_nid = OBJ_obj2nid(cert->cert_info->key->algor->algorithm);
173+
#else
174+
X509_PUBKEY *pubkey = X509_get_X509_PUBKEY(cert);
175+
ASN1_OBJECT *ppkalg;
176+
// FIXME: handle 0 on error.
177+
X509_PUBKEY_get0_param(&ppkalg, NULL, NULL, NULL, NULL);
178+
int alg_nid = OBJ_obj2nid(ppkalg);
179+
#endif
172180
if (alg_nid != NID_undef) {
173181
const char* keyalg = OBJ_nid2ln(alg_nid);
174182
if (keyalg) {
@@ -177,7 +185,13 @@ static struct _tlscert_t *_x509_to_tlscert(xmpp_ctx_t *ctx, X509 *cert)
177185
}
178186

179187
tlscert->sigalg = NULL;
188+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
180189
alg_nid = OBJ_obj2nid(cert->sig_alg->algorithm);
190+
#else
191+
const X509_ALGOR *palg;
192+
X509_get0_signature(NULL, &palg, cert);
193+
alg_nid = OBJ_obj2nid(palg->algorithm);
194+
#endif
181195
if (alg_nid != NID_undef) {
182196
const char* sigalg = OBJ_nid2ln(alg_nid);
183197
if (sigalg) {
@@ -255,6 +269,8 @@ tls_t *tls_new(xmpp_ctx_t *ctx, sock_t sock, xmpp_certfail_handler certfail_hand
255269
_last_cb_res = 0;
256270
tls_t *tls = xmpp_alloc(ctx, sizeof(*tls));
257271

272+
xmpp_debug(ctx, "TLS", "OpenSSL version: %s", SSLeay_version(SSLEAY_VERSION));
273+
258274
if (tls) {
259275
int ret;
260276
memset(tls, 0, sizeof(*tls));

0 commit comments

Comments
 (0)