/* camellia.h ver 1.1.01*2* Copyright (c) 20063* NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer as10* the first lines of this file unmodified.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY NTT ``AS IS'' AND ANY EXPRESS OR16* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES17* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.18* IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, INDIRECT,19* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT20* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,21* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY22* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF24* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.25*/2627#ifndef _CAMELLIA_H28#define _CAMELLIA_H2930#define CAMELLIA_BLOCK_SIZE 1631#define CAMELLIA_SUBKEYWORD 68 /* (34*8/4) */3233typedef struct {34int bits; /* key-length */35uint32_t subkey[CAMELLIA_SUBKEYWORD]; /* encrypt/decrypt key schedule */36} camellia_ctx;3738void camellia_set_key(camellia_ctx *, const u_char *, int);39void camellia_decrypt(const camellia_ctx *, const u_char *, u_char *);40void camellia_encrypt(const camellia_ctx *, const u_char *, u_char *);414243void Camellia_Ekeygen(const int keyBitLength,44const unsigned char *rawKey,45uint32_t *subkey);4647void Camellia_EncryptBlock(const int keyBitLength,48const unsigned char *plaintext,49const uint32_t *subkey,50unsigned char *cipherText);5152void Camellia_DecryptBlock(const int keyBitLength,53const unsigned char *cipherText,54const uint32_t *subkey,55unsigned char *plaintext);5657void camellia_setup128(const unsigned char *key, uint32_t *subkey);58void camellia_setup192(const unsigned char *key, uint32_t *subkey);59void camellia_setup256(const unsigned char *key, uint32_t *subkey);60void camellia_encrypt128(const uint32_t *subkey, uint32_t *io);61void camellia_encrypt256(const uint32_t *subkey, uint32_t *io);62void camellia_decrypt128(const uint32_t *subkey, uint32_t *io);63void camellia_decrypt256(const uint32_t *subkey, uint32_t *io);646566#endif /* _CAMELLIA_H */676869