summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/e_cast.c
diff options
context:
space:
mode:
authorjsing <>2022-09-04 13:17:18 +0000
committerjsing <>2022-09-04 13:17:18 +0000
commite0a6d27109c842f87e3f1f5c368f7eaf24cfd6f7 (patch)
treecb92f37869e1b342783302b265164463a74d0a99 /src/lib/libcrypto/evp/e_cast.c
parent6f74aedf29c64cca6f4963750a513b61049d06d8 (diff)
downloadopenbsd-e0a6d27109c842f87e3f1f5c368f7eaf24cfd6f7.tar.gz
openbsd-e0a6d27109c842f87e3f1f5c368f7eaf24cfd6f7.tar.bz2
openbsd-e0a6d27109c842f87e3f1f5c368f7eaf24cfd6f7.zip
Rearrange some functions.
Pull the init_key and ctrl (if present) functions up to the top. This improves readability and allows for the removal of function prototypes. No functional change.
Diffstat (limited to 'src/lib/libcrypto/evp/e_cast.c')
-rw-r--r--src/lib/libcrypto/evp/e_cast.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/lib/libcrypto/evp/e_cast.c b/src/lib/libcrypto/evp/e_cast.c
index b23dfeef1c..32f86d86af 100644
--- a/src/lib/libcrypto/evp/e_cast.c
+++ b/src/lib/libcrypto/evp/e_cast.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_cast.c,v 1.8 2022/09/03 19:51:53 jsing Exp $ */ 1/* $OpenBSD: e_cast.c,v 1.9 2022/09/04 13:17:18 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -68,9 +68,6 @@
68 68
69#include "evp_locl.h" 69#include "evp_locl.h"
70 70
71static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
72 const unsigned char *iv, int enc);
73
74typedef struct { 71typedef struct {
75 CAST_KEY ks; 72 CAST_KEY ks;
76} EVP_CAST_KEY; 73} EVP_CAST_KEY;
@@ -78,6 +75,14 @@ typedef struct {
78#define data(ctx) ((EVP_CAST_KEY *)(ctx)->cipher_data) 75#define data(ctx) ((EVP_CAST_KEY *)(ctx)->cipher_data)
79 76
80static int 77static int
78cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
79 const unsigned char *iv, int enc)
80{
81 CAST_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), key);
82 return 1;
83}
84
85static int
81cast5_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) 86cast5_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl)
82{ 87{
83 while (inl >= EVP_MAXCHUNK) { 88 while (inl >= EVP_MAXCHUNK) {
@@ -237,12 +242,4 @@ EVP_cast5_ecb(void)
237{ 242{
238 return &cast5_ecb; 243 return &cast5_ecb;
239} 244}
240
241static int
242cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
243 const unsigned char *iv, int enc)
244{
245 CAST_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), key);
246 return 1;
247}
248#endif 245#endif