From e8bd969517ee7358526b2029f449ff13d32ea79a Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 2 Jan 2024 20:48:40 +0000 Subject: [PATCH] Move the trivial EVP_CIPHER getters down They are now below the CMS ASN.1 IV stuff, but above the EVP_CIPHER_meth* API, which are setters, in a way. --- lib/libcrypto/evp/evp_cipher.c | 66 ++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/lib/libcrypto/evp/evp_cipher.c b/lib/libcrypto/evp/evp_cipher.c index 0e8c565b7e3..367cfb6e673 100644 --- a/lib/libcrypto/evp/evp_cipher.c +++ b/lib/libcrypto/evp/evp_cipher.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_cipher.c,v 1.9 2024/01/02 20:00:45 tb Exp $ */ +/* $OpenBSD: evp_cipher.c,v 1.10 2024/01/02 20:48:40 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -740,12 +740,6 @@ EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) return 1; } -int -EVP_CIPHER_block_size(const EVP_CIPHER *cipher) -{ - return cipher->block_size; -} - int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) { @@ -764,12 +758,6 @@ EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx) return ctx->encrypt; } -unsigned long -EVP_CIPHER_flags(const EVP_CIPHER *cipher) -{ - return cipher->flags; -} - unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) { @@ -805,12 +793,6 @@ EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data) return old_cipher_data; } -int -EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) -{ - return cipher->iv_len; -} - int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) { @@ -836,24 +818,12 @@ EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx) return ctx->buf; } -int -EVP_CIPHER_key_length(const EVP_CIPHER *cipher) -{ - return cipher->key_len; -} - int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) { return ctx->key_len; } -int -EVP_CIPHER_nid(const EVP_CIPHER *cipher) -{ - return cipher->nid; -} - int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) { @@ -1036,6 +1006,40 @@ EVP_CIPHER_type(const EVP_CIPHER *cipher) } } +/* + * Accessors. First the trivial getters, then the setters for the method API. + */ + +int +EVP_CIPHER_nid(const EVP_CIPHER *cipher) +{ + return cipher->nid; +} + +int +EVP_CIPHER_block_size(const EVP_CIPHER *cipher) +{ + return cipher->block_size; +} + +int +EVP_CIPHER_key_length(const EVP_CIPHER *cipher) +{ + return cipher->key_len; +} + +int +EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) +{ + return cipher->iv_len; +} + +unsigned long +EVP_CIPHER_flags(const EVP_CIPHER *cipher) +{ + return cipher->flags; +} + EVP_CIPHER * EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len) { -- 2.20.1