xref: /freebsd/crypto/libecc/include/libecc/utils/dbg_sig.h (revision f0865ec9906d5a18fa2a3b61381f22ce16e606ad)
1 /*
2  *  Copyright (C) 2017 - This file is part of libecc project
3  *
4  *  Authors:
5  *      Ryad BENADJILA <ryadbenadjila@gmail.com>
6  *      Arnaud EBALARD <arnaud.ebalard@ssi.gouv.fr>
7  *      Jean-Pierre FLORI <jean-pierre.flori@ssi.gouv.fr>
8  *
9  *  Contributors:
10  *      Nicolas VIVET <nicolas.vivet@ssi.gouv.fr>
11  *      Karim KHALFALLAH <karim.khalfallah@ssi.gouv.fr>
12  *
13  *  This software is licensed under a dual BSD and GPL v2 license.
14  *  See LICENSE file at the root folder of the project.
15  */
16 #ifndef __DBG_SIG_H__
17 #define __DBG_SIG_H__
18 #include <libecc/utils/print_curves.h>
19 #include <libecc/utils/print_keys.h>
20 #include <libecc/utils/print_buf.h>
21 
22 /* Macro to allow inner values of tests vectors print */
23 #ifdef VERBOSE_INNER_VALUES
24 #ifndef EC_SIG_ALG
25 #define EC_SIG_ALG "UNKNOWN_ALG"
26 #endif
27 
28 #define dbg_buf_print(msg, ...) do {\
29 	buf_print(EC_SIG_ALG " " msg,  __VA_ARGS__);\
30 } while(0)
31 #define dbg_nn_print(msg, ...) do {\
32 	nn_print(EC_SIG_ALG " " msg, __VA_ARGS__);\
33 } while(0)
34 #define dbg_ec_point_print(msg, ...) do {\
35 	ec_point_print(EC_SIG_ALG " " msg, __VA_ARGS__);\
36 } while(0)
37 #define dbg_ec_montgomery_point_print(msg, ...) do {\
38 	ec_montgomery_point_print(EC_SIG_ALG " " msg, __VA_ARGS__);\
39 } while(0)
40 #define dbg_ec_edwards_point_print(msg, ...) do {\
41 	ec_edwards_point_print(EC_SIG_ALG " " msg, __VA_ARGS__);\
42 } while(0)
43 #define dbg_priv_key_print(msg, ...) do {\
44 	priv_key_print(EC_SIG_ALG " " msg, __VA_ARGS__);\
45 } while(0)
46 #define dbg_pub_key_print(msg, ...) do {\
47 	pub_key_print(EC_SIG_ALG " " msg, __VA_ARGS__);\
48 } while(0)
49 
50 #else /* VERBOSE_INNER_VALUES not defined */
51 
52 #define dbg_buf_print(msg, ...)
53 #define dbg_nn_print(msg, ...)
54 #define dbg_ec_point_print(msg, ...)
55 #define dbg_ec_montgomery_point_print(msg, ...)
56 #define dbg_ec_edwards_point_print(msg, ...)
57 #define dbg_priv_key_print(msg, ...)
58 #define dbg_pub_key_print(msg, ...)
59 
60 #endif
61 #endif /* __DBG_SIG_H__ */
62