Import new random number generator files from harvey
[akaros.git] / kern / include / random / rijndael.h
1 /*
2  * contrib/pgcrypto/rijndael.h
3  *
4  *      $OpenBSD: rijndael.h,v 1.3 2001/05/09 23:01:32 markus Exp $ */
5
6 /* This is an independent implementation of the encryption algorithm:   */
7 /*                                                                                                                                              */
8 /*                 RIJNDAEL by Joan Daemen and Vincent Rijmen                                   */
9 /*                                                                                                                                              */
10 /* which is a candidate algorithm in the Advanced Encryption Standard   */
11 /* programme of the US National Institute of Standards and Technology.  */
12 /*                                                                                                                                              */
13 /* Copyright in this implementation is held by Dr B R Gladman but I             */
14 /* hereby give permission for its free direct or derivative use subject */
15 /* to acknowledgment of its origin and compliance with any conditions   */
16 /* that the originators of the algorithm place on its exploitation.             */
17 /*                                                                                                                                              */
18 /* Dr Brian Gladman (gladman@seven77.demon.co.uk) 14th January 1999             */
19
20 typedef struct rijndaelCtx rijndaelCtx;
21
22 struct rijndaelCtx
23 {
24         uint32_t                k_len;
25         int                             decrypt;
26         uint32_t                e_key[64];
27         uint32_t                d_key[64];
28 };
29
30
31 /* Standard interface for AES cryptographic routines                            */
32
33 /* These are all based on 32 bit unsigned values and will therefore */
34 /* require endian conversions for big-endian architectures                      */
35
36 rijndaelCtx *
37                         rijndael_set_key(rijndaelCtx *, const uint32_t *, const uint32_t, int);
38 void            rijndael_encrypt(rijndaelCtx *, const uint32_t *, uint32_t *);
39 void            rijndael_decrypt(rijndaelCtx *, const uint32_t *, uint32_t *);
40
41 /* conventional interface */
42
43 void            aes_set_key(rijndaelCtx *ctx, const uint8_t *key, unsigned keybits, int enc);
44 void            aes_ecb_encrypt(rijndaelCtx *ctx, uint8_t *data, unsigned len);
45 void            aes_ecb_decrypt(rijndaelCtx *ctx, uint8_t *data, unsigned len);
46 void            aes_cbc_encrypt(rijndaelCtx *ctx, uint8_t *iva, uint8_t *data, unsigned len);
47 void            aes_cbc_decrypt(rijndaelCtx *ctx, uint8_t *iva, uint8_t *data, unsigned len);