From 996bd6f8fa6acbcff57b334170c4c00828be5a9a Mon Sep 17 00:00:00 2001 From: tb Date: Mon, 6 Jun 2022 16:12:30 +0000 Subject: [PATCH] Use SSL3_CK_VALUE_MASK instead of hardcoded 0xffff and remove some SSLv2 remnants. ok jsing --- lib/libssl/ssl_asn1.c | 4 ++-- lib/libssl/ssl_txt.c | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/libssl/ssl_asn1.c b/lib/libssl/ssl_asn1.c index 70a50acc5c7..e0bf92d0357 100644 --- a/lib/libssl/ssl_asn1.c +++ b/lib/libssl/ssl_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_asn1.c,v 1.61 2022/01/11 18:39:28 jsing Exp $ */ +/* $OpenBSD: ssl_asn1.c,v 1.62 2022/06/06 16:12:30 tb Exp $ */ /* * Copyright (c) 2016 Joel Sing * @@ -71,7 +71,7 @@ SSL_SESSION_encode(SSL_SESSION *s, unsigned char **out, size_t *out_len, /* Cipher suite ID. */ /* XXX - require cipher to be non-NULL or always/only use cipher_id. */ - cid = (uint16_t)(s->cipher_id & 0xffff); + cid = (uint16_t)(s->cipher_id & SSL3_CK_VALUE_MASK); if (s->cipher != NULL) cid = ssl3_cipher_get_value(s->cipher); if (!CBB_add_asn1(&session, &cipher_suite, CBS_ASN1_OCTETSTRING)) diff --git a/lib/libssl/ssl_txt.c b/lib/libssl/ssl_txt.c index 09685436198..b7da7bb6b4f 100644 --- a/lib/libssl/ssl_txt.c +++ b/lib/libssl/ssl_txt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_txt.c,v 1.32 2022/06/06 15:20:54 tb Exp $ */ +/* $OpenBSD: ssl_txt.c,v 1.33 2022/06/06 16:12:31 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -121,15 +121,9 @@ SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) goto err; if (x->cipher == NULL) { - if ((x->cipher_id & 0xff000000) == 0x02000000) { - if (BIO_printf(bp, " Cipher : %06lX\n", - x->cipher_id & 0xffffff) <= 0) - goto err; - } else { - if (BIO_printf(bp, " Cipher : %04lX\n", - x->cipher_id & 0xffff) <= 0) - goto err; - } + if (BIO_printf(bp, " Cipher : %04lX\n", + x->cipher_id & SSL3_CK_VALUE_MASK) <= 0) + goto err; } else { const char *cipher_name = "unknown"; -- 2.20.1