Mercurial > trustbridge > nss-cmake-static
comparison nss/lib/freebl/rijndael.h @ 0:1e5118fa0cb1
This is NSS with a Cmake Buildsyste
To compile a static NSS library for Windows we've used the
Chromium-NSS fork and added a Cmake buildsystem to compile
it statically for Windows. See README.chromium for chromium
changes and README.trustbridge for our modifications.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 28 Jul 2014 10:47:06 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1e5118fa0cb1 |
---|---|
1 /* This Source Code Form is subject to the terms of the Mozilla Public | |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
4 | |
5 #ifndef _RIJNDAEL_H_ | |
6 #define _RIJNDAEL_H_ 1 | |
7 | |
8 #include "blapii.h" | |
9 | |
10 #define RIJNDAEL_MIN_BLOCKSIZE 16 /* bytes */ | |
11 #define RIJNDAEL_MAX_BLOCKSIZE 32 /* bytes */ | |
12 | |
13 typedef SECStatus AESBlockFunc(AESContext *cx, | |
14 unsigned char *output, | |
15 const unsigned char *input); | |
16 | |
17 /* RIJNDAEL_NUM_ROUNDS | |
18 * | |
19 * Number of rounds per execution | |
20 * Nk - number of key bytes | |
21 * Nb - blocksize (in bytes) | |
22 */ | |
23 #define RIJNDAEL_NUM_ROUNDS(Nk, Nb) \ | |
24 (PR_MAX(Nk, Nb) + 6) | |
25 | |
26 /* RIJNDAEL_MAX_STATE_SIZE | |
27 * | |
28 * Maximum number of bytes in the state (spec includes up to 256-bit block | |
29 * size) | |
30 */ | |
31 #define RIJNDAEL_MAX_STATE_SIZE 32 | |
32 | |
33 /* | |
34 * This magic number is (Nb_max * (Nr_max + 1)) | |
35 * where Nb_max is the maximum block size in 32-bit words, | |
36 * Nr_max is the maximum number of rounds, which is Nb_max + 6 | |
37 */ | |
38 #define RIJNDAEL_MAX_EXP_KEY_SIZE (8 * 15) | |
39 | |
40 /* AESContextStr | |
41 * | |
42 * Values which maintain the state for Rijndael encryption/decryption. | |
43 * | |
44 * iv - initialization vector for CBC mode | |
45 * Nb - the number of bytes in a block, specified by user | |
46 * Nr - the number of rounds, specified by a table | |
47 * expandedKey - the round keys in 4-byte words, the length is Nr * Nb | |
48 * worker - the encryption/decryption function to use with worker_cx | |
49 * destroy - if not NULL, the destroy function to use with worker_cx | |
50 * worker_cx - the context for worker and destroy | |
51 * isBlock - is the mode of operation a block cipher or a stream cipher? | |
52 */ | |
53 struct AESContextStr | |
54 { | |
55 unsigned int Nb; | |
56 unsigned int Nr; | |
57 freeblCipherFunc worker; | |
58 /* NOTE: The offsets of iv and expandedKey are hardcoded in intel-aes.s. | |
59 * Don't add new members before them without updating intel-aes.s. */ | |
60 unsigned char iv[RIJNDAEL_MAX_BLOCKSIZE]; | |
61 PRUint32 expandedKey[RIJNDAEL_MAX_EXP_KEY_SIZE]; | |
62 freeblDestroyFunc destroy; | |
63 void *worker_cx; | |
64 PRBool isBlock; | |
65 }; | |
66 | |
67 #endif /* _RIJNDAEL_H_ */ |