1*d3273b5bSchristos /* $NetBSD: camellia-ntt.h,v 1.2 2017/01/28 21:31:47 christos Exp $ */ 2ca1c9b0cSelric 3ca1c9b0cSelric /* camellia.h ver 1.2.0 4ca1c9b0cSelric * 5ca1c9b0cSelric * Copyright (c) 2006,2007 6ca1c9b0cSelric * NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved. 7ca1c9b0cSelric * 8ca1c9b0cSelric * Redistribution and use in source and binary forms, with or without 9ca1c9b0cSelric * modification, are permitted provided that the following conditions 10ca1c9b0cSelric * are met: 11ca1c9b0cSelric * 1. Redistributions of source code must retain the above copyright 12ca1c9b0cSelric * notice, this list of conditions and the following disclaimer as 13ca1c9b0cSelric * the first lines of this file unmodified. 14ca1c9b0cSelric * 2. Redistributions in binary form must reproduce the above copyright 15ca1c9b0cSelric * notice, this list of conditions and the following disclaimer in the 16ca1c9b0cSelric * documentation and/or other materials provided with the distribution. 17ca1c9b0cSelric * 18ca1c9b0cSelric * THIS SOFTWARE IS PROVIDED BY NTT ``AS IS'' AND ANY EXPRESS OR 19ca1c9b0cSelric * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20ca1c9b0cSelric * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21ca1c9b0cSelric * IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, INDIRECT, 22ca1c9b0cSelric * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23ca1c9b0cSelric * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24ca1c9b0cSelric * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25ca1c9b0cSelric * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26ca1c9b0cSelric * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27ca1c9b0cSelric * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28ca1c9b0cSelric */ 29ca1c9b0cSelric 30ca1c9b0cSelric #ifndef HEADER_CAMELLIA_H 31ca1c9b0cSelric #define HEADER_CAMELLIA_H 32ca1c9b0cSelric 33ca1c9b0cSelric #ifdef __cplusplus 34ca1c9b0cSelric extern "C" { 35ca1c9b0cSelric #endif 36ca1c9b0cSelric 37ca1c9b0cSelric #define CAMELLIA_BLOCK_SIZE 16 38ca1c9b0cSelric #define CAMELLIA_TABLE_BYTE_LEN 272 39ca1c9b0cSelric #define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) 40ca1c9b0cSelric 41ca1c9b0cSelric /* u32 must be 32bit word */ 42ca1c9b0cSelric typedef uint32_t u32; 43ca1c9b0cSelric typedef unsigned char u8; 44ca1c9b0cSelric 45ca1c9b0cSelric typedef u32 KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; 46ca1c9b0cSelric 47ca1c9b0cSelric 48ca1c9b0cSelric void Camellia_Ekeygen(const int keyBitLength, 49ca1c9b0cSelric const unsigned char *rawKey, 50ca1c9b0cSelric KEY_TABLE_TYPE keyTable); 51ca1c9b0cSelric 52ca1c9b0cSelric void Camellia_EncryptBlock(const int keyBitLength, 53ca1c9b0cSelric const unsigned char *plaintext, 54ca1c9b0cSelric const KEY_TABLE_TYPE keyTable, 55ca1c9b0cSelric unsigned char *cipherText); 56ca1c9b0cSelric 57ca1c9b0cSelric void Camellia_DecryptBlock(const int keyBitLength, 58ca1c9b0cSelric const unsigned char *cipherText, 59ca1c9b0cSelric const KEY_TABLE_TYPE keyTable, 60ca1c9b0cSelric unsigned char *plaintext); 61ca1c9b0cSelric 62ca1c9b0cSelric 63ca1c9b0cSelric #ifdef __cplusplus 64ca1c9b0cSelric } 65ca1c9b0cSelric #endif 66ca1c9b0cSelric 67ca1c9b0cSelric #endif /* HEADER_CAMELLIA_H */ 68