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