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