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