diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/aesGladman/hmac.h | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/aesGladman/hmac.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/aesGladman/hmac.h | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/aesGladman/hmac.h b/libraries/irrlicht-1.8/source/Irrlicht/aesGladman/hmac.h index 284c50f..b916151 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/aesGladman/hmac.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/aesGladman/hmac.h | |||
@@ -1,95 +1,95 @@ | |||
1 | /* | 1 | /* |
2 | --------------------------------------------------------------------------- | 2 | --------------------------------------------------------------------------- |
3 | Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK. | 3 | Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK. |
4 | All rights reserved. | 4 | All rights reserved. |
5 | 5 | ||
6 | LICENSE TERMS | 6 | LICENSE TERMS |
7 | 7 | ||
8 | The free distribution and use of this software in both source and binary | 8 | The free distribution and use of this software in both source and binary |
9 | form is allowed (with or without changes) provided that: | 9 | form is allowed (with or without changes) provided that: |
10 | 10 | ||
11 | 1. distributions of this source code include the above copyright | 11 | 1. distributions of this source code include the above copyright |
12 | notice, this list of conditions and the following disclaimer; | 12 | notice, this list of conditions and the following disclaimer; |
13 | 13 | ||
14 | 2. distributions in binary form include the above copyright | 14 | 2. distributions in binary form include the above copyright |
15 | notice, this list of conditions and the following disclaimer | 15 | notice, this list of conditions and the following disclaimer |
16 | in the documentation and/or other associated materials; | 16 | in the documentation and/or other associated materials; |
17 | 17 | ||
18 | 3. the copyright holder's name is not used to endorse products | 18 | 3. the copyright holder's name is not used to endorse products |
19 | built using this software without specific written permission. | 19 | built using this software without specific written permission. |
20 | 20 | ||
21 | ALTERNATIVELY, provided that this notice is retained in full, this product | 21 | ALTERNATIVELY, provided that this notice is retained in full, this product |
22 | may be distributed under the terms of the GNU General Public License (GPL), | 22 | may be distributed under the terms of the GNU General Public License (GPL), |
23 | in which case the provisions of the GPL apply INSTEAD OF those given above. | 23 | in which case the provisions of the GPL apply INSTEAD OF those given above. |
24 | 24 | ||
25 | DISCLAIMER | 25 | DISCLAIMER |
26 | 26 | ||
27 | This software is provided 'as is' with no explicit or implied warranties | 27 | This software is provided 'as is' with no explicit or implied warranties |
28 | in respect of its properties, including, but not limited to, correctness | 28 | in respect of its properties, including, but not limited to, correctness |
29 | and/or fitness for purpose. | 29 | and/or fitness for purpose. |
30 | --------------------------------------------------------------------------- | 30 | --------------------------------------------------------------------------- |
31 | Issue Date: 26/08/2003 | 31 | Issue Date: 26/08/2003 |
32 | Includes a bugfix from Dr Brian Gladman made on 16/04/2012 for compiling on 64-bit | 32 | Includes a bugfix from Dr Brian Gladman made on 16/04/2012 for compiling on 64-bit |
33 | 33 | ||
34 | This is an implementation of HMAC, the FIPS standard keyed hash function | 34 | This is an implementation of HMAC, the FIPS standard keyed hash function |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #ifndef _HMAC_H | 37 | #ifndef _HMAC_H |
38 | #define _HMAC_H | 38 | #define _HMAC_H |
39 | 39 | ||
40 | #include <memory.h> | 40 | #include <memory.h> |
41 | 41 | ||
42 | #define USE_SHA1 // Irrlicht only cares about SHA1 for now | 42 | #define USE_SHA1 // Irrlicht only cares about SHA1 for now |
43 | #if !defined(USE_SHA1) && !defined(USE_SHA256) | 43 | #if !defined(USE_SHA1) && !defined(USE_SHA256) |
44 | #error define USE_SHA1 or USE_SHA256 to set the HMAC hash algorithm | 44 | #error define USE_SHA1 or USE_SHA256 to set the HMAC hash algorithm |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #ifdef USE_SHA1 | 47 | #ifdef USE_SHA1 |
48 | 48 | ||
49 | #include "sha1.h" | 49 | #include "sha1.h" |
50 | 50 | ||
51 | #define HMAC_HASH_INPUT_SIZE SHA1_BLOCK_SIZE | 51 | #define HMAC_HASH_INPUT_SIZE SHA1_BLOCK_SIZE |
52 | #define HMAC_HASH_OUTPUT_SIZE SHA1_DIGEST_SIZE | 52 | #define HMAC_HASH_OUTPUT_SIZE SHA1_DIGEST_SIZE |
53 | #define sha_ctx sha1_ctx | 53 | #define sha_ctx sha1_ctx |
54 | #define sha_begin sha1_begin | 54 | #define sha_begin sha1_begin |
55 | #define sha_hash sha1_hash | 55 | #define sha_hash sha1_hash |
56 | #define sha_end sha1_end | 56 | #define sha_end sha1_end |
57 | 57 | ||
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifdef USE_SHA256 | 60 | #ifdef USE_SHA256 |
61 | 61 | ||
62 | #include "sha2.h" | 62 | #include "sha2.h" |
63 | 63 | ||
64 | #define HMAC_HASH_INPUT_SIZE SHA256_BLOCK_SIZE | 64 | #define HMAC_HASH_INPUT_SIZE SHA256_BLOCK_SIZE |
65 | #define HMAC_HASH_OUTPUT_SIZE SHA256_DIGEST_SIZE | 65 | #define HMAC_HASH_OUTPUT_SIZE SHA256_DIGEST_SIZE |
66 | #define sha_ctx sha256_ctx | 66 | #define sha_ctx sha256_ctx |
67 | #define sha_begin sha256_begin | 67 | #define sha_begin sha256_begin |
68 | #define sha_hash sha256_hash | 68 | #define sha_hash sha256_hash |
69 | #define sha_end sha256_end | 69 | #define sha_end sha256_end |
70 | 70 | ||
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #define HMAC_OK 0 | 73 | #define HMAC_OK 0 |
74 | #define HMAC_BAD_MODE -1 | 74 | #define HMAC_BAD_MODE -1 |
75 | #define HMAC_IN_DATA 0xffffffff | 75 | #define HMAC_IN_DATA 0xffffffff |
76 | 76 | ||
77 | typedef struct | 77 | typedef struct |
78 | { unsigned char key[HMAC_HASH_INPUT_SIZE]; | 78 | { unsigned char key[HMAC_HASH_INPUT_SIZE]; |
79 | sha_ctx ctx[1]; | 79 | sha_ctx ctx[1]; |
80 | unsigned long klen; | 80 | unsigned long klen; |
81 | } hmac_ctx; | 81 | } hmac_ctx; |
82 | 82 | ||
83 | void hmac_sha_begin(hmac_ctx cx[1]); | 83 | void hmac_sha_begin(hmac_ctx cx[1]); |
84 | 84 | ||
85 | int hmac_sha_key(const unsigned char key[], unsigned long key_len, hmac_ctx cx[1]); | 85 | int hmac_sha_key(const unsigned char key[], unsigned long key_len, hmac_ctx cx[1]); |
86 | 86 | ||
87 | void hmac_sha_data(const unsigned char data[], unsigned long data_len, hmac_ctx cx[1]); | 87 | void hmac_sha_data(const unsigned char data[], unsigned long data_len, hmac_ctx cx[1]); |
88 | 88 | ||
89 | void hmac_sha_end(unsigned char mac[], unsigned long mac_len, hmac_ctx cx[1]); | 89 | void hmac_sha_end(unsigned char mac[], unsigned long mac_len, hmac_ctx cx[1]); |
90 | 90 | ||
91 | void hmac_sha(const unsigned char key[], unsigned long key_len, | 91 | void hmac_sha(const unsigned char key[], unsigned long key_len, |
92 | const unsigned char data[], unsigned long data_len, | 92 | const unsigned char data[], unsigned long data_len, |
93 | unsigned char mac[], unsigned long mac_len); | 93 | unsigned char mac[], unsigned long mac_len); |
94 | 94 | ||
95 | #endif | 95 | #endif |