diff options
author | 2019-03-25 17:21:18 +0000 | |
---|---|---|
committer | 2019-03-25 17:21:18 +0000 | |
commit | 96b13b45524b5752bdf903f51661790288f40746 (patch) | |
tree | d2d95e01a29dad12804e56b06ea8005958cd61ee /lib/libssl/ssl_lib.c | |
parent | Rework ssl_ctx_use_certificate_chain_bio() to use the CERT_PKEY chain. (diff) | |
download | wireguard-openbsd-96b13b45524b5752bdf903f51661790288f40746.tar.xz wireguard-openbsd-96b13b45524b5752bdf903f51661790288f40746.zip |
Defer sigalgs selection until the certificate is known.
Previously the signature algorithm was selected when the TLS extension was
parsed (or the client received a certificate request), however the actual
certificate to be used is not known at this stage. This leads to various
problems, including the selection of a signature algorithm that cannot be
used with the certificate key size (as found by jeremy@ via ruby regress).
Instead, store the signature algorithms list and only select a signature
algorithm when we're ready to do signature generation.
Joint work with beck@.
Diffstat (limited to 'lib/libssl/ssl_lib.c')
-rw-r--r-- | lib/libssl/ssl_lib.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index 52ede46f7e2..70a4c6d16ff 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_lib.c,v 1.202 2019/03/25 16:37:52 jsing Exp $ */ +/* $OpenBSD: ssl_lib.c,v 1.203 2019/03/25 17:21:18 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -2120,18 +2120,7 @@ ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher, const EVP_MD **pmd, } pkey = c->pkeys[idx].privatekey; - sigalg = c->pkeys[idx].sigalg; - if (!SSL_USE_SIGALGS(s)) { - if (pkey->type == EVP_PKEY_RSA) { - sigalg = ssl_sigalg_lookup(SIGALG_RSA_PKCS1_MD5_SHA1); - } else if (pkey->type == EVP_PKEY_EC) { - sigalg = ssl_sigalg_lookup(SIGALG_ECDSA_SHA1); - } else { - SSLerror(s, SSL_R_UNKNOWN_PKEY_TYPE); - return (NULL); - } - } - if (sigalg == NULL) { + if ((sigalg = ssl_sigalg_select(s, pkey)) == NULL) { SSLerror(s, SSL_R_SIGNATURE_ALGORITHMS_ERROR); return (NULL); } |