5ddd21c4d7414c056b385cdf2a5aa77a08decc44
[oweals/openssl.git] / test / cipher_overhead_test.c
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
10 #include "e_os.h"
11 #include "testutil.h"
12 #include "test_main.h"
13
14 #include "../ssl/ssl_locl.h"
15
16 static int cipher_overhead(void)
17 {
18     int ret = 1, i, n = ssl3_num_ciphers();
19     const SSL_CIPHER *ciph;
20     size_t mac, in, blk, ex;
21
22     for (i = 0; i < n; i++) {
23         ciph = ssl3_get_cipher(i);
24         if (!ciph->min_dtls)
25             continue;
26         if (!TEST_true(ssl_cipher_get_overhead(ciph, &mac, &in, &blk, &ex))) {
27             TEST_info("Failed getting %s", ciph->name);
28             ret = 0;
29         } else {
30             TEST_info("Cipher %s: %"OSSLzu" %"OSSLzu" %"OSSLzu" %"OSSLzu,
31                       ciph->name, mac, in, blk, ex);
32         }
33     }
34     return ret;
35 }
36
37 void register_tests(void)
38 {
39     ADD_TEST(cipher_overhead);
40 }