cipher_overhead_test.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2016 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 "e_os.h"
  10. #include "testutil.h"
  11. #ifdef __VMS
  12. # pragma names save
  13. # pragma names as_is,shortened
  14. #endif
  15. #include "../ssl/ssl_locl.h"
  16. #ifdef __VMS
  17. # pragma names restore
  18. #endif
  19. static int cipher_overhead(void)
  20. {
  21. int ret = 1, i, n = ssl3_num_ciphers();
  22. const SSL_CIPHER *ciph;
  23. size_t mac, in, blk, ex;
  24. for (i = 0; i < n; i++) {
  25. ciph = ssl3_get_cipher(i);
  26. if (!ciph->min_dtls)
  27. continue;
  28. if (!TEST_true(ssl_cipher_get_overhead(ciph, &mac, &in, &blk, &ex))) {
  29. TEST_info("Failed getting %s", ciph->name);
  30. ret = 0;
  31. } else {
  32. TEST_info("Cipher %s: %zu %zu %zu %zu",
  33. ciph->name, mac, in, blk, ex);
  34. }
  35. }
  36. return ret;
  37. }
  38. void register_tests(void)
  39. {
  40. ADD_TEST(cipher_overhead);
  41. }