diff options
author | tb <> | 2024-01-03 09:13:32 +0000 |
---|---|---|
committer | tb <> | 2024-01-03 09:13:32 +0000 |
commit | 1c6d12a18927be32f24e3dd8c0cb0d33de676d66 (patch) | |
tree | 96e5f25074cd7d567b05bd451169e4c00305d1c3 /src | |
parent | bc850408943f23b6a549255d26c13acb37706695 (diff) | |
download | openbsd-1c6d12a18927be32f24e3dd8c0cb0d33de676d66.tar.gz openbsd-1c6d12a18927be32f24e3dd8c0cb0d33de676d66.tar.bz2 openbsd-1c6d12a18927be32f24e3dd8c0cb0d33de676d66.zip |
Improve order in ancient CMS helpers
First came EVP_CIPHER_param_to_asn1() which wraps EVP_CIPHER_set_asn1_iv()
which was implemented last. Then came EVP_CIPHER_asn1_to_param() wrapping
EVP_CIPHER_get_asn1_iv(). Move each param function below the iv function
it wraps.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/evp/evp_cipher.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/lib/libcrypto/evp/evp_cipher.c b/src/lib/libcrypto/evp/evp_cipher.c index 51e83b7573..c3e2cd45f3 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.13 2024/01/02 21:27:39 tb Exp $ */ | 1 | /* $OpenBSD: evp_cipher.c,v 1.14 2024/01/03 09:13:32 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 | * |
@@ -899,30 +899,6 @@ EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) | |||
899 | */ | 899 | */ |
900 | 900 | ||
901 | int | 901 | int |
902 | EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | ||
903 | { | ||
904 | if (ctx->cipher->set_asn1_parameters != NULL) | ||
905 | return ctx->cipher->set_asn1_parameters(ctx, type); | ||
906 | |||
907 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) | ||
908 | return EVP_CIPHER_set_asn1_iv(ctx, type); | ||
909 | |||
910 | return -1; | ||
911 | } | ||
912 | |||
913 | int | ||
914 | EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | ||
915 | { | ||
916 | if (ctx->cipher->get_asn1_parameters != NULL) | ||
917 | return ctx->cipher->get_asn1_parameters(ctx, type); | ||
918 | |||
919 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) | ||
920 | return EVP_CIPHER_get_asn1_iv(ctx, type); | ||
921 | |||
922 | return -1; | ||
923 | } | ||
924 | |||
925 | int | ||
926 | EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | 902 | EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) |
927 | { | 903 | { |
928 | int i = 0; | 904 | int i = 0; |
@@ -944,6 +920,18 @@ EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | |||
944 | } | 920 | } |
945 | 921 | ||
946 | int | 922 | int |
923 | EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | ||
924 | { | ||
925 | if (ctx->cipher->get_asn1_parameters != NULL) | ||
926 | return ctx->cipher->get_asn1_parameters(ctx, type); | ||
927 | |||
928 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) | ||
929 | return EVP_CIPHER_get_asn1_iv(ctx, type); | ||
930 | |||
931 | return -1; | ||
932 | } | ||
933 | |||
934 | int | ||
947 | EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | 935 | EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) |
948 | { | 936 | { |
949 | int i = 0; | 937 | int i = 0; |
@@ -960,6 +948,18 @@ EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | |||
960 | return (i); | 948 | return (i); |
961 | } | 949 | } |
962 | 950 | ||
951 | int | ||
952 | EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | ||
953 | { | ||
954 | if (ctx->cipher->set_asn1_parameters != NULL) | ||
955 | return ctx->cipher->set_asn1_parameters(ctx, type); | ||
956 | |||
957 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) | ||
958 | return EVP_CIPHER_set_asn1_iv(ctx, type); | ||
959 | |||
960 | return -1; | ||
961 | } | ||
962 | |||
963 | /* Convert the various cipher NIDs and dummies to a proper OID NID */ | 963 | /* Convert the various cipher NIDs and dummies to a proper OID NID */ |
964 | int | 964 | int |
965 | EVP_CIPHER_type(const EVP_CIPHER *cipher) | 965 | EVP_CIPHER_type(const EVP_CIPHER *cipher) |