From e203d1b542eba8dd7ae53b3def2abf8482acc4d8 Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Mon, 22 Jan 2024 13:14:53 +0000 Subject: [PATCH] QUIC: Add new error codes for tuning API Reviewed-by: Neil Horman Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/23360) --- crypto/err/openssl.txt | 5 +++++ include/openssl/sslerr.h | 5 +++++ ssl/ssl_err.c | 10 ++++++++++ ssl/ssl_lib.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+) diff --git a/crypto/err/openssl.txt b/crypto/err/openssl.txt index a20c136114..9ae34200b6 100644 --- a/crypto/err/openssl.txt +++ b/crypto/err/openssl.txt @@ -1401,6 +1401,8 @@ SSL_R_EXTRA_DATA_IN_MESSAGE:153:extra data in message SSL_R_EXT_LENGTH_MISMATCH:163:ext length mismatch SSL_R_FAILED_TO_GET_PARAMETER:316:failed to get parameter SSL_R_FAILED_TO_INIT_ASYNC:405:failed to init async +SSL_R_FEATURE_NEGOTIATION_NOT_COMPLETE:412:feature negotiation not complete +SSL_R_FEATURE_NOT_RENEGOTIABLE:413:feature not renegotiable SSL_R_FRAGMENTED_CLIENT_HELLO:401:fragmented client hello SSL_R_GOT_A_FIN_BEFORE_A_CCS:154:got a fin before a ccs SSL_R_HTTPS_PROXY_REQUEST:155:https proxy request @@ -1634,6 +1636,9 @@ SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED:338:\ unsafe legacy renegotiation disabled SSL_R_UNSOLICITED_EXTENSION:217:unsolicited extension SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM:257:unsupported compression algorithm +SSL_R_UNSUPPORTED_CONFIG_VALUE:414:unsupported config value +SSL_R_UNSUPPORTED_CONFIG_VALUE_CLASS:415:unsupported config value class +SSL_R_UNSUPPORTED_CONFIG_VALUE_OP:416:unsupported config value op SSL_R_UNSUPPORTED_ELLIPTIC_CURVE:315:unsupported elliptic curve SSL_R_UNSUPPORTED_PROTOCOL:258:unsupported protocol SSL_R_UNSUPPORTED_SSL_VERSION:259:unsupported ssl version diff --git a/include/openssl/sslerr.h b/include/openssl/sslerr.h index 478d64e291..c9e3a02f43 100644 --- a/include/openssl/sslerr.h +++ b/include/openssl/sslerr.h @@ -125,6 +125,8 @@ # define SSL_R_EXT_LENGTH_MISMATCH 163 # define SSL_R_FAILED_TO_GET_PARAMETER 316 # define SSL_R_FAILED_TO_INIT_ASYNC 405 +# define SSL_R_FEATURE_NEGOTIATION_NOT_COMPLETE 412 +# define SSL_R_FEATURE_NOT_RENEGOTIABLE 413 # define SSL_R_FRAGMENTED_CLIENT_HELLO 401 # define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 # define SSL_R_HTTPS_PROXY_REQUEST 155 @@ -346,6 +348,9 @@ # define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 # define SSL_R_UNSOLICITED_EXTENSION 217 # define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 +# define SSL_R_UNSUPPORTED_CONFIG_VALUE 414 +# define SSL_R_UNSUPPORTED_CONFIG_VALUE_CLASS 415 +# define SSL_R_UNSUPPORTED_CONFIG_VALUE_OP 416 # define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 # define SSL_R_UNSUPPORTED_PROTOCOL 258 # define SSL_R_UNSUPPORTED_SSL_VERSION 259 diff --git a/ssl/ssl_err.c b/ssl/ssl_err.c index 41af278a49..a1ce627456 100644 --- a/ssl/ssl_err.c +++ b/ssl/ssl_err.c @@ -180,6 +180,10 @@ static const ERR_STRING_DATA SSL_str_reasons[] = { "failed to get parameter"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_FAILED_TO_INIT_ASYNC), "failed to init async"}, + {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_FEATURE_NEGOTIATION_NOT_COMPLETE), + "feature negotiation not complete"}, + {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_FEATURE_NOT_RENEGOTIABLE), + "feature not renegotiable"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_FRAGMENTED_CLIENT_HELLO), "fragmented client hello"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_GOT_A_FIN_BEFORE_A_CCS), @@ -564,6 +568,12 @@ static const ERR_STRING_DATA SSL_str_reasons[] = { "unsolicited extension"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM), "unsupported compression algorithm"}, + {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNSUPPORTED_CONFIG_VALUE), + "unsupported config value"}, + {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNSUPPORTED_CONFIG_VALUE_CLASS), + "unsupported config value class"}, + {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNSUPPORTED_CONFIG_VALUE_OP), + "unsupported config value op"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE), "unsupported elliptic curve"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNSUPPORTED_PROTOCOL), diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 6788d2c104..539d8568f7 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -7636,6 +7636,35 @@ int SSL_get_conn_close_info(SSL *s, SSL_CONN_CLOSE_INFO *info, #endif } +int SSL_get_value_uint(SSL *s, uint32_t class_, uint32_t id, + uint64_t *value) +{ + if (value == NULL) { + ERR_raise(ERR_LIB_SSL, ERR_R_PASSED_INVALID_ARGUMENT); + return 0; + } + +#ifndef OPENSSL_NO_QUIC + if (IS_QUIC(s)) + return ossl_quic_get_value_uint(s, class_, id, value); +#endif + + ERR_raise(ERR_LIB_SSL, SSL_R_UNSUPPORTED_PROTOCOL); + return 0; +} + +int SSL_set_value_uint(SSL *s, uint32_t class_, uint32_t id, + uint64_t value) +{ +#ifndef OPENSSL_NO_QUIC + if (IS_QUIC(s)) + return ossl_quic_set_value_uint(s, class_, id, value); +#endif + + ERR_raise(ERR_LIB_SSL, SSL_R_UNSUPPORTED_PROTOCOL); + return 0; +} + int SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk) { unsigned char *data = NULL; -- 2.39.2