Latest update.
This commit is contained in:
+25
-29
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,18 +14,15 @@
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifdef OPENSSL_NO_CAMELLIA
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/err.h>
|
||||
# include <string.h>
|
||||
# include <assert.h>
|
||||
# include <openssl/camellia.h>
|
||||
# include "crypto/evp.h"
|
||||
# include "crypto/modes.h"
|
||||
# include "crypto/cmll_platform.h"
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/err.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <openssl/camellia.h>
|
||||
#include "crypto/evp.h"
|
||||
#include "crypto/modes.h"
|
||||
#include "crypto/cmll_platform.h"
|
||||
|
||||
static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
const unsigned char *iv, int enc);
|
||||
@@ -40,15 +37,15 @@ typedef struct {
|
||||
} stream;
|
||||
} EVP_CAMELLIA_KEY;
|
||||
|
||||
# define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4))
|
||||
#define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4))
|
||||
|
||||
/* Attribute operation for Camellia */
|
||||
# define data(ctx) EVP_C_DATA(EVP_CAMELLIA_KEY,ctx)
|
||||
#define data(ctx) EVP_C_DATA(EVP_CAMELLIA_KEY,ctx)
|
||||
|
||||
# if defined(AES_ASM) && (defined(__sparc) || defined(__sparc__))
|
||||
#if defined(AES_ASM) && (defined(__sparc) || defined(__sparc__))
|
||||
/* ---------^^^ this is not a typo, just a way to detect that
|
||||
* assembler support was in general requested... */
|
||||
# include "sparc_arch.h"
|
||||
# include "sparc_arch.h"
|
||||
|
||||
|
||||
static int cmll_t4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
@@ -114,35 +111,35 @@ static int cmll_t4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
return 1;
|
||||
}
|
||||
|
||||
# define cmll_t4_cbc_cipher camellia_cbc_cipher
|
||||
# define cmll_t4_cbc_cipher camellia_cbc_cipher
|
||||
static int cmll_t4_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len);
|
||||
|
||||
# define cmll_t4_ecb_cipher camellia_ecb_cipher
|
||||
# define cmll_t4_ecb_cipher camellia_ecb_cipher
|
||||
static int cmll_t4_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len);
|
||||
|
||||
# define cmll_t4_ofb_cipher camellia_ofb_cipher
|
||||
# define cmll_t4_ofb_cipher camellia_ofb_cipher
|
||||
static int cmll_t4_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len);
|
||||
|
||||
# define cmll_t4_cfb_cipher camellia_cfb_cipher
|
||||
# define cmll_t4_cfb_cipher camellia_cfb_cipher
|
||||
static int cmll_t4_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len);
|
||||
|
||||
# define cmll_t4_cfb8_cipher camellia_cfb8_cipher
|
||||
# define cmll_t4_cfb8_cipher camellia_cfb8_cipher
|
||||
static int cmll_t4_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len);
|
||||
|
||||
# define cmll_t4_cfb1_cipher camellia_cfb1_cipher
|
||||
# define cmll_t4_cfb1_cipher camellia_cfb1_cipher
|
||||
static int cmll_t4_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len);
|
||||
|
||||
# define cmll_t4_ctr_cipher camellia_ctr_cipher
|
||||
# define cmll_t4_ctr_cipher camellia_ctr_cipher
|
||||
static int cmll_t4_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t len);
|
||||
|
||||
# define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,flags) \
|
||||
# define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,flags) \
|
||||
static const EVP_CIPHER cmll_t4_##keylen##_##mode = { \
|
||||
nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \
|
||||
flags|EVP_CIPH_##MODE##_MODE, \
|
||||
@@ -163,9 +160,9 @@ static const EVP_CIPHER camellia_##keylen##_##mode = { \
|
||||
const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
|
||||
{ return SPARC_CMLL_CAPABLE?&cmll_t4_##keylen##_##mode:&camellia_##keylen##_##mode; }
|
||||
|
||||
# else
|
||||
#else
|
||||
|
||||
# define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,flags) \
|
||||
# define BLOCK_CIPHER_generic(nid,keylen,blocksize,ivlen,nmode,mode,MODE,flags) \
|
||||
static const EVP_CIPHER camellia_##keylen##_##mode = { \
|
||||
nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \
|
||||
flags|EVP_CIPH_##MODE##_MODE, \
|
||||
@@ -177,9 +174,9 @@ static const EVP_CIPHER camellia_##keylen##_##mode = { \
|
||||
const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
|
||||
{ return &camellia_##keylen##_##mode; }
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define BLOCK_CIPHER_generic_pack(nid,keylen,flags) \
|
||||
#define BLOCK_CIPHER_generic_pack(nid,keylen,flags) \
|
||||
BLOCK_CIPHER_generic(nid,keylen,16,16,cbc,cbc,CBC,flags|EVP_CIPH_FLAG_DEFAULT_ASN1) \
|
||||
BLOCK_CIPHER_generic(nid,keylen,16,0,ecb,ecb,ECB,flags|EVP_CIPH_FLAG_DEFAULT_ASN1) \
|
||||
BLOCK_CIPHER_generic(nid,keylen,1,16,ofb128,ofb,OFB,flags|EVP_CIPH_FLAG_DEFAULT_ASN1) \
|
||||
@@ -342,4 +339,3 @@ static int camellia_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
BLOCK_CIPHER_generic_pack(NID_camellia, 128, 0)
|
||||
BLOCK_CIPHER_generic_pack(NID_camellia, 192, 0)
|
||||
BLOCK_CIPHER_generic_pack(NID_camellia, 256, 0)
|
||||
#endif
|
||||
Reference in New Issue
Block a user