2 * Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
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
10 #ifndef OPENSSL_CAMELLIA_H
11 # define OPENSSL_CAMELLIA_H
14 # include <openssl/macros.h>
15 # ifndef OPENSSL_NO_DEPRECATED_3_0
16 # define HEADER_CAMELLIA_H
19 # include <openssl/opensslconf.h>
21 # ifndef OPENSSL_NO_CAMELLIA
27 # define CAMELLIA_BLOCK_SIZE 16
29 # ifndef OPENSSL_NO_DEPRECATED_3_0
31 # define CAMELLIA_ENCRYPT 1
32 # define CAMELLIA_DECRYPT 0
35 * Because array size can't be a const in C, the following two are macros.
36 * Both sizes are in bytes.
39 /* This should be a hidden type, but EVP requires that the size be known */
41 # define CAMELLIA_TABLE_BYTE_LEN 272
42 # define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
44 typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
47 struct camellia_key_st {
49 double d; /* ensures 64-bit align */
50 KEY_TABLE_TYPE rd_key;
54 typedef struct camellia_key_st CAMELLIA_KEY;
56 # endif /* OPENSSL_NO_DEPRECATED_3_0 */
57 # ifndef OPENSSL_NO_DEPRECATED_3_0
58 OSSL_DEPRECATEDIN_3_0 int Camellia_set_key(const unsigned char *userKey,
61 OSSL_DEPRECATEDIN_3_0 void Camellia_encrypt(const unsigned char *in,
63 const CAMELLIA_KEY *key);
64 OSSL_DEPRECATEDIN_3_0 void Camellia_decrypt(const unsigned char *in,
66 const CAMELLIA_KEY *key);
67 OSSL_DEPRECATEDIN_3_0 void Camellia_ecb_encrypt(const unsigned char *in,
69 const CAMELLIA_KEY *key,
71 OSSL_DEPRECATEDIN_3_0 void Camellia_cbc_encrypt(const unsigned char *in,
74 const CAMELLIA_KEY *key,
77 OSSL_DEPRECATEDIN_3_0 void Camellia_cfb128_encrypt(const unsigned char *in,
80 const CAMELLIA_KEY *key,
84 OSSL_DEPRECATEDIN_3_0 void Camellia_cfb1_encrypt(const unsigned char *in,
87 const CAMELLIA_KEY *key,
91 OSSL_DEPRECATEDIN_3_0 void Camellia_cfb8_encrypt(const unsigned char *in,
94 const CAMELLIA_KEY *key,
98 OSSL_DEPRECATEDIN_3_0 void Camellia_ofb128_encrypt(const unsigned char *in,
101 const CAMELLIA_KEY *key,
104 OSSL_DEPRECATEDIN_3_0
105 void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
106 size_t length, const CAMELLIA_KEY *key,
107 unsigned char ivec[CAMELLIA_BLOCK_SIZE],
108 unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],