2
0

cipher_overhead_test.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright 2016-2017 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 "internal/nelem.h"
  10. #include "testutil.h"
  11. #ifdef __VMS
  12. # pragma names save
  13. # pragma names as_is,shortened
  14. #endif
  15. #include "../ssl/ssl_local.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. int setup_tests(void)
  39. {
  40. ADD_TEST(cipher_overhead);
  41. return 1;
  42. }