xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/include/openssl/idea.h (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos /*
2*4724848cSchristos  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3*4724848cSchristos  *
4*4724848cSchristos  * Licensed under the OpenSSL license (the "License").  You may not use
5*4724848cSchristos  * this file except in compliance with the License.  You can obtain a copy
6*4724848cSchristos  * in the file LICENSE in the source distribution or at
7*4724848cSchristos  * https://www.openssl.org/source/license.html
8*4724848cSchristos  */
9*4724848cSchristos 
10*4724848cSchristos #ifndef HEADER_IDEA_H
11*4724848cSchristos # define HEADER_IDEA_H
12*4724848cSchristos 
13*4724848cSchristos # include <openssl/opensslconf.h>
14*4724848cSchristos 
15*4724848cSchristos # ifndef OPENSSL_NO_IDEA
16*4724848cSchristos # ifdef  __cplusplus
17*4724848cSchristos extern "C" {
18*4724848cSchristos # endif
19*4724848cSchristos 
20*4724848cSchristos typedef unsigned int IDEA_INT;
21*4724848cSchristos 
22*4724848cSchristos # define IDEA_ENCRYPT    1
23*4724848cSchristos # define IDEA_DECRYPT    0
24*4724848cSchristos 
25*4724848cSchristos # define IDEA_BLOCK      8
26*4724848cSchristos # define IDEA_KEY_LENGTH 16
27*4724848cSchristos 
28*4724848cSchristos typedef struct idea_key_st {
29*4724848cSchristos     IDEA_INT data[9][6];
30*4724848cSchristos } IDEA_KEY_SCHEDULE;
31*4724848cSchristos 
32*4724848cSchristos const char *IDEA_options(void);
33*4724848cSchristos void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out,
34*4724848cSchristos                       IDEA_KEY_SCHEDULE *ks);
35*4724848cSchristos void IDEA_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);
36*4724848cSchristos void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
37*4724848cSchristos void IDEA_cbc_encrypt(const unsigned char *in, unsigned char *out,
38*4724848cSchristos                       long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
39*4724848cSchristos                       int enc);
40*4724848cSchristos void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out,
41*4724848cSchristos                         long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
42*4724848cSchristos                         int *num, int enc);
43*4724848cSchristos void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out,
44*4724848cSchristos                         long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
45*4724848cSchristos                         int *num);
46*4724848cSchristos void IDEA_encrypt(unsigned int *in, IDEA_KEY_SCHEDULE *ks);
47*4724848cSchristos 
48*4724848cSchristos # if OPENSSL_API_COMPAT < 0x10100000L
49*4724848cSchristos #  define idea_options          IDEA_options
50*4724848cSchristos #  define idea_ecb_encrypt      IDEA_ecb_encrypt
51*4724848cSchristos #  define idea_set_encrypt_key  IDEA_set_encrypt_key
52*4724848cSchristos #  define idea_set_decrypt_key  IDEA_set_decrypt_key
53*4724848cSchristos #  define idea_cbc_encrypt      IDEA_cbc_encrypt
54*4724848cSchristos #  define idea_cfb64_encrypt    IDEA_cfb64_encrypt
55*4724848cSchristos #  define idea_ofb64_encrypt    IDEA_ofb64_encrypt
56*4724848cSchristos #  define idea_encrypt          IDEA_encrypt
57*4724848cSchristos # endif
58*4724848cSchristos 
59*4724848cSchristos # ifdef  __cplusplus
60*4724848cSchristos }
61*4724848cSchristos # endif
62*4724848cSchristos # endif
63*4724848cSchristos 
64*4724848cSchristos #endif
65