]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ossl_shim: add deprecation guards around the -use-ticket-callback option.
authorPauli <paul.dale@oracle.com>
Sun, 24 May 2020 22:40:20 +0000 (08:40 +1000)
committerPauli <paul.dale@oracle.com>
Mon, 25 May 2020 23:01:44 +0000 (09:01 +1000)
The ticket callback is deprecated in 3.0 and can't be used in a no-deprecated
build.

[extended tests]

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/11944)

test/ossl_shim/ossl_shim.cc
test/ossl_shim/test_config.cc
test/ossl_shim/test_config.h

index ea1ff3a983460d3fe8460b0e33a59a2b367e6531..0bdf5dd451c0a7716c3eadf696e04d936f37ac3f 100644 (file)
@@ -7,6 +7,11 @@
  * https://www.openssl.org/source/license.html
  */
 
+/*
+ * HMAC low level APIs are deprecated for public use but might be used here.
+ */
+#define OPENSSL_SUPPRESS_DEPRECATED
+
 #if !defined(__STDC_FORMAT_MACROS)
 #define __STDC_FORMAT_MACROS
 #endif
@@ -369,6 +374,7 @@ static int NewSessionCallback(SSL *ssl, SSL_SESSION *session) {
   return 1;
 }
 
+#ifndef OPENSSL_NO_DEPRECATED_3_0
 static int TicketKeyCallback(SSL *ssl, uint8_t *key_name, uint8_t *iv,
                              EVP_CIPHER_CTX *ctx, HMAC_CTX *hmac_ctx,
                              int encrypt) {
@@ -401,6 +407,7 @@ static int TicketKeyCallback(SSL *ssl, uint8_t *key_name, uint8_t *iv,
   }
   return 1;
 }
+#endif
 
 // kCustomExtensionValue is the extension value that the custom extension
 // callbacks will add.
@@ -624,9 +631,11 @@ static bssl::UniquePtr<SSL_CTX> SetupCtx(const TestConfig *config) {
   SSL_CTX_set_info_callback(ssl_ctx.get(), InfoCallback);
   SSL_CTX_sess_set_new_cb(ssl_ctx.get(), NewSessionCallback);
 
+#ifndef OPENSSL_NO_DEPRECATED_3_0
   if (config->use_ticket_callback) {
     SSL_CTX_set_tlsext_ticket_key_cb(ssl_ctx.get(), TicketKeyCallback);
   }
+#endif
 
   if (config->enable_client_custom_extension &&
       !SSL_CTX_add_client_custom_ext(
index a37d010d7a7a74529c4bcea97aef94e3c80249b8..b1a3fa392012826bdb0b6a708b588bed619eb494 100644 (file)
@@ -63,7 +63,9 @@ const Flag<bool> kBoolFlags[] = {
   { "-use-export-context", &TestConfig::use_export_context },
   { "-expect-ticket-renewal", &TestConfig::expect_ticket_renewal },
   { "-expect-no-session", &TestConfig::expect_no_session },
+#ifndef OPENSSL_NO_DEPRECATED_3_0
   { "-use-ticket-callback", &TestConfig::use_ticket_callback },
+#endif
   { "-renew-ticket", &TestConfig::renew_ticket },
   { "-enable-client-custom-extension",
     &TestConfig::enable_client_custom_extension },
index 83677df52b90177348ca012e6cbecd98fb9e75d5..653554d995245bc8ac06a8687309fb67c17971af 100644 (file)
@@ -13,6 +13,8 @@
 #include <string>
 #include <vector>
 
+#include <openssl/configuration.h>
+
 
 struct TestConfig {
   int port = 0;
@@ -60,7 +62,9 @@ struct TestConfig {
   bool use_export_context = false;
   bool expect_ticket_renewal = false;
   bool expect_no_session = false;
+#ifndef OPENSSL_NO_DEPRECATED_3_0
   bool use_ticket_callback = false;
+#endif
   bool renew_ticket = false;
   bool enable_client_custom_extension = false;
   bool enable_server_custom_extension = false;