-/* $OpenBSD: evp_cipher.c,v 1.13 2024/01/02 21:27:39 tb Exp $ */
+/* $OpenBSD: evp_cipher.c,v 1.14 2024/01/03 09:13:32 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* Used by CMS and its predecessors. Only GOST and RC2 have a custom method.
*/
-int
-EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
-{
- if (ctx->cipher->set_asn1_parameters != NULL)
- return ctx->cipher->set_asn1_parameters(ctx, type);
-
- if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0)
- return EVP_CIPHER_set_asn1_iv(ctx, type);
-
- return -1;
-}
-
-int
-EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
-{
- if (ctx->cipher->get_asn1_parameters != NULL)
- return ctx->cipher->get_asn1_parameters(ctx, type);
-
- if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0)
- return EVP_CIPHER_get_asn1_iv(ctx, type);
-
- return -1;
-}
-
int
EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
{
return (i);
}
+int
+EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
+{
+ if (ctx->cipher->get_asn1_parameters != NULL)
+ return ctx->cipher->get_asn1_parameters(ctx, type);
+
+ if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0)
+ return EVP_CIPHER_get_asn1_iv(ctx, type);
+
+ return -1;
+}
+
int
EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
{
return (i);
}
+int
+EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
+{
+ if (ctx->cipher->set_asn1_parameters != NULL)
+ return ctx->cipher->set_asn1_parameters(ctx, type);
+
+ if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0)
+ return EVP_CIPHER_set_asn1_iv(ctx, type);
+
+ return -1;
+}
+
/* Convert the various cipher NIDs and dummies to a proper OID NID */
int
EVP_CIPHER_type(const EVP_CIPHER *cipher)