xref: /freebsd/sys/crypto/skein/skein_debug.h (revision 5dae51da3da0cc94d17bd67b308fad304ebec7e0)
1 #ifndef _SKEIN_DEBUG_H_
2 #define _SKEIN_DEBUG_H_
3 /***********************************************************************
4 **
5 ** Interface definitions for Skein hashing debug output.
6 **
7 ** Source code author: Doug Whiting, 2008.
8 **
9 ** This algorithm and source code is released to the public domain.
10 **
11 ************************************************************************/
12 
13 #ifdef  SKEIN_DEBUG
14 /* callout functions used inside Skein code */
15 void    Skein_Show_Block(uint_t bits,const Skein_Ctxt_Hdr_t *h,const u64b_t *X,const u08b_t *blkPtr,
16                          const u64b_t *wPtr,const u64b_t *ksPtr,const u64b_t *tsPtr);
17 void    Skein_Show_Round(uint_t bits,const Skein_Ctxt_Hdr_t *h,size_t r,const u64b_t *X);
18 void    Skein_Show_R_Ptr(uint_t bits,const Skein_Ctxt_Hdr_t *h,size_t r,const u64b_t *X_ptr[]);
19 void    Skein_Show_Final(uint_t bits,const Skein_Ctxt_Hdr_t *h,size_t cnt,const u08b_t *outPtr);
20 void    Skein_Show_Key  (uint_t bits,const Skein_Ctxt_Hdr_t *h,const u08b_t *key,size_t keyBytes);
21 
22 extern  uint_t skein_DebugFlag;            /* flags to control debug output (0 --> none) */
23 
24 #define SKEIN_RND_SPECIAL       (1000u)
25 #define SKEIN_RND_KEY_INITIAL   (SKEIN_RND_SPECIAL+0u)
26 #define SKEIN_RND_KEY_INJECT    (SKEIN_RND_SPECIAL+1u)
27 #define SKEIN_RND_FEED_FWD      (SKEIN_RND_SPECIAL+2u)
28 
29 /* flag bits:  skein_DebugFlag */
30 #define SKEIN_DEBUG_KEY         (1u << 1)  /* show MAC key */
31 #define SKEIN_DEBUG_CONFIG      (1u << 2)  /* show config block processing */
32 #define SKEIN_DEBUG_STATE       (1u << 3)  /* show input state during Show_Block() */
33 #define SKEIN_DEBUG_TWEAK       (1u << 4)  /* show input state during Show_Block() */
34 #define SKEIN_DEBUG_KEYSCHED    (1u << 5)  /* show expanded key schedule */
35 #define SKEIN_DEBUG_INPUT_64    (1u << 6)  /* show input block as 64-bit words */
36 #define SKEIN_DEBUG_INPUT_08    (1u << 7)  /* show input block as  8-bit bytes */
37 #define SKEIN_DEBUG_INJECT      (1u << 8)  /* show state after key injection & feedforward points */
38 #define SKEIN_DEBUG_ROUNDS      (1u << 9)  /* show state after all rounds */
39 #define SKEIN_DEBUG_FINAL       (1u <<10)  /* show final output of Skein */
40 #define SKEIN_DEBUG_HDR         (1u <<11)  /* show block header */
41 #define SKEIN_DEBUG_THREEFISH   (1u <<12)  /* use Threefish name instead of Skein */
42 #define SKEIN_DEBUG_PERMUTE     (1u <<13)  /* use word permutations */
43 #define SKEIN_DEBUG_ALL         ((~0u) & ~(SKEIN_DEBUG_THREEFISH | SKEIN_DEBUG_PERMUTE))
44 #define THREEFISH_DEBUG_ALL     (SKEIN_DEBUG_ALL | SKEIN_DEBUG_THREEFISH)
45 
46 #endif /*  SKEIN_DEBUG    */
47 
48 #endif /* _SKEIN_DEBUG_H_ */
49