michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _CAMELLIA_H_ michael@0: #define _CAMELLIA_H_ 1 michael@0: michael@0: #define CAMELLIA_BLOCK_SIZE 16 /* bytes */ michael@0: #define CAMELLIA_MIN_KEYSIZE 16 /* bytes */ michael@0: #define CAMELLIA_MAX_KEYSIZE 32 /* bytes */ michael@0: michael@0: #define CAMELLIA_MAX_EXPANDEDKEY (34*2) /* 32bit unit */ michael@0: michael@0: typedef PRUint32 KEY_TABLE_TYPE[CAMELLIA_MAX_EXPANDEDKEY]; michael@0: michael@0: typedef SECStatus CamelliaFunc(CamelliaContext *cx, unsigned char *output, michael@0: unsigned int *outputLen, michael@0: unsigned int maxOutputLen, michael@0: const unsigned char *input, michael@0: unsigned int inputLen); michael@0: michael@0: typedef SECStatus CamelliaBlockFunc(const PRUint32 *subkey, michael@0: unsigned char *output, michael@0: const unsigned char *input); michael@0: michael@0: /* CamelliaContextStr michael@0: * michael@0: * Values which maintain the state for Camellia encryption/decryption. michael@0: * michael@0: * keysize - the number of key bits michael@0: * worker - the encryption/decryption function to use with this context michael@0: * iv - initialization vector for CBC mode michael@0: * expandedKey - the round keys in 4-byte words michael@0: */ michael@0: struct CamelliaContextStr michael@0: { michael@0: PRUint32 keysize; /* bytes */ michael@0: CamelliaFunc *worker; michael@0: PRUint32 expandedKey[CAMELLIA_MAX_EXPANDEDKEY]; michael@0: PRUint8 iv[CAMELLIA_BLOCK_SIZE]; michael@0: }; michael@0: michael@0: #endif /* _CAMELLIA_H_ */