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

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers camellia.h Source File

camellia.h

Go to the documentation of this file.
00001 /* camellia.h ver 1.2.0
00002  *
00003  * Copyright (c) 2006,2007
00004  * NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer as
00011  *   the first lines of this file unmodified.
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  *   notice, this list of conditions and the following disclaimer in the
00014  *   documentation and/or other materials provided with the distribution.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY NTT ``AS IS'' AND ANY EXPRESS OR
00017  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00018  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00019  * IN NO EVENT SHALL NTT BE LIABLE FOR ANY DIRECT, INDIRECT,
00020  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00021  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00022  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00023  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00025  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  */
00027 
00028 /* camellia.h
00029  *
00030  * Copyright (C) 2006-2020 wolfSSL Inc.
00031  *
00032  * This file is part of wolfSSL.
00033  *
00034  * wolfSSL is free software; you can redistribute it and/or modify
00035  * it under the terms of the GNU General Public License as published by
00036  * the Free Software Foundation; either version 2 of the License, or
00037  * (at your option) any later version.
00038  *
00039  * wolfSSL is distributed in the hope that it will be useful,
00040  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00041  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00042  * GNU General Public License for more details.
00043  *
00044  * You should have received a copy of the GNU General Public License
00045  * along with this program; if not, write to the Free Software
00046  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00047  */
00048 
00049 /*!
00050     \file wolfssl/wolfcrypt/camellia.h
00051 */
00052 
00053 
00054 #ifndef WOLF_CRYPT_CAMELLIA_H
00055 #define WOLF_CRYPT_CAMELLIA_H
00056 
00057 #include <wolfssl/wolfcrypt/types.h >
00058 
00059 #ifdef HAVE_CAMELLIA
00060 
00061 #ifdef __cplusplus
00062     extern "C" {
00063 #endif
00064 
00065 enum {
00066     CAMELLIA_BLOCK_SIZE = 16
00067 };
00068 
00069 #define CAMELLIA_TABLE_BYTE_LEN 272
00070 #define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / sizeof(word32))
00071 
00072 typedef word32 KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN];
00073 
00074 typedef struct Camellia {
00075     word32 keySz;
00076     KEY_TABLE_TYPE key;
00077     word32 reg[CAMELLIA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
00078     word32 tmp[CAMELLIA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
00079 } Camellia;
00080 
00081 
00082 WOLFSSL_API int  wc_CamelliaSetKey(Camellia* cam,
00083                                    const byte* key, word32 len, const byte* iv);
00084 WOLFSSL_API int  wc_CamelliaSetIV(Camellia* cam, const byte* iv);
00085 WOLFSSL_API int  wc_CamelliaEncryptDirect(Camellia* cam, byte* out,
00086                                                                 const byte* in);
00087 WOLFSSL_API int  wc_CamelliaDecryptDirect(Camellia* cam, byte* out,
00088                                                                 const byte* in);
00089 WOLFSSL_API int wc_CamelliaCbcEncrypt(Camellia* cam,
00090                                           byte* out, const byte* in, word32 sz);
00091 WOLFSSL_API int wc_CamelliaCbcDecrypt(Camellia* cam,
00092                                           byte* out, const byte* in, word32 sz);
00093 
00094 
00095 #ifdef __cplusplus
00096     } /* extern "C" */
00097 #endif
00098 
00099 #endif /* HAVE_CAMELLIA */
00100 #endif /* WOLF_CRYPT_CAMELLIA_H */
00101 
00102