Move cypto debug definitions to debug.h with other susbsystem-level debug
This commit is contained in:
parent
bb3dcccd98
commit
edb5f312ca
@ -44,11 +44,11 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <semaphore.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <semaphore.h>
|
||||
#include <crypto/crypto.h>
|
||||
|
||||
#include <crypto/crypto.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
@ -63,20 +63,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define CONFIG_DEBUG_CRYPTO
|
||||
|
||||
#ifdef CONFIG_DEBUG_CRYPTO
|
||||
# define cryptdbg lldbg
|
||||
# ifdef CONFIG_DEBUG_VERBOSE
|
||||
# define cryptvdbg lldbg
|
||||
# else
|
||||
# define cryptvdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# define cryptdbg(x...)
|
||||
# define cryptvdbg(x...)
|
||||
#endif
|
||||
|
||||
#define AES_BLOCK_SIZE 16
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -76,9 +76,9 @@ void up_cryptoinitialize(void)
|
||||
#if defined(CONFIG_CRYPTO_ALGTEST)
|
||||
res = crypto_test();
|
||||
if (res)
|
||||
cryptdbg("crypto test failed\n");
|
||||
cryptlldbg("crypto test failed\n");
|
||||
else
|
||||
cryptvdbg("crypto test OK\n");
|
||||
cryptllvdbg("crypto test OK\n");
|
||||
#endif
|
||||
|
||||
return res;
|
||||
|
@ -78,7 +78,7 @@ static int do_test_aes(FAR struct cipher_testvec* test, int mode, int encrypt)
|
||||
#define AES_CYPHER_TEST_ENCRYPT(mode, mode_str, count, template) \
|
||||
for (i = 0; i < count; i++) { \
|
||||
if (do_test_aes(template + i, mode, CYPHER_ENCRYPT)) { \
|
||||
cryptdbg("Failed " mode_str " encrypt test #%i\n", i); \
|
||||
cryptlldbg("Failed " mode_str " encrypt test #%i\n", i); \
|
||||
return -1; \
|
||||
} \
|
||||
}
|
||||
@ -86,7 +86,7 @@ static int do_test_aes(FAR struct cipher_testvec* test, int mode, int encrypt)
|
||||
#define AES_CYPHER_TEST_DECRYPT(mode, mode_str, count, template) \
|
||||
for (i = 0; i < count; i++) { \
|
||||
if (do_test_aes(template + i, mode, CYPHER_DECRYPT)) { \
|
||||
cryptdbg("Failed " mode_str " decrypt test #%i\n", i); \
|
||||
cryptlldbg("Failed " mode_str " decrypt test #%i\n", i); \
|
||||
return -1; \
|
||||
} \
|
||||
}
|
||||
|
@ -60,24 +60,12 @@
|
||||
#define CYPHER_ENCRYPT 1
|
||||
#define CYPHER_DECRYPT 0
|
||||
|
||||
#ifdef CONFIG_DEBUG_CRYPTO
|
||||
# define cryptdbg lldbg
|
||||
# ifdef CONFIG_DEBUG_VERBOSE
|
||||
# define cryptvdbg lldbg
|
||||
# else
|
||||
# define cryptvdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# define cryptdbg(x...)
|
||||
# define cryptvdbg(x...)
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
|
@ -56,9 +56,9 @@
|
||||
* that the output is not buffered. The first character indicates the
|
||||
* system system (e.g., n=network, f=filesystm, etc.). If the first
|
||||
* character is missing (i.e., dbg()), then it is common. The common
|
||||
* dbg() macro is enabled by CONFIG_DEBUG. Subystem debug requires an
|
||||
* dbg() macro is enabled by CONFIG_DEBUG. Subsystem debug requires an
|
||||
* additional configuration setting to enable it (e.g., CONFIG_DEBUG_NET
|
||||
* for the network, CONFIG_DEBUG_FS for the file syste, etc).
|
||||
* for the network, CONFIG_DEBUG_FS for the file system, etc).
|
||||
*
|
||||
* In general, error messages and output of importance use [a-z]dbg().
|
||||
* [a-z]dbg() is implementation dependent but usually uses file descriptors.
|
||||
@ -66,7 +66,7 @@
|
||||
* directed stdout). Therefore [a-z]dbg() should not be used in interrupt
|
||||
* handlers.
|
||||
*
|
||||
* [a-z]vdbg() -- Identifcal to [a-z]dbg() except that it also requires that
|
||||
* [a-z]vdbg() -- Identical to [a-z]dbg() except that it also requires that
|
||||
* CONFIG_DEBUG_VERBOSE be defined. This is intended for general debug
|
||||
* output that you would normally want to suppress.
|
||||
*
|
||||
@ -81,7 +81,7 @@
|
||||
* in low-level code where it is inappropriate to use file descriptors. For
|
||||
* example, only [a-z]lldbg() should be used in interrupt handlers.
|
||||
*
|
||||
* [a-z]llvdbg() -- Identifcal to [a-z]lldbg() except that it also requires that
|
||||
* [a-z]llvdbg() -- Identical to [a-z]lldbg() except that it also requires that
|
||||
* CONFIG_DEBUG_VERBOSE be defined. This is intended for general debug
|
||||
* output that you would normally want to suppress.
|
||||
*/
|
||||
@ -224,6 +224,18 @@
|
||||
# define fllvdbg(x...)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_CRYPTO
|
||||
# define cryptdbg(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define cryptlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
|
||||
# define cryptvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
|
||||
# define cryptllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define cryptdbg(x...)
|
||||
# define cryptlldbg(x...)
|
||||
# define cryptvdbg(x...)
|
||||
# define cryptllvdbg(x...)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_INPUT
|
||||
# define idbg(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define illdbg(format, ...) lldbg(format, ##__VA_ARGS__)
|
||||
@ -405,6 +417,18 @@
|
||||
# define fllvdbg (void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_CRYPTO
|
||||
# define cryptdbg dbg
|
||||
# define cryptlldbg lldbg
|
||||
# define cryptvdbg vdbg
|
||||
# define cryptllvdbg llvdbg
|
||||
#else
|
||||
# define cryptdbg (void)
|
||||
# define cryptlldbg (void)
|
||||
# define cryptvdbg (void)
|
||||
# define cryptllvdbg (void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_INPUT
|
||||
# define idbg dbg
|
||||
# define illdbg lldbg
|
||||
@ -610,9 +634,10 @@ extern "C"
|
||||
|
||||
/* Dump a buffer of data */
|
||||
|
||||
void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer, unsigned int buflen);
|
||||
void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer,
|
||||
unsigned int buflen);
|
||||
|
||||
/* The system logging interfaces are pnormally accessed via the macros
|
||||
/* The system logging interfaces are normally accessed via the macros
|
||||
* provided above. If the cross-compiler's C pre-processor supports a
|
||||
* variable number of macro arguments, then those macros below will map all
|
||||
* debug statements to the logging interfaces declared in syslog.h.
|
||||
|
Loading…
Reference in New Issue
Block a user