summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/e_camellia.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/e_camellia.c')
-rw-r--r--src/lib/libcrypto/evp/e_camellia.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/lib/libcrypto/evp/e_camellia.c b/src/lib/libcrypto/evp/e_camellia.c
index 42c036a7ab..2d7ab73627 100644
--- a/src/lib/libcrypto/evp/e_camellia.c
+++ b/src/lib/libcrypto/evp/e_camellia.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_camellia.c,v 1.11 2022/09/04 07:54:59 jsing Exp $ */ 1/* $OpenBSD: e_camellia.c,v 1.12 2022/09/04 13:17:18 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -64,9 +64,6 @@
64 64
65#include "evp_locl.h" 65#include "evp_locl.h"
66 66
67static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
68 const unsigned char *iv, int enc);
69
70/* Camellia subkey Structure */ 67/* Camellia subkey Structure */
71typedef struct { 68typedef struct {
72 CAMELLIA_KEY ks; 69 CAMELLIA_KEY ks;
@@ -76,6 +73,22 @@ typedef struct {
76#define data(ctx) ((EVP_CAMELLIA_KEY *)(ctx)->cipher_data) 73#define data(ctx) ((EVP_CAMELLIA_KEY *)(ctx)->cipher_data)
77 74
78static int 75static int
76camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
77 const unsigned char *iv, int enc)
78{
79 int ret;
80
81 ret = Camellia_set_key(key, ctx->key_len * 8, ctx->cipher_data);
82
83 if (ret < 0) {
84 EVPerror(EVP_R_CAMELLIA_KEY_SETUP_FAILED);
85 return 0;
86 }
87
88 return 1;
89}
90
91static int
79camellia_128_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) 92camellia_128_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
80{ 93{
81 while (inl >= EVP_MAXCHUNK) { 94 while (inl >= EVP_MAXCHUNK) {
@@ -828,21 +841,4 @@ EVP_camellia_256_cfb8(void)
828{ 841{
829 return &camellia_256_cfb8; 842 return &camellia_256_cfb8;
830} 843}
831
832/* The subkey for Camellia is generated. */
833static int
834camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
835 const unsigned char *iv, int enc)
836{
837 int ret;
838
839 ret = Camellia_set_key(key, ctx->key_len * 8, ctx->cipher_data);
840
841 if (ret < 0) {
842 EVPerror(EVP_R_CAMELLIA_KEY_SETUP_FAILED);
843 return 0;
844 }
845
846 return 1;
847}
848#endif 844#endif