xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/test/cipher_overhead_test.c (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos /*
2*4724848cSchristos  * Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
3*4724848cSchristos  *
4*4724848cSchristos  * Licensed under the OpenSSL license (the "License").  You may not use
5*4724848cSchristos  * this file except in compliance with the License.  You can obtain a copy
6*4724848cSchristos  * in the file LICENSE in the source distribution or at
7*4724848cSchristos  * https://www.openssl.org/source/license.html
8*4724848cSchristos  */
9*4724848cSchristos 
10*4724848cSchristos #include "internal/nelem.h"
11*4724848cSchristos #include "testutil.h"
12*4724848cSchristos 
13*4724848cSchristos #ifdef __VMS
14*4724848cSchristos # pragma names save
15*4724848cSchristos # pragma names as_is,shortened
16*4724848cSchristos #endif
17*4724848cSchristos 
18*4724848cSchristos #include "../ssl/ssl_local.h"
19*4724848cSchristos 
20*4724848cSchristos #ifdef __VMS
21*4724848cSchristos # pragma names restore
22*4724848cSchristos #endif
23*4724848cSchristos 
cipher_overhead(void)24*4724848cSchristos static int cipher_overhead(void)
25*4724848cSchristos {
26*4724848cSchristos     int ret = 1, i, n = ssl3_num_ciphers();
27*4724848cSchristos     const SSL_CIPHER *ciph;
28*4724848cSchristos     size_t mac, in, blk, ex;
29*4724848cSchristos 
30*4724848cSchristos     for (i = 0; i < n; i++) {
31*4724848cSchristos         ciph = ssl3_get_cipher(i);
32*4724848cSchristos         if (!ciph->min_dtls)
33*4724848cSchristos             continue;
34*4724848cSchristos         if (!TEST_true(ssl_cipher_get_overhead(ciph, &mac, &in, &blk, &ex))) {
35*4724848cSchristos             TEST_info("Failed getting %s", ciph->name);
36*4724848cSchristos             ret = 0;
37*4724848cSchristos         } else {
38*4724848cSchristos             TEST_info("Cipher %s: %zu %zu %zu %zu",
39*4724848cSchristos                       ciph->name, mac, in, blk, ex);
40*4724848cSchristos         }
41*4724848cSchristos     }
42*4724848cSchristos     return ret;
43*4724848cSchristos }
44*4724848cSchristos 
setup_tests(void)45*4724848cSchristos int setup_tests(void)
46*4724848cSchristos {
47*4724848cSchristos     ADD_TEST(cipher_overhead);
48*4724848cSchristos     return 1;
49*4724848cSchristos }
50