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