From 3b2183cf554fb7e7387b92e40cac22c06b7fc371 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sun, 27 Jun 2021 18:09:08 +0000 Subject: Rename ssl_sigalg() to ssl_sigalg_from_value(). This makes the code more self-documenting and avoids the ambiguity between ssl_sigalg the struct and ssl_sigalg the function. ok tb@ --- lib/libssl/ssl_clnt.c | 6 +++--- lib/libssl/ssl_sigalgs.c | 6 +++--- lib/libssl/ssl_sigalgs.h | 5 +++-- lib/libssl/ssl_srvr.c | 6 +++--- lib/libssl/tls13_client.c | 6 +++--- lib/libssl/tls13_server.c | 6 +++--- 6 files changed, 18 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/libssl/ssl_clnt.c b/lib/libssl/ssl_clnt.c index be9d6878d7e..c092fe4c891 100644 --- a/lib/libssl/ssl_clnt.c +++ b/lib/libssl/ssl_clnt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_clnt.c,v 1.99 2021/05/16 14:10:43 jsing Exp $ */ +/* $OpenBSD: ssl_clnt.c,v 1.100 2021/06/27 18:09:07 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1550,8 +1550,8 @@ ssl3_get_server_key_exchange(SSL *s) if (!CBS_get_u16(&cbs, &sigalg_value)) goto decode_err; - if ((sigalg = ssl_sigalg(sigalg_value, tls12_sigalgs, - tls12_sigalgs_len)) == NULL) { + if ((sigalg = ssl_sigalg_from_value(sigalg_value, + tls12_sigalgs, tls12_sigalgs_len)) == NULL) { SSLerror(s, SSL_R_UNKNOWN_DIGEST); al = SSL_AD_DECODE_ERROR; goto fatal_err; diff --git a/lib/libssl/ssl_sigalgs.c b/lib/libssl/ssl_sigalgs.c index 590932bdf6e..8c7f6d673a6 100644 --- a/lib/libssl/ssl_sigalgs.c +++ b/lib/libssl/ssl_sigalgs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_sigalgs.c,v 1.27 2021/06/27 17:59:17 jsing Exp $ */ +/* $OpenBSD: ssl_sigalgs.c,v 1.28 2021/06/27 18:09:07 jsing Exp $ */ /* * Copyright (c) 2018-2020 Bob Beck * @@ -201,7 +201,7 @@ ssl_sigalg_lookup(uint16_t sigalg) } const struct ssl_sigalg * -ssl_sigalg(uint16_t sigalg, const uint16_t *values, size_t len) +ssl_sigalg_from_value(uint16_t sigalg, const uint16_t *values, size_t len) { int i; @@ -328,7 +328,7 @@ ssl_sigalg_select(SSL *s, EVP_PKEY *pkey) if (!CBS_get_u16(&cbs, &sig_alg)) return 0; - if ((sigalg = ssl_sigalg(sig_alg, tls_sigalgs, + if ((sigalg = ssl_sigalg_from_value(sig_alg, tls_sigalgs, tls_sigalgs_len)) == NULL) continue; diff --git a/lib/libssl/ssl_sigalgs.h b/lib/libssl/ssl_sigalgs.h index 64a2bd435c6..64cf0bb73b2 100644 --- a/lib/libssl/ssl_sigalgs.h +++ b/lib/libssl/ssl_sigalgs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_sigalgs.h,v 1.18 2021/06/27 17:59:17 jsing Exp $ */ +/* $OpenBSD: ssl_sigalgs.h,v 1.19 2021/06/27 18:09:07 jsing Exp $ */ /* * Copyright (c) 2018-2019 Bob Beck * @@ -74,7 +74,8 @@ extern const uint16_t tls13_sigalgs[]; extern const size_t tls13_sigalgs_len; const struct ssl_sigalg *ssl_sigalg_lookup(uint16_t sigalg); -const struct ssl_sigalg *ssl_sigalg(uint16_t sigalg, const uint16_t *values, size_t len); +const struct ssl_sigalg *ssl_sigalg_from_value(uint16_t sigalg, + const uint16_t *values, size_t len); int ssl_sigalgs_build(uint16_t tls_version, CBB *cbb); int ssl_sigalg_pkey_check(uint16_t sigalg, EVP_PKEY *pk); int ssl_sigalg_pkey_ok(const struct ssl_sigalg *sigalg, EVP_PKEY *pkey, diff --git a/lib/libssl/ssl_srvr.c b/lib/libssl/ssl_srvr.c index 93fd8cfb85d..201f600a3ee 100644 --- a/lib/libssl/ssl_srvr.c +++ b/lib/libssl/ssl_srvr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_srvr.c,v 1.112 2021/06/27 17:59:17 jsing Exp $ */ +/* $OpenBSD: ssl_srvr.c,v 1.113 2021/06/27 18:09:07 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -2192,8 +2192,8 @@ ssl3_get_cert_verify(SSL *s) if (!CBS_get_u16(&cbs, &sigalg_value)) goto decode_err; - if ((sigalg = ssl_sigalg(sigalg_value, tls12_sigalgs, - tls12_sigalgs_len)) == NULL || + if ((sigalg = ssl_sigalg_from_value(sigalg_value, + tls12_sigalgs, tls12_sigalgs_len)) == NULL || (md = sigalg->md()) == NULL) { SSLerror(s, SSL_R_UNKNOWN_DIGEST); al = SSL_AD_DECODE_ERROR; diff --git a/lib/libssl/tls13_client.c b/lib/libssl/tls13_client.c index e387ac8c59c..de9316e8d78 100644 --- a/lib/libssl/tls13_client.c +++ b/lib/libssl/tls13_client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_client.c,v 1.80 2021/06/08 18:13:50 tb Exp $ */ +/* $OpenBSD: tls13_client.c,v 1.81 2021/06/27 18:09:07 jsing Exp $ */ /* * Copyright (c) 2018, 2019 Joel Sing * @@ -671,8 +671,8 @@ tls13_server_certificate_verify_recv(struct tls13_ctx *ctx, CBS *cbs) if (!CBS_get_u16_length_prefixed(cbs, &signature)) goto err; - if ((sigalg = ssl_sigalg(signature_scheme, tls13_sigalgs, - tls13_sigalgs_len)) == NULL) + if ((sigalg = ssl_sigalg_from_value(signature_scheme, + tls13_sigalgs, tls13_sigalgs_len)) == NULL) goto err; if (!CBB_init(&cbb, 0)) diff --git a/lib/libssl/tls13_server.c b/lib/libssl/tls13_server.c index aab988d5327..8f47bdfa886 100644 --- a/lib/libssl/tls13_server.c +++ b/lib/libssl/tls13_server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_server.c,v 1.78 2021/06/11 11:13:53 jsing Exp $ */ +/* $OpenBSD: tls13_server.c,v 1.79 2021/06/27 18:09:07 jsing Exp $ */ /* * Copyright (c) 2019, 2020 Joel Sing * Copyright (c) 2020 Bob Beck @@ -970,8 +970,8 @@ tls13_client_certificate_verify_recv(struct tls13_ctx *ctx, CBS *cbs) if (!CBS_get_u16_length_prefixed(cbs, &signature)) goto err; - if ((sigalg = ssl_sigalg(signature_scheme, tls13_sigalgs, - tls13_sigalgs_len)) == NULL) + if ((sigalg = ssl_sigalg_from_value(signature_scheme, + tls13_sigalgs, tls13_sigalgs_len)) == NULL) goto err; if (!CBB_init(&cbb, 0)) -- cgit v1.2.3