61 lines
1.6 KiB
C
61 lines
1.6 KiB
C
#ifndef AES_DEBUG_H
|
|
#define AES_DEBUG_H
|
|
|
|
/* gettimeofday */
|
|
|
|
#if defined(_MSC_VER) || ( defined(__WIN32__) && !defined(__CYGWIN__))
|
|
|
|
struct timezone
|
|
{
|
|
int tz_minuteswest; /* minutes west of Greenwich */
|
|
int tz_dsttime; /* type of dst correction */
|
|
};
|
|
|
|
struct timeval {
|
|
int tv_sec;
|
|
int tv_usec;
|
|
};
|
|
|
|
extern int gettimeofday(struct timeval *tv, struct timezone *tz);
|
|
|
|
#else
|
|
#include <sys/time.h>
|
|
#endif
|
|
|
|
/* Debugging function - conditional printf and hex dump */
|
|
|
|
enum {
|
|
MSG_EXCESSIVE, MSG_MSGDUMP, MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR
|
|
};
|
|
|
|
extern int aes_debug_level;
|
|
extern int aes_debug_show_keys;
|
|
extern int aes_debug_timestamp;
|
|
|
|
#ifndef AES_DEBUG
|
|
|
|
#define aes_debug_print_timestamp() do { } while (0)
|
|
#define aes_printf(args...) do { } while (0)
|
|
#define aes_hexdump(l,t,b,le) do { } while (0)
|
|
#define aes_hexdump_buf(l,t,b) do { } while (0)
|
|
#define aes_hexdump_key(l,t,b,le) do { } while (0)
|
|
#define aes_hexdump_buf_key(l,t,b) do { } while (0)
|
|
#define aes_hexdump_ascii(l,t,b,le) do { } while (0)
|
|
#define aes_hexdump_ascii_key(l,t,b,le) do { } while (0)
|
|
#define aes_dbg(args...) do { } while (0)
|
|
|
|
#else
|
|
void aes_debug_print_timestamp(void);
|
|
void aes_printf(int level, const char *fmt, ...) __attribute__ ((format (printf, (2), (3))));
|
|
void aes_hexdump(int level, const char *title, const void *buf, size_t len);
|
|
void aes_hexdump_key(int level, const char *title, const void *buf, size_t len);
|
|
void aes_hexdump_ascii(int level, const char *title, const void *buf,
|
|
size_t len);
|
|
|
|
void aes_hexdump_ascii_key(int level, const char *title, const void *buf,
|
|
size_t len);
|
|
|
|
#endif /* AES_DEBUG_STDOUT */
|
|
|
|
#endif /* AES_DEBUG_H */
|