30 #define RC5_ROT_MASK (WORD_SIZE - 1) // mask that selects the log2(2^{WORD_SIZE}) LS bits
32 #define RC5_ROTL(x,y) (((x)<<(y & (WORD_SIZE-1))) | ((x)>>(WORD_SIZE - (y & (WORD_SIZE-1)))))
33 #define RC5_ROTR(x,y) (((x)>>(y & (WORD_SIZE-1))) | ((x)<<(WORD_SIZE - (y & (WORD_SIZE-1)))))
35 #if ((WORD_SIZE == 16) || (WORD_SIZE == 32) || (WORD_SIZE == 64))
37 #define RC5_NROUNDS_R NROUNDS//12
38 #define RC5_KEY_NBYTES_B 16
39 #define RC5_STAB_LEN_T 26
43 #define RC5_KEY_NWORDS_C 2
44 #endif // #if (WORD_SIZE == 64)
46 #define RC5_KEY_NWORDS_C 4
47 #endif // #if (WORD_SIZE == 32)
49 #define RC5_KEY_NWORDS_C 8
50 #endif // #if (WORD_SIZE == 16)
52 extern WORD_T RC5_CONST_P;
53 extern WORD_T RC5_CONST_Q;
55 void rc5_encrypt(uint32_t nrounds,
const WORD_T S[RC5_STAB_LEN_T], WORD_T *pt, WORD_T *ct);
56 void rc5_decrypt(uint32_t nrounds,
const WORD_T S[RC5_STAB_LEN_T], WORD_T *ct, WORD_T *pt);
57 void rc5_xor_encrypt(uint32_t nrounds,
const WORD_T S[RC5_STAB_LEN_T], WORD_T *pt, WORD_T *ct);
59 void rc5_setup(
const unsigned char *K, WORD_T S[RC5_STAB_LEN_T]);
61 #endif // #if ((WORD_SIZE == 16) || (WORD_SIZE == 32) || (WORD_SIZE == 64))
62 #endif // #ifndef RC5_REF_H