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