1*e0c4386eSCy Schubert /* 2*e0c4386eSCy Schubert * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. 3*e0c4386eSCy Schubert * 4*e0c4386eSCy Schubert * Licensed under the Apache License 2.0 (the "License"). You may not use 5*e0c4386eSCy Schubert * this file except in compliance with the License. You can obtain a copy 6*e0c4386eSCy Schubert * in the file LICENSE in the source distribution or at 7*e0c4386eSCy Schubert * https://www.openssl.org/source/license.html 8*e0c4386eSCy Schubert */ 9*e0c4386eSCy Schubert 10*e0c4386eSCy Schubert #include <stdio.h> 11*e0c4386eSCy Schubert #include <openssl/opensslconf.h> 12*e0c4386eSCy Schubert 13*e0c4386eSCy Schubert #include <string.h> 14*e0c4386eSCy Schubert #include <openssl/evp.h> 15*e0c4386eSCy Schubert #include <openssl/ssl.h> 16*e0c4386eSCy Schubert #include <openssl/tls1.h> 17*e0c4386eSCy Schubert #include "testutil.h" 18*e0c4386eSCy Schubert 19*e0c4386eSCy Schubert static SSL_CTX *ctx; 20*e0c4386eSCy Schubert test_func(void)21*e0c4386eSCy Schubertstatic int test_func(void) 22*e0c4386eSCy Schubert { 23*e0c4386eSCy Schubert if (!TEST_int_eq(SSL_CTX_get_min_proto_version(ctx), TLS1_2_VERSION) 24*e0c4386eSCy Schubert && !TEST_int_eq(SSL_CTX_get_max_proto_version(ctx), TLS1_2_VERSION)) { 25*e0c4386eSCy Schubert TEST_info("min/max version setting incorrect"); 26*e0c4386eSCy Schubert return 0; 27*e0c4386eSCy Schubert } 28*e0c4386eSCy Schubert return 1; 29*e0c4386eSCy Schubert } 30*e0c4386eSCy Schubert global_init(void)31*e0c4386eSCy Schubertint global_init(void) 32*e0c4386eSCy Schubert { 33*e0c4386eSCy Schubert if (!OPENSSL_init_ssl(OPENSSL_INIT_ENGINE_ALL_BUILTIN 34*e0c4386eSCy Schubert | OPENSSL_INIT_LOAD_CONFIG, NULL)) 35*e0c4386eSCy Schubert return 0; 36*e0c4386eSCy Schubert return 1; 37*e0c4386eSCy Schubert } 38*e0c4386eSCy Schubert setup_tests(void)39*e0c4386eSCy Schubertint setup_tests(void) 40*e0c4386eSCy Schubert { 41*e0c4386eSCy Schubert if (!TEST_ptr(ctx = SSL_CTX_new(TLS_method()))) 42*e0c4386eSCy Schubert return 0; 43*e0c4386eSCy Schubert ADD_TEST(test_func); 44*e0c4386eSCy Schubert return 1; 45*e0c4386eSCy Schubert } 46*e0c4386eSCy Schubert cleanup_tests(void)47*e0c4386eSCy Schubertvoid cleanup_tests(void) 48*e0c4386eSCy Schubert { 49*e0c4386eSCy Schubert SSL_CTX_free(ctx); 50*e0c4386eSCy Schubert } 51