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

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

Issue 14249009: Change the NSS and NSPR source tree to the new directory structure to be (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « mozilla/security/nss/lib/freebl/rawhash.c ('k') | mozilla/security/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 /* $Id: rijndael.h,v 1.13 2012/09/28 22:46:32 rrelyea%redhat.com Exp $ */
5
6 #ifndef _RIJNDAEL_H_
7 #define _RIJNDAEL_H_ 1
8
9 #include "blapii.h"
10
11 #define RIJNDAEL_MIN_BLOCKSIZE 16 /* bytes */
12 #define RIJNDAEL_MAX_BLOCKSIZE 32 /* bytes */
13
14 typedef SECStatus AESBlockFunc(AESContext *cx,
15 unsigned char *output,
16 const unsigned char *input);
17
18 /* RIJNDAEL_NUM_ROUNDS
19 *
20 * Number of rounds per execution
21 * Nk - number of key bytes
22 * Nb - blocksize (in bytes)
23 */
24 #define RIJNDAEL_NUM_ROUNDS(Nk, Nb) \
25 (PR_MAX(Nk, Nb) + 6)
26
27 /* RIJNDAEL_MAX_STATE_SIZE
28 *
29 * Maximum number of bytes in the state (spec includes up to 256-bit block
30 * size)
31 */
32 #define RIJNDAEL_MAX_STATE_SIZE 32
33
34 /*
35 * This magic number is (Nb_max * (Nr_max + 1))
36 * where Nb_max is the maximum block size in 32-bit words,
37 * Nr_max is the maximum number of rounds, which is Nb_max + 6
38 */
39 #define RIJNDAEL_MAX_EXP_KEY_SIZE (8 * 15)
40
41 /* AESContextStr
42 *
43 * Values which maintain the state for Rijndael encryption/decryption.
44 *
45 * iv - initialization vector for CBC mode
46 * Nb - the number of bytes in a block, specified by user
47 * Nr - the number of rounds, specified by a table
48 * expandedKey - the round keys in 4-byte words, the length is Nr * Nb
49 * worker - the encryption/decryption function to use with worker_cx
50 * destroy - if not NULL, the destroy function to use with worker_cx
51 * worker_cx - the context for worker and destroy
52 * isBlock - is the mode of operation a block cipher or a stream cipher?
53 */
54 struct AESContextStr
55 {
56 unsigned int Nb;
57 unsigned int Nr;
58 freeblCipherFunc worker;
59 /* NOTE: The offsets of iv and expandedKey are hardcoded in intel-aes.s.
60 * Don't add new members before them without updating intel-aes.s. */
61 unsigned char iv[RIJNDAEL_MAX_BLOCKSIZE];
62 PRUint32 expandedKey[RIJNDAEL_MAX_EXP_KEY_SIZE];
63 freeblDestroyFunc destroy;
64 void *worker_cx;
65 PRBool isBlock;
66 };
67
68 #endif /* _RIJNDAEL_H_ */
OLDNEW
« no previous file with comments | « mozilla/security/nss/lib/freebl/rawhash.c ('k') | mozilla/security/nss/lib/freebl/rijndael.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698