sysdefaulttest.c 1.1 KB

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