]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/camellia.h
Reorganize public header files (part 2)
[thirdparty/openssl.git] / include / openssl / camellia.h
CommitLineData
21dcbebc
RS
1/*
2 * Copyright 2006-2016 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
10#ifndef HEADER_CAMELLIA_H
0f113f3e 11# define HEADER_CAMELLIA_H
67912e00 12
0f113f3e 13# include <openssl/opensslconf.h>
67912e00 14
3c27208f 15# ifndef OPENSSL_NO_CAMELLIA
0f113f3e 16# include <stddef.h>
3c27208f
RS
17#ifdef __cplusplus
18extern "C" {
19#endif
f768be81 20
0f113f3e
MC
21# define CAMELLIA_ENCRYPT 1
22# define CAMELLIA_DECRYPT 0
67912e00 23
0f113f3e
MC
24/*
25 * Because array size can't be a const in C, the following two are macros.
26 * Both sizes are in bytes.
27 */
67912e00 28
67912e00
BM
29/* This should be a hidden type, but EVP requires that the size be known */
30
0f113f3e
MC
31# define CAMELLIA_BLOCK_SIZE 16
32# define CAMELLIA_TABLE_BYTE_LEN 272
33# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
67912e00 34
0f113f3e
MC
35typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
36 * with WORD */
67912e00 37
0f113f3e
MC
38struct camellia_key_st {
39 union {
40 double d; /* ensures 64-bit align */
41 KEY_TABLE_TYPE rd_key;
42 } u;
43 int grand_rounds;
44};
67912e00
BM
45typedef struct camellia_key_st CAMELLIA_KEY;
46
47int Camellia_set_key(const unsigned char *userKey, const int bits,
0f113f3e 48 CAMELLIA_KEY *key);
67912e00
BM
49
50void Camellia_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e 51 const CAMELLIA_KEY *key);
67912e00 52void Camellia_decrypt(const unsigned char *in, unsigned char *out,
0f113f3e 53 const CAMELLIA_KEY *key);
67912e00
BM
54
55void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e 56 const CAMELLIA_KEY *key, const int enc);
67912e00 57void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
58 size_t length, const CAMELLIA_KEY *key,
59 unsigned char *ivec, const int enc);
67912e00 60void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
61 size_t length, const CAMELLIA_KEY *key,
62 unsigned char *ivec, int *num, const int enc);
67912e00 63void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
64 size_t length, const CAMELLIA_KEY *key,
65 unsigned char *ivec, int *num, const int enc);
67912e00 66void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
67 size_t length, const CAMELLIA_KEY *key,
68 unsigned char *ivec, int *num, const int enc);
67912e00 69void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
70 size_t length, const CAMELLIA_KEY *key,
71 unsigned char *ivec, int *num);
67912e00 72void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
73 size_t length, const CAMELLIA_KEY *key,
74 unsigned char ivec[CAMELLIA_BLOCK_SIZE],
75 unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
76 unsigned int *num);
67912e00 77
3c27208f 78# ifdef __cplusplus
67912e00 79}
3c27208f
RS
80# endif
81# endif
67912e00 82
3c27208f 83#endif