Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:39

0001 /*
0002  * Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
0003  *
0004  * Licensed under the Apache License 2.0 (the "License").  You may not use
0005  * this file except in compliance with the License.  You can obtain a copy
0006  * in the file LICENSE in the source distribution or at
0007  * https://www.openssl.org/source/license.html
0008  */
0009 
0010 #ifndef OPENSSL_CAMELLIA_H
0011 # define OPENSSL_CAMELLIA_H
0012 # pragma once
0013 
0014 # include <openssl/macros.h>
0015 # ifndef OPENSSL_NO_DEPRECATED_3_0
0016 #  define HEADER_CAMELLIA_H
0017 # endif
0018 
0019 # include <openssl/opensslconf.h>
0020 
0021 # ifndef OPENSSL_NO_CAMELLIA
0022 # include <stddef.h>
0023 #ifdef  __cplusplus
0024 extern "C" {
0025 #endif
0026 
0027 # define CAMELLIA_BLOCK_SIZE 16
0028 
0029 # ifndef OPENSSL_NO_DEPRECATED_3_0
0030 
0031 #  define CAMELLIA_ENCRYPT        1
0032 #  define CAMELLIA_DECRYPT        0
0033 
0034 /*
0035  * Because array size can't be a const in C, the following two are macros.
0036  * Both sizes are in bytes.
0037  */
0038 
0039 /* This should be a hidden type, but EVP requires that the size be known */
0040 
0041 #  define CAMELLIA_TABLE_BYTE_LEN 272
0042 #  define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
0043 
0044 typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
0045                                                                * with WORD */
0046 
0047 struct camellia_key_st {
0048     union {
0049         double d;               /* ensures 64-bit align */
0050         KEY_TABLE_TYPE rd_key;
0051     } u;
0052     int grand_rounds;
0053 };
0054 typedef struct camellia_key_st CAMELLIA_KEY;
0055 
0056 # endif /* OPENSSL_NO_DEPRECATED_3_0 */
0057 # ifndef OPENSSL_NO_DEPRECATED_3_0
0058 OSSL_DEPRECATEDIN_3_0 int Camellia_set_key(const unsigned char *userKey,
0059                                            const int bits,
0060                                            CAMELLIA_KEY *key);
0061 OSSL_DEPRECATEDIN_3_0 void Camellia_encrypt(const unsigned char *in,
0062                                             unsigned char *out,
0063                                             const CAMELLIA_KEY *key);
0064 OSSL_DEPRECATEDIN_3_0 void Camellia_decrypt(const unsigned char *in,
0065                                             unsigned char *out,
0066                                             const CAMELLIA_KEY *key);
0067 OSSL_DEPRECATEDIN_3_0 void Camellia_ecb_encrypt(const unsigned char *in,
0068                                                 unsigned char *out,
0069                                                 const CAMELLIA_KEY *key,
0070                                                 const int enc);
0071 OSSL_DEPRECATEDIN_3_0 void Camellia_cbc_encrypt(const unsigned char *in,
0072                                                 unsigned char *out,
0073                                                 size_t length,
0074                                                 const CAMELLIA_KEY *key,
0075                                                 unsigned char *ivec,
0076                                                 const int enc);
0077 OSSL_DEPRECATEDIN_3_0 void Camellia_cfb128_encrypt(const unsigned char *in,
0078                                                    unsigned char *out,
0079                                                    size_t length,
0080                                                    const CAMELLIA_KEY *key,
0081                                                    unsigned char *ivec,
0082                                                    int *num,
0083                                                    const int enc);
0084 OSSL_DEPRECATEDIN_3_0 void Camellia_cfb1_encrypt(const unsigned char *in,
0085                                                  unsigned char *out,
0086                                                  size_t length,
0087                                                  const CAMELLIA_KEY *key,
0088                                                  unsigned char *ivec,
0089                                                  int *num,
0090                                                  const int enc);
0091 OSSL_DEPRECATEDIN_3_0 void Camellia_cfb8_encrypt(const unsigned char *in,
0092                                                  unsigned char *out,
0093                                                  size_t length,
0094                                                  const CAMELLIA_KEY *key,
0095                                                  unsigned char *ivec,
0096                                                  int *num,
0097                                                  const int enc);
0098 OSSL_DEPRECATEDIN_3_0 void Camellia_ofb128_encrypt(const unsigned char *in,
0099                                                    unsigned char *out,
0100                                                    size_t length,
0101                                                    const CAMELLIA_KEY *key,
0102                                                    unsigned char *ivec,
0103                                                    int *num);
0104 OSSL_DEPRECATEDIN_3_0
0105 void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
0106                              size_t length, const CAMELLIA_KEY *key,
0107                              unsigned char ivec[CAMELLIA_BLOCK_SIZE],
0108                              unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
0109                              unsigned int *num);
0110 # endif
0111 
0112 # ifdef  __cplusplus
0113 }
0114 # endif
0115 # endif
0116 
0117 #endif