wolfSSL SSL/TLS library, support up to TLS1.3

Dependents:   CyaSSL-Twitter-OAuth4Tw Example-client-tls-cert TwitterReader TweetTest ... more

Committer:
wolfSSL
Date:
Tue May 02 08:44:47 2017 +0000
Revision:
7:481bce714567
wolfSSL3.10.2

Who changed what in which revision?

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