xref: /freebsd/crypto/openssh/rijndael.h (revision 5b9b2fafd4d6d82af10bf630cbfc9393b8ed1d0a)
15b9b2fafSBrian Feldman #ifndef _RIJNDAEL_H_
25b9b2fafSBrian Feldman #define _RIJNDAEL_H_
35b9b2fafSBrian Feldman 
45b9b2fafSBrian Feldman /* 1. Standard types for AES cryptography source code               */
55b9b2fafSBrian Feldman 
65b9b2fafSBrian Feldman typedef u_int8_t   u1byte; /* an 8 bit unsigned character type */
75b9b2fafSBrian Feldman typedef u_int16_t  u2byte; /* a 16 bit unsigned integer type   */
85b9b2fafSBrian Feldman typedef u_int32_t  u4byte; /* a 32 bit unsigned integer type   */
95b9b2fafSBrian Feldman 
105b9b2fafSBrian Feldman typedef int8_t     s1byte; /* an 8 bit signed character type   */
115b9b2fafSBrian Feldman typedef int16_t    s2byte; /* a 16 bit signed integer type     */
125b9b2fafSBrian Feldman typedef int32_t    s4byte; /* a 32 bit signed integer type     */
135b9b2fafSBrian Feldman 
145b9b2fafSBrian Feldman typedef struct _rijndael_ctx {
155b9b2fafSBrian Feldman 	u4byte  k_len;
165b9b2fafSBrian Feldman 	int decrypt;
175b9b2fafSBrian Feldman 	u4byte  e_key[64];
185b9b2fafSBrian Feldman 	u4byte  d_key[64];
195b9b2fafSBrian Feldman } rijndael_ctx;
205b9b2fafSBrian Feldman 
215b9b2fafSBrian Feldman 
225b9b2fafSBrian Feldman /* 2. Standard interface for AES cryptographic routines             */
235b9b2fafSBrian Feldman 
245b9b2fafSBrian Feldman /* These are all based on 32 bit unsigned values and will therefore */
255b9b2fafSBrian Feldman /* require endian conversions for big-endian architectures          */
265b9b2fafSBrian Feldman 
275b9b2fafSBrian Feldman rijndael_ctx *rijndael_set_key  __P((rijndael_ctx *, const u4byte *, u4byte, int));
285b9b2fafSBrian Feldman void rijndael_encrypt __P((rijndael_ctx *, const u4byte *, u4byte *));
295b9b2fafSBrian Feldman void rijndael_decrypt __P((rijndael_ctx *, const u4byte *, u4byte *));
305b9b2fafSBrian Feldman 
315b9b2fafSBrian Feldman #endif /* _RIJNDAEL_H_ */
32