/*
- * Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2017 BaishanCloud. All rights reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
#include "testutil.h"
#include "internal/nelem.h"
-#include "ssltestlib.h"
+#include "helpers/ssltestlib.h"
#define CLIENT_VERSION_LEN 2
static char *cert = NULL;
static char *privkey = NULL;
+#if defined(OPENSSL_NO_TLS1_3) || \
+ (defined(OPENSSL_NO_EC) && defined(OPENSSL_NO_DH))
+static int maxversion = TLS1_2_VERSION;
+#else
+static int maxversion = 0;
+#endif
+
static int get_sni_from_client_hello(BIO *bio, char **sni)
{
long len;
if (!TEST_ptr(ctx))
goto end;
+ if (maxversion > 0
+ && !TEST_true(SSL_CTX_set_max_proto_version(ctx, maxversion)))
+ goto end;
+
con = SSL_new(ctx);
if (!TEST_ptr(con))
goto end;
if (!TEST_ptr(ctx))
goto end;
+ if (maxversion > 0
+ && !TEST_true(SSL_CTX_set_max_proto_version(ctx, maxversion)))
+ goto end;
+
con = SSL_new(ctx);
if (!TEST_ptr(con))
goto end;