diff options
| author | tb <> | 2024-01-02 20:00:45 +0000 |
|---|---|---|
| committer | tb <> | 2024-01-02 20:00:45 +0000 |
| commit | 83574b85802cfad8ade18e740dd8fd554183d2cf (patch) | |
| tree | 9c17581719e9137e3b8ffbb65e5ff9936c297d81 /src | |
| parent | c0620a519d2c1ae1ad07ce1c09f42c2bb70f2eba (diff) | |
| download | openbsd-83574b85802cfad8ade18e740dd8fd554183d2cf.tar.gz openbsd-83574b85802cfad8ade18e740dd8fd554183d2cf.tar.bz2 openbsd-83574b85802cfad8ade18e740dd8fd554183d2cf.zip | |
Simplify EVP_CIPHER_{asn1_to_param,parma_to_asn1}()
There's no need for a ret variable and else if/else
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/evp/evp_cipher.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/lib/libcrypto/evp/evp_cipher.c b/src/lib/libcrypto/evp/evp_cipher.c index 82441cbc94..0e8c565b7e 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.8 2024/01/02 19:56:43 tb Exp $ */ | 1 | /* $OpenBSD: evp_cipher.c,v 1.9 2024/01/02 20:00:45 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 | * |
| @@ -923,29 +923,25 @@ EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags) | |||
| 923 | int | 923 | int |
| 924 | EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | 924 | EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) |
| 925 | { | 925 | { |
| 926 | int ret; | ||
| 927 | |||
| 928 | if (ctx->cipher->set_asn1_parameters != NULL) | 926 | if (ctx->cipher->set_asn1_parameters != NULL) |
| 929 | ret = ctx->cipher->set_asn1_parameters(ctx, type); | 927 | return ctx->cipher->set_asn1_parameters(ctx, type); |
| 930 | else if (ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) | 928 | |
| 931 | ret = EVP_CIPHER_set_asn1_iv(ctx, type); | 929 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) |
| 932 | else | 930 | return EVP_CIPHER_set_asn1_iv(ctx, type); |
| 933 | ret = -1; | 931 | |
| 934 | return (ret); | 932 | return -1; |
| 935 | } | 933 | } |
| 936 | 934 | ||
| 937 | int | 935 | int |
| 938 | EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) | 936 | EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) |
| 939 | { | 937 | { |
| 940 | int ret; | ||
| 941 | |||
| 942 | if (ctx->cipher->get_asn1_parameters != NULL) | 938 | if (ctx->cipher->get_asn1_parameters != NULL) |
| 943 | ret = ctx->cipher->get_asn1_parameters(ctx, type); | 939 | return ctx->cipher->get_asn1_parameters(ctx, type); |
| 944 | else if (ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) | 940 | |
| 945 | ret = EVP_CIPHER_get_asn1_iv(ctx, type); | 941 | if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) |
| 946 | else | 942 | return EVP_CIPHER_get_asn1_iv(ctx, type); |
| 947 | ret = -1; | 943 | |
| 948 | return (ret); | 944 | return -1; |
| 949 | } | 945 | } |
| 950 | 946 | ||
| 951 | int | 947 | int |
