summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2025-06-02 08:50:51 +0000
committertb <>2025-06-02 08:50:51 +0000
commit97f49394bbc1f9adcd4006ec4e97de63c1740e85 (patch)
treea17284b34e9d522029aee05744fcef6b4a707469 /src
parent632a56e17e3ac4630e113b80ed89f403883f464f (diff)
downloadopenbsd-97f49394bbc1f9adcd4006ec4e97de63c1740e85.tar.gz
openbsd-97f49394bbc1f9adcd4006ec4e97de63c1740e85.tar.bz2
openbsd-97f49394bbc1f9adcd4006ec4e97de63c1740e85.zip
Inline EVP_CIPHER_[gs]et_asn1_iv() in their last callers
ok kenjiro
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/evp/evp_cipher.c42
1 files changed, 15 insertions, 27 deletions
diff --git a/src/lib/libcrypto/evp/evp_cipher.c b/src/lib/libcrypto/evp/evp_cipher.c
index b60f3ca78a..01e4ce67e7 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.26 2025/05/27 03:58:12 tb Exp $ */ 1/* $OpenBSD: evp_cipher.c,v 1.27 2025/06/02 08:50:51 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 *
@@ -947,11 +947,17 @@ LCRYPTO_ALIAS(EVP_CIPHER_CTX_flags);
947 * Used by CMS and its predecessors. Only RC2 has a custom method. 947 * Used by CMS and its predecessors. Only RC2 has a custom method.
948 */ 948 */
949 949
950static int 950int
951EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) 951EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
952{ 952{
953 int iv_len; 953 int iv_len;
954 954
955 if (ctx->cipher->get_asn1_parameters != NULL)
956 return ctx->cipher->get_asn1_parameters(ctx, type);
957
958 if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) == 0)
959 return -1;
960
955 if (type == NULL) 961 if (type == NULL)
956 return 0; 962 return 0;
957 963
@@ -970,21 +976,15 @@ EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
970} 976}
971 977
972int 978int
973EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) 979EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
974{ 980{
975 if (ctx->cipher->get_asn1_parameters != NULL) 981 int iv_len;
976 return ctx->cipher->get_asn1_parameters(ctx, type);
977
978 if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0)
979 return EVP_CIPHER_get_asn1_iv(ctx, type);
980 982
981 return -1; 983 if (ctx->cipher->set_asn1_parameters != NULL)
982} 984 return ctx->cipher->set_asn1_parameters(ctx, type);
983 985
984static int 986 if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) == 0)
985EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) 987 return -1;
986{
987 int iv_len;
988 988
989 if (type == NULL) 989 if (type == NULL)
990 return 0; 990 return 0;
@@ -998,18 +998,6 @@ EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
998 return ASN1_TYPE_set_octetstring(type, ctx->oiv, iv_len); 998 return ASN1_TYPE_set_octetstring(type, ctx->oiv, iv_len);
999} 999}
1000 1000
1001int
1002EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
1003{
1004 if (ctx->cipher->set_asn1_parameters != NULL)
1005 return ctx->cipher->set_asn1_parameters(ctx, type);
1006
1007 if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0)
1008 return EVP_CIPHER_set_asn1_iv(ctx, type);
1009
1010 return -1;
1011}
1012
1013/* Convert the various cipher NIDs and dummies to a proper OID NID */ 1001/* Convert the various cipher NIDs and dummies to a proper OID NID */
1014int 1002int
1015EVP_CIPHER_type(const EVP_CIPHER *cipher) 1003EVP_CIPHER_type(const EVP_CIPHER *cipher)