diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2017-02-24 20:43:02 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2017-02-24 23:52:23 +0000 |
commit | e892e3255858b6b8bb79bee9972aa9700a38903b (patch) | |
tree | b1c9ca9a3b70c58ccdc857656d65996a52590001 /ssl/t1_lib.c | |
parent | d09e903a8600c8ea6ea8e3b48297272f08ee4b3c (diff) | |
download | openssl-e892e3255858b6b8bb79bee9972aa9700a38903b.zip openssl-e892e3255858b6b8bb79bee9972aa9700a38903b.tar.gz openssl-e892e3255858b6b8bb79bee9972aa9700a38903b.tar.bz2 |
Reject compressed point format with TLS 1.3
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2739)
Diffstat (limited to 'ssl/t1_lib.c')
-rw-r--r-- | ssl/t1_lib.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 100c97c..a7b4679 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -916,8 +916,12 @@ int tls12_check_peer_sigalg(SSL *s, uint16_t sig, EVP_PKEY *pkey) int curve = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); if (SSL_IS_TLS13(s)) { + if (EC_KEY_get_conv_form(ec) != POINT_CONVERSION_UNCOMPRESSED) { + SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, + SSL_R_ILLEGAL_POINT_COMPRESSION); + return 0; + } /* For TLS 1.3 check curve matches signature algorithm */ - if (lu->curve != NID_undef && curve != lu->curve) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_CURVE); return 0; @@ -2237,7 +2241,7 @@ int tls_choose_sigalg(SSL *s, int *al) if (SSL_IS_TLS13(s)) { size_t i; #ifndef OPENSSL_NO_EC - int curve = -1; + int curve = -1, skip_ec = 0; #endif /* Look for a certificate matching shared sigaglgs */ @@ -2258,8 +2262,11 @@ int tls_choose_sigalg(SSL *s, int *al) EC_KEY *ec = EVP_PKEY_get0_EC_KEY(s->cert->pkeys[idx].privatekey); curve = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); + if (EC_KEY_get_conv_form(ec) + != POINT_CONVERSION_UNCOMPRESSED) + skip_ec = 1; } - if (lu->curve != NID_undef && curve != lu->curve) + if (skip_ec || (lu->curve != NID_undef && curve != lu->curve)) continue; #else continue; |