]>
Commit | Line | Data |
---|---|---|
d6192346 | 1 | /* $OpenBSD: rijndael.h,v 1.9 2001/07/30 16:23:30 stevesk Exp $ */ |
4371658c | 2 | |
3 | /* This is an independent implementation of the encryption algorithm: */ | |
4 | /* */ | |
5 | /* RIJNDAEL by Joan Daemen and Vincent Rijmen */ | |
6 | /* */ | |
7 | /* which is a candidate algorithm in the Advanced Encryption Standard */ | |
8 | /* programme of the US National Institute of Standards and Technology. */ | |
d6192346 | 9 | |
10 | /* | |
11 | ----------------------------------------------------------------------- | |
12 | Copyright (c) 2001 Dr Brian Gladman <brg@gladman.uk.net>, Worcester, UK | |
13 | ||
14 | TERMS | |
15 | ||
16 | Redistribution and use in source and binary forms, with or without | |
17 | modification, are permitted provided that the following conditions | |
18 | are met: | |
19 | 1. Redistributions of source code must retain the above copyright | |
20 | notice, this list of conditions and the following disclaimer. | |
21 | 2. Redistributions in binary form must reproduce the above copyright | |
22 | notice, this list of conditions and the following disclaimer in the | |
23 | documentation and/or other materials provided with the distribution. | |
24 | ||
25 | This software is provided 'as is' with no guarantees of correctness or | |
26 | fitness for purpose. | |
27 | ----------------------------------------------------------------------- | |
28 | */ | |
23c2a7a5 | 29 | |
6b523bae | 30 | #ifndef _RIJNDAEL_H_ |
31 | #define _RIJNDAEL_H_ | |
94ec8c6b | 32 | |
6b523bae | 33 | #include "config.h" |
4d670c24 | 34 | |
6b523bae | 35 | /* 1. Standard types for AES cryptography source code */ |
94ec8c6b | 36 | |
6b523bae | 37 | typedef u_int8_t u1byte; /* an 8 bit unsigned character type */ |
38 | typedef u_int16_t u2byte; /* a 16 bit unsigned integer type */ | |
39 | typedef u_int32_t u4byte; /* a 32 bit unsigned integer type */ | |
94ec8c6b | 40 | |
6b523bae | 41 | typedef int8_t s1byte; /* an 8 bit signed character type */ |
42 | typedef int16_t s2byte; /* a 16 bit signed integer type */ | |
43 | typedef int32_t s4byte; /* a 32 bit signed integer type */ | |
94ec8c6b | 44 | |
6b523bae | 45 | typedef struct _rijndael_ctx { |
46 | u4byte k_len; | |
47 | int decrypt; | |
48 | u4byte e_key[64]; | |
49 | u4byte d_key[64]; | |
50 | } rijndael_ctx; | |
94ec8c6b | 51 | |
6b523bae | 52 | |
53 | /* 2. Standard interface for AES cryptographic routines */ | |
54 | ||
55 | /* These are all based on 32 bit unsigned values and will therefore */ | |
56 | /* require endian conversions for big-endian architectures */ | |
57 | ||
a16092bb | 58 | rijndael_ctx * |
59 | rijndael_set_key __P((rijndael_ctx *, const u4byte *, const u4byte, int)); | |
6b523bae | 60 | void rijndael_encrypt __P((rijndael_ctx *, const u4byte *, u4byte *)); |
61 | void rijndael_decrypt __P((rijndael_ctx *, const u4byte *, u4byte *)); | |
62 | ||
63 | #endif /* _RIJNDAEL_H_ */ |