Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
idea.h
00001 /* idea.h 00002 * 00003 * Copyright (C) 2006-2016 wolfSSL Inc. 00004 * 00005 * This file is part of wolfSSL. 00006 * 00007 * wolfSSL is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * wolfSSL is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA 00020 */ 00021 00022 00023 #ifndef WOLF_CRYPT_IDEA_H 00024 #define WOLF_CRYPT_IDEA_H 00025 00026 #include <wolfssl/wolfcrypt/types.h> 00027 00028 #ifdef HAVE_IDEA 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 enum { 00035 IDEA_MODULO = 0x10001, /* 2^16+1 */ 00036 IDEA_2EXP16 = 0x10000, /* 2^16 */ 00037 IDEA_MASK = 0xFFFF, /* 16 bits set to one */ 00038 IDEA_ROUNDS = 8, /* number of rounds for IDEA */ 00039 IDEA_SK_NUM = (6*IDEA_ROUNDS + 4), /* number of subkeys */ 00040 IDEA_KEY_SIZE = 16, /* size of key in bytes */ 00041 IDEA_BLOCK_SIZE = 8, /* size of IDEA blocks in bytes */ 00042 IDEA_IV_SIZE = 8, /* size of IDEA IV in bytes */ 00043 IDEA_ENCRYPTION = 0, 00044 IDEA_DECRYPTION = 1 00045 }; 00046 00047 /* IDEA encryption and decryption */ 00048 typedef struct Idea { 00049 word32 reg[IDEA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ 00050 word32 tmp[IDEA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ 00051 word16 skey[IDEA_SK_NUM]; /* 832 bits expanded key */ 00052 } Idea; 00053 00054 WOLFSSL_API int wc_IdeaSetKey(Idea *idea, const byte* key, word16 keySz, 00055 const byte *iv, int dir); 00056 WOLFSSL_API int wc_IdeaSetIV(Idea *idea, const byte* iv); 00057 WOLFSSL_API void wc_IdeaCipher(Idea *idea, byte* out, const byte* in); 00058 WOLFSSL_API int wc_IdeaCbcEncrypt(Idea *idea, byte* out, 00059 const byte* in, word32 len); 00060 WOLFSSL_API int wc_IdeaCbcDecrypt(Idea *idea, byte* out, 00061 const byte* in, word32 len); 00062 #ifdef __cplusplus 00063 } /* extern "C" */ 00064 #endif 00065 00066 #endif /* HAVE_IDEA */ 00067 #endif /* WOLF_CRYPT_IDEA_H */ 00068
Generated on Tue Jul 12 2022 15:55:18 by
1.7.2