diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/evp/evp_cipher.c | 42 |
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 | ||
| 950 | static int | 950 | int |
| 951 | EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | 951 | EVP_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 | ||
| 972 | int | 978 | int |
| 973 | EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | 979 | EVP_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 | ||
| 984 | static int | 986 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) == 0) |
| 985 | EVP_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 | ||
| 1001 | int | ||
| 1002 | EVP_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 */ |
| 1014 | int | 1002 | int |
| 1015 | EVP_CIPHER_type(const EVP_CIPHER *cipher) | 1003 | EVP_CIPHER_type(const EVP_CIPHER *cipher) |
