cipher_overhead_test.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (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. #include "../ssl/ssl_locl.h"
  12. static int cipher_overhead(void)
  13. {
  14. int ret = 1, i, n = ssl3_num_ciphers();
  15. const SSL_CIPHER *ciph;
  16. size_t mac, in, blk, ex;
  17. for (i = 0; i < n; i++) {
  18. ciph = ssl3_get_cipher(i);
  19. if (!ciph->min_dtls)
  20. continue;
  21. if (!TEST_true(ssl_cipher_get_overhead(ciph, &mac, &in, &blk, &ex))) {
  22. TEST_info("Failed getting %s", ciph->name);
  23. ret = 0;
  24. } else {
  25. TEST_info("Cipher %s: %zu %zu %zu %zu",
  26. ciph->name, mac, in, blk, ex);
  27. }
  28. }
  29. return ret;
  30. }
  31. int setup_tests(void)
  32. {
  33. ADD_TEST(cipher_overhead);
  34. return 1;
  35. }