]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/camellia.h
Fix typo in CONTRIBUTING.md
[thirdparty/openssl.git] / include / openssl / camellia.h
CommitLineData
21dcbebc 1/*
33388b44 2 * Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
67912e00 3 *
48f4ad77 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
21dcbebc
RS
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
67912e00
BM
8 */
9
ae4186b0
DMSP
10#ifndef OPENSSL_CAMELLIA_H
11# define OPENSSL_CAMELLIA_H
d86167ec
DMSP
12# pragma once
13
14# include <openssl/macros.h>
936c2b9e 15# ifndef OPENSSL_NO_DEPRECATED_3_0
d86167ec
DMSP
16# define HEADER_CAMELLIA_H
17# endif
67912e00 18
0f113f3e 19# include <openssl/opensslconf.h>
67912e00 20
3c27208f 21# ifndef OPENSSL_NO_CAMELLIA
0f113f3e 22# include <stddef.h>
3c27208f
RS
23#ifdef __cplusplus
24extern "C" {
25#endif
f768be81 26
291850b4
MC
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
67912e00 33
0f113f3e
MC
34/*
35 * Because array size can't be a const in C, the following two are macros.
36 * Both sizes are in bytes.
37 */
67912e00 38
67912e00
BM
39/* This should be a hidden type, but EVP requires that the size be known */
40
291850b4
MC
41# define CAMELLIA_TABLE_BYTE_LEN 272
42# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
67912e00 43
0f113f3e
MC
44typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
45 * with WORD */
67912e00 46
0f113f3e
MC
47struct 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};
67912e00
BM
54typedef struct camellia_key_st CAMELLIA_KEY;
55
291850b4 56# endif /* OPENSSL_NO_DEPRECATED_3_0 */
02940972
RL
57# ifndef OPENSSL_NO_DEPRECATED_3_0
58OSSL_DEPRECATEDIN_3_0 int Camellia_set_key(const unsigned char *userKey,
59 const int bits,
60 CAMELLIA_KEY *key);
61OSSL_DEPRECATEDIN_3_0 void Camellia_encrypt(const unsigned char *in,
291850b4 62 unsigned char *out,
02940972
RL
63 const CAMELLIA_KEY *key);
64OSSL_DEPRECATEDIN_3_0 void Camellia_decrypt(const unsigned char *in,
291850b4 65 unsigned char *out,
02940972
RL
66 const CAMELLIA_KEY *key);
67OSSL_DEPRECATEDIN_3_0 void Camellia_ecb_encrypt(const unsigned char *in,
68 unsigned char *out,
69 const CAMELLIA_KEY *key,
70 const int enc);
71OSSL_DEPRECATEDIN_3_0 void Camellia_cbc_encrypt(const unsigned char *in,
72 unsigned char *out,
73 size_t length,
74 const CAMELLIA_KEY *key,
75 unsigned char *ivec,
76 const int enc);
77OSSL_DEPRECATEDIN_3_0 void Camellia_cfb128_encrypt(const unsigned char *in,
78 unsigned char *out,
79 size_t length,
80 const CAMELLIA_KEY *key,
81 unsigned char *ivec,
82 int *num,
83 const int enc);
84OSSL_DEPRECATEDIN_3_0 void Camellia_cfb1_encrypt(const unsigned char *in,
85 unsigned char *out,
86 size_t length,
87 const CAMELLIA_KEY *key,
88 unsigned char *ivec,
89 int *num,
90 const int enc);
91OSSL_DEPRECATEDIN_3_0 void Camellia_cfb8_encrypt(const unsigned char *in,
92 unsigned char *out,
93 size_t length,
94 const CAMELLIA_KEY *key,
95 unsigned char *ivec,
96 int *num,
97 const int enc);
98OSSL_DEPRECATEDIN_3_0 void Camellia_ofb128_encrypt(const unsigned char *in,
99 unsigned char *out,
100 size_t length,
101 const CAMELLIA_KEY *key,
102 unsigned char *ivec,
103 int *num);
104OSSL_DEPRECATEDIN_3_0
105void 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],
109 unsigned int *num);
110# endif
67912e00 111
3c27208f 112# ifdef __cplusplus
67912e00 113}
3c27208f
RS
114# endif
115# endif
67912e00 116
3c27208f 117#endif