summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-01-02 20:48:40 +0000
committertb <>2024-01-02 20:48:40 +0000
commitaef2d8eade403830e2678e242586504b864edea7 (patch)
tree121501fbf595bd6dc9e87da13e3cae87eace46df /src
parente9083d597c8dd5a504595c634b6a91c6a9333ed9 (diff)
downloadopenbsd-aef2d8eade403830e2678e242586504b864edea7.tar.gz
openbsd-aef2d8eade403830e2678e242586504b864edea7.tar.bz2
openbsd-aef2d8eade403830e2678e242586504b864edea7.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/evp/evp_cipher.c66
1 files changed, 35 insertions, 31 deletions
diff --git a/src/lib/libcrypto/evp/evp_cipher.c b/src/lib/libcrypto/evp/evp_cipher.c
index 0e8c565b7e..367cfb6e67 100644
--- a/src/lib/libcrypto/evp/evp_cipher.c
+++ b/src/lib/libcrypto/evp/evp_cipher.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_cipher.c,v 1.9 2024/01/02 20:00:45 tb Exp $ */ 1/* $OpenBSD: evp_cipher.c,v 1.10 2024/01/02 20:48:40 tb 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 *
@@ -741,12 +741,6 @@ EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)
741} 741}
742 742
743int 743int
744EVP_CIPHER_block_size(const EVP_CIPHER *cipher)
745{
746 return cipher->block_size;
747}
748
749int
750EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) 744EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)
751{ 745{
752 return ctx->cipher->block_size; 746 return ctx->cipher->block_size;
@@ -765,12 +759,6 @@ EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx)
765} 759}
766 760
767unsigned long 761unsigned long
768EVP_CIPHER_flags(const EVP_CIPHER *cipher)
769{
770 return cipher->flags;
771}
772
773unsigned long
774EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) 762EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
775{ 763{
776 return ctx->cipher->flags; 764 return ctx->cipher->flags;
@@ -806,12 +794,6 @@ EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data)
806} 794}
807 795
808int 796int
809EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
810{
811 return cipher->iv_len;
812}
813
814int
815EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) 797EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
816{ 798{
817 int iv_length = 0; 799 int iv_length = 0;
@@ -837,24 +819,12 @@ EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx)
837} 819}
838 820
839int 821int
840EVP_CIPHER_key_length(const EVP_CIPHER *cipher)
841{
842 return cipher->key_len;
843}
844
845int
846EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) 822EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx)
847{ 823{
848 return ctx->key_len; 824 return ctx->key_len;
849} 825}
850 826
851int 827int
852EVP_CIPHER_nid(const EVP_CIPHER *cipher)
853{
854 return cipher->nid;
855}
856
857int
858EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) 828EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)
859{ 829{
860 return ctx->cipher->nid; 830 return ctx->cipher->nid;
@@ -1036,6 +1006,40 @@ EVP_CIPHER_type(const EVP_CIPHER *cipher)
1036 } 1006 }
1037} 1007}
1038 1008
1009/*
1010 * Accessors. First the trivial getters, then the setters for the method API.
1011 */
1012
1013int
1014EVP_CIPHER_nid(const EVP_CIPHER *cipher)
1015{
1016 return cipher->nid;
1017}
1018
1019int
1020EVP_CIPHER_block_size(const EVP_CIPHER *cipher)
1021{
1022 return cipher->block_size;
1023}
1024
1025int
1026EVP_CIPHER_key_length(const EVP_CIPHER *cipher)
1027{
1028 return cipher->key_len;
1029}
1030
1031int
1032EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
1033{
1034 return cipher->iv_len;
1035}
1036
1037unsigned long
1038EVP_CIPHER_flags(const EVP_CIPHER *cipher)
1039{
1040 return cipher->flags;
1041}
1042
1039EVP_CIPHER * 1043EVP_CIPHER *
1040EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len) 1044EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len)
1041{ 1045{