Skip to content

Commit 5c98ccb

Browse files
authored
Merge pull request #317 from padelsbach/wp-log-defines-cleanup
Clean up names of log constants
2 parents 4aca285 + baa2afd commit 5c98ccb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1485
-1485
lines changed

include/wolfprovider/wp_logging.h

Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@
5656
/* wolfProv debug logging support can be compiled in by defining
5757
* WOLFPROV_DEBUG or by using the --enable-debug configure option.
5858
*
59-
* wolfProv supports the log levels as mentioned in wolfProv_LogType
59+
* wolfProv supports the log levels as mentioned in wolfProv_LogLevels
6060
* enum below. The default logging level when debug logging is compiled in
6161
* and enabled at runtime is WP_LOG_LEVEL_DEFAULT.
6262
*
6363
* wolfProv supports log message control per-component/algorithm type,
6464
* with all possible logging components in wolfProv_LogComponents enum
6565
* below. The default logging level when debug logging is compiled in and
66-
* enabled at runtime is WP_LOG_COMPONENTS_DEFAULT.
66+
* enabled at runtime is WP_LOG_COMP_DEFAULT.
6767
*
6868
*/
6969

@@ -89,122 +89,122 @@
8989
*
9090
* WOLFPROV_LOG_LEVEL_FILTER Sets the log level. Use WP_LOG_* constants from enum below.
9191
* Examples:
92-
* - WP_LOG_ERROR (only errors)
93-
* - (WP_LOG_ERROR | WP_LOG_ENTER) (errors and function enter)
94-
* - (WP_LOG_ERROR | WP_LOG_LEAVE) (errors and function leave)
92+
* - WP_LOG_LEVEL_ERROR (only errors)
93+
* - (WP_LOG_LEVEL_ERROR | WP_LOG_LEVEL_ENTER) (errors and function enter)
94+
* - (WP_LOG_LEVEL_ERROR | WP_LOG_LEVEL_LEAVE) (errors and function leave)
9595
* - (WP_LOG_LEVEL_ALL) (all levels)
9696
*
9797
* WOLFPROV_LOG_COMPONENTS_FILTER Set component bitmask to filter specific
9898
* algorithms. Use WP_LOG_* constants from enum below.
9999
* Examples:
100-
* - WP_LOG_HKDF (HKDF only)
101-
* - (WP_LOG_AES | WP_LOG_DES) (ciphers only)
102-
* - (WP_LOG_ECC | WP_LOG_RSA | WP_LOG_HKDF) (multiple algorithms)
103-
* - WP_LOG_CIPHER (all cipher operations)
100+
* - WP_LOG_COMP_HKDF (HKDF only)
101+
* - (WP_LOG_COMP_AES | WP_LOG_COMP_DES) (ciphers only)
102+
* - (WP_LOG_COMP_ECC | WP_LOG_COMP_RSA | WP_LOG_COMP_HKDF) (multiple algorithms)
103+
* - WP_LOG_COMP_CIPHER (all cipher operations)
104104
*
105105
* EXAMPLES:
106-
* #define WOLFPROV_LOG_LEVEL_FILTER (WP_LOG_ERROR | WP_LOG_ENTER | WP_LOG_LEAVE | WP_LOG_INFO)
107-
* #define WOLFPROV_LOG_COMPONENTS_FILTER WP_LOG_HKDF
106+
* #define WOLFPROV_LOG_LEVEL_FILTER (WP_LOG_LEVEL_ERROR | WP_LOG_LEVEL_ENTER | WP_LOG_LEVEL_LEAVE | WP_LOG_LEVEL_INFO)
107+
* #define WOLFPROV_LOG_COMPONENTS_FILTER WP_LOG_COMP_HKDF
108108
* // Shows level (ERROR + ENTER/LEAVE + INFO) for HKDF operations only
109109
*
110110
* #define WOLFPROV_LOG_LEVEL_FILTER (WP_LOG_LEVEL_ALL)
111-
* #define WOLFPROV_LOG_COMPONENTS_FILTER (WP_LOG_ECC | WP_LOG_RSA | WP_LOG_HKDF)
111+
* #define WOLFPROV_LOG_COMPONENTS_FILTER (WP_LOG_COMP_ECC | WP_LOG_COMP_RSA | WP_LOG_COMP_HKDF)
112112
* // Shows level (ERROR + ENTER/LEAVE + INFO + VERBOSE + DEBUG + TRACE) for ECC, RSA, and HKDF only
113113
*
114114
* When modifying the enum values, ensure the corresponding strings in the
115115
* wp_logging.c file are updated to match.
116116
*/
117-
enum wolfProv_LogType {
118-
WP_LOG_ERROR = 0x0001, /* logs errors */
119-
WP_LOG_ENTER = 0x0002, /* logs function enter*/
120-
WP_LOG_LEAVE = 0x0004, /* logs function leave */
121-
WP_LOG_INFO = 0x0008, /* logs informative messages */
122-
WP_LOG_VERBOSE = 0x0010, /* logs encrypted/decrypted/digested data */
123-
/* To see the return code from wolfssl, you must add WP_LOG_DEBUG to the
117+
enum wolfProv_LogLevels {
118+
WP_LOG_LEVEL_ERROR = 0x0001, /* logs errors */
119+
WP_LOG_LEVEL_ENTER = 0x0002, /* logs function enter*/
120+
WP_LOG_LEVEL_LEAVE = 0x0004, /* logs function leave */
121+
WP_LOG_LEVEL_INFO = 0x0008, /* logs informative messages */
122+
WP_LOG_LEVEL_VERBOSE = 0x0010, /* logs encrypted/decrypted/digested data */
123+
/* To see the return code from wolfssl, you must add WP_LOG_LEVEL_DEBUG to the
124124
* WOLFPROV_LOG_LEVEL_FILTER */
125-
WP_LOG_DEBUG = 0x0020, /* logs debug-level detailed information */
126-
WP_LOG_TRACE = 0x0040, /* logs trace-level ultra-detailed information */
125+
WP_LOG_LEVEL_DEBUG = 0x0020, /* logs debug-level detailed information */
126+
WP_LOG_LEVEL_TRACE = 0x0040, /* logs trace-level ultra-detailed information */
127127

128128
/* default log level when logging is turned on */
129-
WP_LOG_LEVEL_DEFAULT = (WP_LOG_ERROR | WP_LOG_LEAVE | WP_LOG_INFO),
129+
WP_LOG_LEVEL_DEFAULT = (WP_LOG_LEVEL_ERROR | WP_LOG_LEVEL_LEAVE | WP_LOG_LEVEL_INFO),
130130

131131
/* log all, including verbose */
132-
WP_LOG_LEVEL_ALL = (WP_LOG_ERROR
133-
| WP_LOG_ENTER
134-
| WP_LOG_LEAVE
135-
| WP_LOG_INFO
136-
| WP_LOG_VERBOSE
137-
| WP_LOG_DEBUG
138-
| WP_LOG_TRACE)
132+
WP_LOG_LEVEL_ALL = (WP_LOG_LEVEL_ERROR
133+
| WP_LOG_LEVEL_ENTER
134+
| WP_LOG_LEVEL_LEAVE
135+
| WP_LOG_LEVEL_INFO
136+
| WP_LOG_LEVEL_VERBOSE
137+
| WP_LOG_LEVEL_DEBUG
138+
| WP_LOG_LEVEL_TRACE)
139139
};
140140

141141
enum wolfProv_LogComponents {
142142
/* Legacy component categories */
143-
WP_LOG_RNG = 0x0001, /* random number generation */
144-
WP_LOG_DIGEST = 0x0002, /* digest (SHA-1/2/3) */
145-
WP_LOG_MAC = 0x0004, /* mac functions: HMAC, CMAC */
146-
WP_LOG_CIPHER = 0x0008, /* cipher (AES, 3DES) */
147-
WP_LOG_PK = 0x0010, /* public key algorithms (RSA, ECC) */
148-
WP_LOG_KE = 0x0020, /* key agreement (DH, ECDH) */
149-
WP_LOG_KDF = 0x0040, /* password base key derivation algorithms */
150-
WP_LOG_PROVIDER = 0x0080, /* all provider specific logs */
143+
WP_LOG_COMP_RNG = 0x0001, /* random number generation */
144+
WP_LOG_COMP_DIGEST = 0x0002, /* digest (SHA-1/2/3) */
145+
WP_LOG_COMP_MAC = 0x0004, /* mac functions: HMAC, CMAC */
146+
WP_LOG_COMP_CIPHER = 0x0008, /* cipher (AES, 3DES) */
147+
WP_LOG_COMP_PK = 0x0010, /* public key algorithms (RSA, ECC) */
148+
WP_LOG_COMP_KE = 0x0020, /* key agreement (DH, ECDH) */
149+
WP_LOG_COMP_KDF = 0x0040, /* password base key derivation algorithms */
150+
WP_LOG_COMP_PROVIDER = 0x0080, /* all provider specific logs */
151151

152152
/* Granular algorithm family categories */
153-
WP_LOG_RSA = 0x0001, /* RSA operations */
154-
WP_LOG_ECC = 0x0002, /* ECC operations */
155-
WP_LOG_DH = 0x0004, /* Diffie-Hellman operations */
156-
WP_LOG_AES = 0x0008, /* AES cipher operations */
157-
WP_LOG_DES = 0x0010, /* 3DES cipher operations */
158-
WP_LOG_SHA = 0x0020, /* SHA digest operations */
159-
WP_LOG_MD5 = 0x0040, /* MD5 digest operations */
160-
WP_LOG_HMAC = 0x0080, /* HMAC operations */
161-
WP_LOG_CMAC = 0x0100, /* CMAC operations */
162-
WP_LOG_HKDF = 0x0200, /* HKDF operations */
163-
WP_LOG_PBKDF2 = 0x0400, /* PBKDF2 operations */
164-
WP_LOG_KRB5KDF = 0x0800, /* KRB5KDF operations */
165-
WP_LOG_DRBG = 0x1000, /* DRBG operations */
166-
WP_LOG_ECDSA = 0x2000, /* ECDSA signature operations */
167-
WP_LOG_ECDH = 0x4000, /* ECDH key exchange operations */
168-
WP_LOG_ED25519 = 0x8000, /* Ed25519 operations */
169-
WP_LOG_ED448 = 0x10000, /* Ed448 operations */
170-
WP_LOG_X25519 = 0x20000, /* X25519 operations */
171-
WP_LOG_X448 = 0x40000, /* X448 operations */
172-
WP_LOG_QUERY = 0x80000, /* wolfprov_query operations */
173-
WP_LOG_TLS1_PRF = 0x100000, /* TLS1 PRF operations */
153+
WP_LOG_COMP_RSA = 0x0100, /* RSA operations */
154+
WP_LOG_COMP_ECC = 0x0200, /* ECC operations */
155+
WP_LOG_COMP_DH = 0x0400, /* Diffie-Hellman operations */
156+
WP_LOG_COMP_AES = 0x0800, /* AES cipher operations */
157+
WP_LOG_COMP_DES = 0x1000, /* 3DES cipher operations */
158+
WP_LOG_COMP_SHA = 0x2000, /* SHA digest operations */
159+
WP_LOG_COMP_MD5 = 0x4000, /* MD5 digest operations */
160+
WP_LOG_COMP_HMAC = 0x8000, /* HMAC operations */
161+
WP_LOG_COMP_CMAC = 0x10000, /* CMAC operations */
162+
WP_LOG_COMP_HKDF = 0x20000, /* HKDF operations */
163+
WP_LOG_COMP_PBKDF2 = 0x40000, /* PBKDF2 operations */
164+
WP_LOG_COMP_KRB5KDF = 0x80000, /* KRB5KDF operations */
165+
WP_LOG_COMP_DRBG = 0x100000, /* DRBG operations */
166+
WP_LOG_COMP_ECDSA = 0x200000, /* ECDSA signature operations */
167+
WP_LOG_COMP_ECDH = 0x400000, /* ECDH key exchange operations */
168+
WP_LOG_COMP_ED25519 = 0x800000, /* Ed25519 operations */
169+
WP_LOG_COMP_ED448 = 0x1000000, /* Ed448 operations */
170+
WP_LOG_COMP_X25519 = 0x2000000, /* X25519 operations */
171+
WP_LOG_COMP_X448 = 0x4000000, /* X448 operations */
172+
WP_LOG_COMP_QUERY = 0x8000000, /* wolfprov_query operations */
173+
WP_LOG_COMP_TLS1_PRF = 0x10000000, /* TLS1 PRF operations */
174174

175175
/* log all components */
176-
WP_LOG_COMPONENTS_ALL = (WP_LOG_RNG
177-
| WP_LOG_DIGEST
178-
| WP_LOG_MAC
179-
| WP_LOG_CIPHER
180-
| WP_LOG_PK
181-
| WP_LOG_KE
182-
| WP_LOG_KDF
183-
| WP_LOG_PROVIDER
184-
| WP_LOG_RSA
185-
| WP_LOG_ECC
186-
| WP_LOG_DH
187-
| WP_LOG_AES
188-
| WP_LOG_DES
189-
| WP_LOG_SHA
190-
| WP_LOG_MD5
191-
| WP_LOG_HMAC
192-
| WP_LOG_CMAC
193-
| WP_LOG_HKDF
194-
| WP_LOG_PBKDF2
195-
| WP_LOG_KRB5KDF
196-
| WP_LOG_DRBG
197-
| WP_LOG_ECDSA
198-
| WP_LOG_ECDH
199-
| WP_LOG_ED25519
200-
| WP_LOG_ED448
201-
| WP_LOG_X25519
202-
| WP_LOG_X448
203-
| WP_LOG_QUERY
204-
| WP_LOG_TLS1_PRF),
176+
WP_LOG_COMP_ALL = (WP_LOG_COMP_RNG
177+
| WP_LOG_COMP_DIGEST
178+
| WP_LOG_COMP_MAC
179+
| WP_LOG_COMP_CIPHER
180+
| WP_LOG_COMP_PK
181+
| WP_LOG_COMP_KE
182+
| WP_LOG_COMP_KDF
183+
| WP_LOG_COMP_PROVIDER
184+
| WP_LOG_COMP_RSA
185+
| WP_LOG_COMP_ECC
186+
| WP_LOG_COMP_DH
187+
| WP_LOG_COMP_AES
188+
| WP_LOG_COMP_DES
189+
| WP_LOG_COMP_SHA
190+
| WP_LOG_COMP_MD5
191+
| WP_LOG_COMP_HMAC
192+
| WP_LOG_COMP_CMAC
193+
| WP_LOG_COMP_HKDF
194+
| WP_LOG_COMP_PBKDF2
195+
| WP_LOG_COMP_KRB5KDF
196+
| WP_LOG_COMP_DRBG
197+
| WP_LOG_COMP_ECDSA
198+
| WP_LOG_COMP_ECDH
199+
| WP_LOG_COMP_ED25519
200+
| WP_LOG_COMP_ED448
201+
| WP_LOG_COMP_X25519
202+
| WP_LOG_COMP_X448
203+
| WP_LOG_COMP_QUERY
204+
| WP_LOG_COMP_TLS1_PRF),
205205

206206
/* default components logged */
207-
WP_LOG_COMPONENTS_DEFAULT = WP_LOG_COMPONENTS_ALL
207+
WP_LOG_COMP_DEFAULT = WP_LOG_COMP_ALL
208208
};
209209

210210
/* Manually set the log level */
@@ -214,7 +214,7 @@ enum wolfProv_LogComponents {
214214

215215
/* Manually set the components */
216216
#ifndef WOLFPROV_LOG_COMPONENTS_FILTER
217-
#define WOLFPROV_LOG_COMPONENTS_FILTER WP_LOG_COMPONENTS_DEFAULT
217+
#define WOLFPROV_LOG_COMPONENTS_FILTER WP_LOG_COMP_DEFAULT
218218
#endif
219219

220220
/* Conditional logging macro that checks compile-time configuration */
@@ -235,7 +235,7 @@ int wolfProv_Debugging_ON(void);
235235
/* turn logging off */
236236
void wolfProv_Debugging_OFF(void);
237237

238-
/* Set logging level, bitmask of wolfProv_LogType */
238+
/* Set logging level, bitmask of wolfProv_LogLevels */
239239
int wolfProv_SetLogLevel(int levelMask);
240240
/* Set which components are logged, bitmask of wolfProv_LogComponents */
241241
int wolfProv_SetLogComponents(int componentMask);

0 commit comments

Comments
 (0)