source: asp3_tinet_ecnl_arm/trunk/wolfssl-3.12.2/wolfssl/wolfcrypt/idea.h@ 352

Last change on this file since 352 was 352, checked in by coas-nagasima, 6 years ago

arm向けASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 2.4 KB
Line 
1/* idea.h
2 *
3 * Copyright (C) 2006-2017 wolfSSL Inc.
4 *
5 * This file is part of wolfSSL.
6 *
7 * wolfSSL is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * wolfSSL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20 */
21
22
23#ifndef WOLF_CRYPT_IDEA_H
24#define WOLF_CRYPT_IDEA_H
25
26#include <wolfssl/wolfcrypt/types.h>
27
28#ifdef HAVE_IDEA
29
30#ifdef __cplusplus
31 extern "C" {
32#endif
33
34enum {
35 IDEA_MODULO = 0x10001, /* 2^16+1 */
36 IDEA_2EXP16 = 0x10000, /* 2^16 */
37 IDEA_MASK = 0xFFFF, /* 16 bits set to one */
38 IDEA_ROUNDS = 8, /* number of rounds for IDEA */
39 IDEA_SK_NUM = (6*IDEA_ROUNDS + 4), /* number of subkeys */
40 IDEA_KEY_SIZE = 16, /* size of key in bytes */
41 IDEA_BLOCK_SIZE = 8, /* size of IDEA blocks in bytes */
42 IDEA_IV_SIZE = 8, /* size of IDEA IV in bytes */
43 IDEA_ENCRYPTION = 0,
44 IDEA_DECRYPTION = 1
45};
46
47/* IDEA encryption and decryption */
48typedef struct Idea {
49 word32 reg[IDEA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
50 word32 tmp[IDEA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
51 word16 skey[IDEA_SK_NUM]; /* 832 bits expanded key */
52} Idea;
53
54WOLFSSL_API int wc_IdeaSetKey(Idea *idea, const byte* key, word16 keySz,
55 const byte *iv, int dir);
56WOLFSSL_API int wc_IdeaSetIV(Idea *idea, const byte* iv);
57WOLFSSL_API int wc_IdeaCipher(Idea *idea, byte* out, const byte* in);
58WOLFSSL_API int wc_IdeaCbcEncrypt(Idea *idea, byte* out,
59 const byte* in, word32 len);
60WOLFSSL_API int wc_IdeaCbcDecrypt(Idea *idea, byte* out,
61 const byte* in, word32 len);
62#ifdef __cplusplus
63 } /* extern "C" */
64#endif
65
66#endif /* HAVE_IDEA */
67#endif /* WOLF_CRYPT_IDEA_H */
Note: See TracBrowser for help on using the repository browser.