fork of cyassl-lib

Dependents:   TLS_cyassl TLS_cyassl

Committer:
ashleymills
Date:
Thu Sep 05 10:33:04 2013 +0000
Revision:
0:714293de3836
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 0:714293de3836 1 /* camellia.h ver 1.2.0
ashleymills 0:714293de3836 2 *
ashleymills 0:714293de3836 3 * Copyright (c) 2006,2007
ashleymills 0:714293de3836 4 * NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
ashleymills 0:714293de3836 5 *
ashleymills 0:714293de3836 6 * Redistribution and use in source and binary forms, with or without
ashleymills 0:714293de3836 7 * modification, are permitted provided that the following conditions
ashleymills 0:714293de3836 8 * are met:
ashleymills 0:714293de3836 9 * 1. Redistributions of source code must retain the above copyright
ashleymills 0:714293de3836 10 * notice, this list of conditions and the following disclaimer as
ashleymills 0:714293de3836 11 * the first lines of this file unmodified.
ashleymills 0:714293de3836 12 * 2. Redistributions in binary form must reproduce the above copyright
ashleymills 0:714293de3836 13 * notice, this list of conditions and the following disclaimer in the
ashleymills 0:714293de3836 14 * documentation and/or other materials provided with the distribution.
ashleymills 0:714293de3836 15 *
ashleymills 0:714293de3836 16 * THIS SOFTWARE IS PROVIDED BY NTT ``AS IS'' AND ANY EXPRESS OR
ashleymills 0:714293de3836 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
ashleymills 0:714293de3836 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
ashleymills 0:714293de3836 19 * IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, INDIRECT,
ashleymills 0:714293de3836 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
ashleymills 0:714293de3836 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
ashleymills 0:714293de3836 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
ashleymills 0:714293de3836 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
ashleymills 0:714293de3836 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
ashleymills 0:714293de3836 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ashleymills 0:714293de3836 26 */
ashleymills 0:714293de3836 27
ashleymills 0:714293de3836 28 /* camellia.h
ashleymills 0:714293de3836 29 *
ashleymills 0:714293de3836 30 * Copyright (C) 2006-2013 wolfSSL Inc.
ashleymills 0:714293de3836 31 *
ashleymills 0:714293de3836 32 * This file is part of CyaSSL.
ashleymills 0:714293de3836 33 *
ashleymills 0:714293de3836 34 * CyaSSL is free software; you can redistribute it and/or modify
ashleymills 0:714293de3836 35 * it under the terms of the GNU General Public License as published by
ashleymills 0:714293de3836 36 * the Free Software Foundation; either version 2 of the License, or
ashleymills 0:714293de3836 37 * (at your option) any later version.
ashleymills 0:714293de3836 38 *
ashleymills 0:714293de3836 39 * CyaSSL is distributed in the hope that it will be useful,
ashleymills 0:714293de3836 40 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ashleymills 0:714293de3836 41 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ashleymills 0:714293de3836 42 * GNU General Public License for more details.
ashleymills 0:714293de3836 43 *
ashleymills 0:714293de3836 44 * You should have received a copy of the GNU General Public License
ashleymills 0:714293de3836 45 * along with this program; if not, write to the Free Software
ashleymills 0:714293de3836 46 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
ashleymills 0:714293de3836 47 */
ashleymills 0:714293de3836 48
ashleymills 0:714293de3836 49 #ifdef HAVE_CAMELLIA
ashleymills 0:714293de3836 50
ashleymills 0:714293de3836 51 #ifndef CTAO_CRYPT_CAMELLIA_H
ashleymills 0:714293de3836 52 #define CTAO_CRYPT_CAMELLIA_H
ashleymills 0:714293de3836 53
ashleymills 0:714293de3836 54
ashleymills 0:714293de3836 55 #include <cyassl/ctaocrypt/types.h>
ashleymills 0:714293de3836 56
ashleymills 0:714293de3836 57 #ifdef __cplusplus
ashleymills 0:714293de3836 58 extern "C" {
ashleymills 0:714293de3836 59 #endif
ashleymills 0:714293de3836 60
ashleymills 0:714293de3836 61
ashleymills 0:714293de3836 62 enum {
ashleymills 0:714293de3836 63 CAMELLIA_BLOCK_SIZE = 16
ashleymills 0:714293de3836 64 };
ashleymills 0:714293de3836 65
ashleymills 0:714293de3836 66 #define CAMELLIA_TABLE_BYTE_LEN 272
ashleymills 0:714293de3836 67 #define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / sizeof(word32))
ashleymills 0:714293de3836 68
ashleymills 0:714293de3836 69 typedef word32 KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN];
ashleymills 0:714293de3836 70
ashleymills 0:714293de3836 71 typedef struct Camellia {
ashleymills 0:714293de3836 72 word32 keySz;
ashleymills 0:714293de3836 73 KEY_TABLE_TYPE key;
ashleymills 0:714293de3836 74 word32 reg[CAMELLIA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
ashleymills 0:714293de3836 75 word32 tmp[CAMELLIA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
ashleymills 0:714293de3836 76 } Camellia;
ashleymills 0:714293de3836 77
ashleymills 0:714293de3836 78
ashleymills 0:714293de3836 79 CYASSL_API int CamelliaSetKey(Camellia* cam,
ashleymills 0:714293de3836 80 const byte* key, word32 len, const byte* iv);
ashleymills 0:714293de3836 81 CYASSL_API int CamelliaSetIV(Camellia* cam, const byte* iv);
ashleymills 0:714293de3836 82 CYASSL_API void CamelliaEncryptDirect(Camellia* cam, byte* out, const byte* in);
ashleymills 0:714293de3836 83 CYASSL_API void CamelliaDecryptDirect(Camellia* cam, byte* out, const byte* in);
ashleymills 0:714293de3836 84 CYASSL_API void CamelliaCbcEncrypt(Camellia* cam,
ashleymills 0:714293de3836 85 byte* out, const byte* in, word32 sz);
ashleymills 0:714293de3836 86 CYASSL_API void CamelliaCbcDecrypt(Camellia* cam,
ashleymills 0:714293de3836 87 byte* out, const byte* in, word32 sz);
ashleymills 0:714293de3836 88
ashleymills 0:714293de3836 89
ashleymills 0:714293de3836 90 #ifdef __cplusplus
ashleymills 0:714293de3836 91 } /* extern "C" */
ashleymills 0:714293de3836 92 #endif
ashleymills 0:714293de3836 93
ashleymills 0:714293de3836 94 #endif /* CTAO_CRYPT_AES_H */
ashleymills 0:714293de3836 95 #endif /* HAVE_CAMELLIA */
ashleymills 0:714293de3836 96