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/fileenc.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 '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/aesGladman/fileenc.h | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/aesGladman/fileenc.h b/libraries/irrlicht-1.8/source/Irrlicht/aesGladman/fileenc.h index ba5cabc..f1b7619 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/aesGladman/fileenc.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/aesGladman/fileenc.h | |||
@@ -1,114 +1,114 @@ | |||
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: 24/01/2003 | 31 | Issue Date: 24/01/2003 |
32 | 32 | ||
33 | This file contains the header file for fileenc.c, which implements password | 33 | This file contains the header file for fileenc.c, which implements password |
34 | based file encryption and authentication using AES in CTR mode, HMAC-SHA1 | 34 | based file encryption and authentication using AES in CTR mode, HMAC-SHA1 |
35 | authentication and RFC2898 password based key derivation. | 35 | authentication and RFC2898 password based key derivation. |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #ifndef _FENC_H | 38 | #ifndef _FENC_H |
39 | #define _FENC_H | 39 | #define _FENC_H |
40 | 40 | ||
41 | #include "aes.h" | 41 | #include "aes.h" |
42 | #include "hmac.h" | 42 | #include "hmac.h" |
43 | #include "pwd2key.h" | 43 | #include "pwd2key.h" |
44 | 44 | ||
45 | #define BLOCK_SIZE AES_BLOCK_SIZE | 45 | #define BLOCK_SIZE AES_BLOCK_SIZE |
46 | #define PASSWORD_VERIFIER | 46 | #define PASSWORD_VERIFIER |
47 | 47 | ||
48 | #define MAX_KEY_LENGTH 32 | 48 | #define MAX_KEY_LENGTH 32 |
49 | #define MAX_PWD_LENGTH 128 | 49 | #define MAX_PWD_LENGTH 128 |
50 | #define MAX_SALT_LENGTH 16 | 50 | #define MAX_SALT_LENGTH 16 |
51 | #define KEYING_ITERATIONS 1000 | 51 | #define KEYING_ITERATIONS 1000 |
52 | 52 | ||
53 | #ifdef PASSWORD_VERIFIER | 53 | #ifdef PASSWORD_VERIFIER |
54 | #define PWD_VER_LENGTH 2 | 54 | #define PWD_VER_LENGTH 2 |
55 | #else | 55 | #else |
56 | #define PWD_VER_LENGTH 0 | 56 | #define PWD_VER_LENGTH 0 |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #define GOOD_RETURN 0 | 59 | #define GOOD_RETURN 0 |
60 | #define PASSWORD_TOO_LONG -100 | 60 | #define PASSWORD_TOO_LONG -100 |
61 | #define BAD_MODE -101 | 61 | #define BAD_MODE -101 |
62 | 62 | ||
63 | /* | 63 | /* |
64 | Field lengths (in bytes) versus File Encryption Mode (0 < mode < 4) | 64 | Field lengths (in bytes) versus File Encryption Mode (0 < mode < 4) |
65 | 65 | ||
66 | Mode Key Salt MAC Overhead | 66 | Mode Key Salt MAC Overhead |
67 | 1 16 8 10 18 | 67 | 1 16 8 10 18 |
68 | 2 24 12 10 22 | 68 | 2 24 12 10 22 |
69 | 3 32 16 10 26 | 69 | 3 32 16 10 26 |
70 | 70 | ||
71 | The following macros assume that the mode value is correct. | 71 | The following macros assume that the mode value is correct. |
72 | */ | 72 | */ |
73 | 73 | ||
74 | #define KEY_LENGTH(mode) (8 * (mode & 3) + 8) | 74 | #define KEY_LENGTH(mode) (8 * (mode & 3) + 8) |
75 | #define SALT_LENGTH(mode) (4 * (mode & 3) + 4) | 75 | #define SALT_LENGTH(mode) (4 * (mode & 3) + 4) |
76 | #define MAC_LENGTH(mode) (10) | 76 | #define MAC_LENGTH(mode) (10) |
77 | 77 | ||
78 | /* the context for file encryption */ | 78 | /* the context for file encryption */ |
79 | 79 | ||
80 | typedef struct | 80 | typedef struct |
81 | { unsigned char nonce[BLOCK_SIZE]; /* the CTR nonce */ | 81 | { unsigned char nonce[BLOCK_SIZE]; /* the CTR nonce */ |
82 | unsigned char encr_bfr[BLOCK_SIZE]; /* encrypt buffer */ | 82 | unsigned char encr_bfr[BLOCK_SIZE]; /* encrypt buffer */ |
83 | aes_encrypt_ctx encr_ctx[1]; /* encryption context */ | 83 | aes_encrypt_ctx encr_ctx[1]; /* encryption context */ |
84 | hmac_ctx auth_ctx[1]; /* authentication context */ | 84 | hmac_ctx auth_ctx[1]; /* authentication context */ |
85 | unsigned int encr_pos; /* block position (enc) */ | 85 | unsigned int encr_pos; /* block position (enc) */ |
86 | unsigned int pwd_len; /* password length */ | 86 | unsigned int pwd_len; /* password length */ |
87 | unsigned int mode; /* File encryption mode */ | 87 | unsigned int mode; /* File encryption mode */ |
88 | } fcrypt_ctx; | 88 | } fcrypt_ctx; |
89 | 89 | ||
90 | /* initialise file encryption or decryption */ | 90 | /* initialise file encryption or decryption */ |
91 | 91 | ||
92 | int fcrypt_init( | 92 | int fcrypt_init( |
93 | int mode, /* the mode to be used (input) */ | 93 | int mode, /* the mode to be used (input) */ |
94 | const unsigned char pwd[], /* the user specified password (input) */ | 94 | const unsigned char pwd[], /* the user specified password (input) */ |
95 | unsigned int pwd_len, /* the length of the password (input) */ | 95 | unsigned int pwd_len, /* the length of the password (input) */ |
96 | const unsigned char salt[], /* the salt (input) */ | 96 | const unsigned char salt[], /* the salt (input) */ |
97 | #ifdef PASSWORD_VERIFIER | 97 | #ifdef PASSWORD_VERIFIER |
98 | unsigned char pwd_ver[PWD_VER_LENGTH], /* 2 byte password verifier (output) */ | 98 | unsigned char pwd_ver[PWD_VER_LENGTH], /* 2 byte password verifier (output) */ |
99 | #endif | 99 | #endif |
100 | fcrypt_ctx cx[1]); /* the file encryption context (output) */ | 100 | fcrypt_ctx cx[1]); /* the file encryption context (output) */ |
101 | 101 | ||
102 | /* perform 'in place' encryption or decryption and authentication */ | 102 | /* perform 'in place' encryption or decryption and authentication */ |
103 | 103 | ||
104 | void fcrypt_encrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1]); | 104 | void fcrypt_encrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1]); |
105 | void fcrypt_decrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1]); | 105 | void fcrypt_decrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1]); |
106 | 106 | ||
107 | /* close encryption/decryption and return the MAC value */ | 107 | /* close encryption/decryption and return the MAC value */ |
108 | /* the return value is the length of the MAC */ | 108 | /* the return value is the length of the MAC */ |
109 | 109 | ||
110 | int fcrypt_end(unsigned char mac[], /* the MAC value (output) */ | 110 | int fcrypt_end(unsigned char mac[], /* the MAC value (output) */ |
111 | fcrypt_ctx cx[1]); /* the context (input) */ | 111 | fcrypt_ctx cx[1]); /* the context (input) */ |
112 | 112 | ||
113 | #endif | 113 | #endif |
114 | 114 | ||