|
Packit |
c4476c |
/*
|
|
Packit |
c4476c |
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
Packit |
c4476c |
*
|
|
Packit |
c4476c |
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
Packit |
c4476c |
* this file except in compliance with the License. You can obtain a copy
|
|
Packit |
c4476c |
* in the file LICENSE in the source distribution or at
|
|
Packit |
c4476c |
* https://www.openssl.org/source/license.html
|
|
Packit |
c4476c |
*/
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
#ifndef HEADER_CAMELLIA_H
|
|
Packit |
c4476c |
# define HEADER_CAMELLIA_H
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
# include <openssl/opensslconf.h>
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
# ifndef OPENSSL_NO_CAMELLIA
|
|
Packit |
c4476c |
# include <stddef.h>
|
|
Packit |
c4476c |
#ifdef __cplusplus
|
|
Packit |
c4476c |
extern "C" {
|
|
Packit |
c4476c |
#endif
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
# define CAMELLIA_ENCRYPT 1
|
|
Packit |
c4476c |
# define CAMELLIA_DECRYPT 0
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
/*
|
|
Packit |
c4476c |
* Because array size can't be a const in C, the following two are macros.
|
|
Packit |
c4476c |
* Both sizes are in bytes.
|
|
Packit |
c4476c |
*/
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
/* This should be a hidden type, but EVP requires that the size be known */
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
# define CAMELLIA_BLOCK_SIZE 16
|
|
Packit |
c4476c |
# define CAMELLIA_TABLE_BYTE_LEN 272
|
|
Packit |
c4476c |
# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
|
|
Packit |
c4476c |
* with WORD */
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
struct camellia_key_st {
|
|
Packit |
c4476c |
union {
|
|
Packit |
c4476c |
double d; /* ensures 64-bit align */
|
|
Packit |
c4476c |
KEY_TABLE_TYPE rd_key;
|
|
Packit |
c4476c |
} u;
|
|
Packit |
c4476c |
int grand_rounds;
|
|
Packit |
c4476c |
};
|
|
Packit |
c4476c |
typedef struct camellia_key_st CAMELLIA_KEY;
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
int Camellia_set_key(const unsigned char *userKey, const int bits,
|
|
Packit |
c4476c |
CAMELLIA_KEY *key);
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
void Camellia_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
const CAMELLIA_KEY *key);
|
|
Packit |
c4476c |
void Camellia_decrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
const CAMELLIA_KEY *key);
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
const CAMELLIA_KEY *key, const int enc);
|
|
Packit |
c4476c |
void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
size_t length, const CAMELLIA_KEY *key,
|
|
Packit |
c4476c |
unsigned char *ivec, const int enc);
|
|
Packit |
c4476c |
void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
size_t length, const CAMELLIA_KEY *key,
|
|
Packit |
c4476c |
unsigned char *ivec, int *num, const int enc);
|
|
Packit |
c4476c |
void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
size_t length, const CAMELLIA_KEY *key,
|
|
Packit |
c4476c |
unsigned char *ivec, int *num, const int enc);
|
|
Packit |
c4476c |
void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
size_t length, const CAMELLIA_KEY *key,
|
|
Packit |
c4476c |
unsigned char *ivec, int *num, const int enc);
|
|
Packit |
c4476c |
void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
size_t length, const CAMELLIA_KEY *key,
|
|
Packit |
c4476c |
unsigned char *ivec, int *num);
|
|
Packit |
c4476c |
void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
size_t length, const CAMELLIA_KEY *key,
|
|
Packit |
c4476c |
unsigned char ivec[CAMELLIA_BLOCK_SIZE],
|
|
Packit |
c4476c |
unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
|
|
Packit |
c4476c |
unsigned int *num);
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
# ifdef __cplusplus
|
|
Packit |
c4476c |
}
|
|
Packit |
c4476c |
# endif
|
|
Packit |
c4476c |
# endif
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
#endif
|