Constants for new GOST TLS 1.2 ciphersuites
[openssl.git] / include / openssl / camellia.h
1 /*
2  * Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 #ifndef OPENSSL_CAMELLIA_H
11 # define OPENSSL_CAMELLIA_H
12 # pragma once
13
14 # include <openssl/macros.h>
15 # ifndef OPENSSL_NO_DEPRECATED_3_0
16 #  define HEADER_CAMELLIA_H
17 # endif
18
19 # include <openssl/opensslconf.h>
20
21 # ifndef OPENSSL_NO_CAMELLIA
22 # include <stddef.h>
23 #ifdef  __cplusplus
24 extern "C" {
25 #endif
26
27 # define CAMELLIA_BLOCK_SIZE 16
28
29 # ifndef OPENSSL_NO_DEPRECATED_3_0
30
31 #  define CAMELLIA_ENCRYPT        1
32 #  define CAMELLIA_DECRYPT        0
33
34 /*
35  * Because array size can't be a const in C, the following two are macros.
36  * Both sizes are in bytes.
37  */
38
39 /* This should be a hidden type, but EVP requires that the size be known */
40
41 #  define CAMELLIA_TABLE_BYTE_LEN 272
42 #  define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
43
44 typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
45                                                                * with WORD */
46
47 struct camellia_key_st {
48     union {
49         double d;               /* ensures 64-bit align */
50         KEY_TABLE_TYPE rd_key;
51     } u;
52     int grand_rounds;
53 };
54 typedef struct camellia_key_st CAMELLIA_KEY;
55
56 # endif /* OPENSSL_NO_DEPRECATED_3_0 */
57
58 DEPRECATEDIN_3_0(int Camellia_set_key(const unsigned char *userKey,
59                                       const int bits,
60                                       CAMELLIA_KEY *key))
61
62 DEPRECATEDIN_3_0(void Camellia_encrypt(const unsigned char *in,
63                                        unsigned char *out,
64                                        const CAMELLIA_KEY *key))
65 DEPRECATEDIN_3_0(void Camellia_decrypt(const unsigned char *in,
66                                        unsigned char *out,
67                                        const CAMELLIA_KEY *key))
68
69 DEPRECATEDIN_3_0(void Camellia_ecb_encrypt(const unsigned char *in,
70                                            unsigned char *out,
71                                            const CAMELLIA_KEY *key,
72                                            const int enc))
73 DEPRECATEDIN_3_0(void Camellia_cbc_encrypt(const unsigned char *in,
74                                            unsigned char *out,
75                                            size_t length, const
76                                            CAMELLIA_KEY *key,
77                                            unsigned char *ivec, const int enc))
78 DEPRECATEDIN_3_0(void Camellia_cfb128_encrypt(const unsigned char *in,
79                                               unsigned char *out,
80                                               size_t length,
81                                               const CAMELLIA_KEY *key,
82                                               unsigned char *ivec,
83                                               int *num,
84                                               const int enc))
85 DEPRECATEDIN_3_0(void Camellia_cfb1_encrypt(const unsigned char *in,
86                                             unsigned char *out,
87                                             size_t length,
88                                             const CAMELLIA_KEY *key,
89                                             unsigned char *ivec,
90                                             int *num,
91                                             const int enc))
92 DEPRECATEDIN_3_0(void Camellia_cfb8_encrypt(const unsigned char *in,
93                                             unsigned char *out,
94                                             size_t length,
95                                             const CAMELLIA_KEY *key,
96                                             unsigned char *ivec,
97                                             int *num,
98                                             const int enc))
99 DEPRECATEDIN_3_0(void Camellia_ofb128_encrypt(const unsigned char *in,
100                                               unsigned char *out,
101                                               size_t length,
102                                               const CAMELLIA_KEY *key,
103                                               unsigned char *ivec,
104                                               int *num))
105 DEPRECATEDIN_3_0(void Camellia_ctr128_encrypt(const unsigned char *in,
106                                               unsigned char *out,
107                                               size_t length,
108                                               const CAMELLIA_KEY *key,
109                                               unsigned char ivec[CAMELLIA_BLOCK_SIZE],
110                                               unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
111                                               unsigned int *num))
112
113 # ifdef  __cplusplus
114 }
115 # endif
116 # endif
117
118 #endif