Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Side by Side Diff: nss/lib/freebl/rijndael.h

Issue 2078763002: Delete bundled copy of NSS and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss@master
Patch Set: Delete bundled copy of NSS and replace with README. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « nss/lib/freebl/rawhash.c ('k') | nss/lib/freebl/rijndael.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_ */
OLDNEW
« no previous file with comments | « nss/lib/freebl/rawhash.c ('k') | nss/lib/freebl/rijndael.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698