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

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

Committer:
wolfSSL
Date:
Tue Aug 22 10:48:22 2017 +0000
Revision:
13:f67a6c6013ca
wolfSSL3.12.0 with TLS1.3

Who changed what in which revision?

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