diff options
| author | tb <> | 2021-11-05 17:05:52 +0000 |
|---|---|---|
| committer | tb <> | 2021-11-05 17:05:52 +0000 |
| commit | 176af27ab1219e8a536aaf2bac6dd558f71868fd (patch) | |
| tree | bd4e6058b6b452b404df9659f4c31ec73f13f5b9 /src | |
| parent | 49f95089891b7d06baacd9e87e0d5db96f924af7 (diff) | |
| download | openbsd-176af27ab1219e8a536aaf2bac6dd558f71868fd.tar.gz openbsd-176af27ab1219e8a536aaf2bac6dd558f71868fd.tar.bz2 openbsd-176af27ab1219e8a536aaf2bac6dd558f71868fd.zip | |
Drop a bunch of unnecesary parentheses and unify the order in which
callbacks are called.
ok jsing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/x509/x509_lu.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/lib/libcrypto/x509/x509_lu.c b/src/lib/libcrypto/x509/x509_lu.c index f0a86f0adf..a99c4283b1 100644 --- a/src/lib/libcrypto/x509/x509_lu.c +++ b/src/lib/libcrypto/x509/x509_lu.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_lu.c,v 1.39 2021/11/05 17:03:15 tb Exp $ */ | 1 | /* $OpenBSD: x509_lu.c,v 1.40 2021/11/05 17:05:52 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 | * |
| @@ -92,8 +92,8 @@ X509_LOOKUP_free(X509_LOOKUP *ctx) | |||
| 92 | { | 92 | { |
| 93 | if (ctx == NULL) | 93 | if (ctx == NULL) |
| 94 | return; | 94 | return; |
| 95 | if ((ctx->method != NULL) && (ctx->method->free != NULL)) | 95 | if (ctx->method != NULL && ctx->method->free != NULL) |
| 96 | (*ctx->method->free)(ctx); | 96 | ctx->method->free(ctx); |
| 97 | free(ctx); | 97 | free(ctx); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| @@ -102,10 +102,9 @@ X509_LOOKUP_init(X509_LOOKUP *ctx) | |||
| 102 | { | 102 | { |
| 103 | if (ctx->method == NULL) | 103 | if (ctx->method == NULL) |
| 104 | return 0; | 104 | return 0; |
| 105 | if (ctx->method->init != NULL) | 105 | if (ctx->method->init == NULL) |
| 106 | return ctx->method->init(ctx); | ||
| 107 | else | ||
| 108 | return 1; | 106 | return 1; |
| 107 | return ctx->method->init(ctx); | ||
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | int | 110 | int |
| @@ -113,10 +112,9 @@ X509_LOOKUP_shutdown(X509_LOOKUP *ctx) | |||
| 113 | { | 112 | { |
| 114 | if (ctx->method == NULL) | 113 | if (ctx->method == NULL) |
| 115 | return 0; | 114 | return 0; |
| 116 | if (ctx->method->shutdown != NULL) | 115 | if (ctx->method->shutdown == NULL) |
| 117 | return ctx->method->shutdown(ctx); | ||
| 118 | else | ||
| 119 | return 1; | 116 | return 1; |
| 117 | return ctx->method->shutdown(ctx); | ||
| 120 | } | 118 | } |
| 121 | 119 | ||
| 122 | int | 120 | int |
| @@ -125,17 +123,16 @@ X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, | |||
| 125 | { | 123 | { |
| 126 | if (ctx->method == NULL) | 124 | if (ctx->method == NULL) |
| 127 | return -1; | 125 | return -1; |
| 128 | if (ctx->method->ctrl != NULL) | 126 | if (ctx->method->ctrl == NULL) |
| 129 | return ctx->method->ctrl(ctx, cmd, argc, argl, ret); | ||
| 130 | else | ||
| 131 | return 1; | 127 | return 1; |
| 128 | return ctx->method->ctrl(ctx, cmd, argc, argl, ret); | ||
| 132 | } | 129 | } |
| 133 | 130 | ||
| 134 | int | 131 | int |
| 135 | X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, X509_NAME *name, | 132 | X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, X509_NAME *name, |
| 136 | X509_OBJECT *ret) | 133 | X509_OBJECT *ret) |
| 137 | { | 134 | { |
| 138 | if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL)) | 135 | if (ctx->method == NULL || ctx->method->get_by_subject == NULL) |
| 139 | return 0; | 136 | return 0; |
| 140 | if (ctx->skip) | 137 | if (ctx->skip) |
| 141 | return 0; | 138 | return 0; |
| @@ -146,8 +143,7 @@ int | |||
| 146 | X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, | 143 | X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, |
| 147 | X509_NAME *name, ASN1_INTEGER *serial, X509_OBJECT *ret) | 144 | X509_NAME *name, ASN1_INTEGER *serial, X509_OBJECT *ret) |
| 148 | { | 145 | { |
| 149 | if ((ctx->method == NULL) || | 146 | if (ctx->method == NULL || ctx->method->get_by_issuer_serial == NULL) |
| 150 | (ctx->method->get_by_issuer_serial == NULL)) | ||
| 151 | return 0; | 147 | return 0; |
| 152 | return ctx->method->get_by_issuer_serial(ctx, type, name, serial, ret); | 148 | return ctx->method->get_by_issuer_serial(ctx, type, name, serial, ret); |
| 153 | } | 149 | } |
| @@ -156,7 +152,7 @@ int | |||
| 156 | X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, | 152 | X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, |
| 157 | const unsigned char *bytes, int len, X509_OBJECT *ret) | 153 | const unsigned char *bytes, int len, X509_OBJECT *ret) |
| 158 | { | 154 | { |
| 159 | if ((ctx->method == NULL) || (ctx->method->get_by_fingerprint == NULL)) | 155 | if (ctx->method == NULL || ctx->method->get_by_fingerprint == NULL) |
| 160 | return 0; | 156 | return 0; |
| 161 | return ctx->method->get_by_fingerprint(ctx, type, bytes, len, ret); | 157 | return ctx->method->get_by_fingerprint(ctx, type, bytes, len, ret); |
| 162 | } | 158 | } |
| @@ -165,7 +161,7 @@ int | |||
| 165 | X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, const char *str, | 161 | X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, const char *str, |
| 166 | int len, X509_OBJECT *ret) | 162 | int len, X509_OBJECT *ret) |
| 167 | { | 163 | { |
| 168 | if ((ctx->method == NULL) || (ctx->method->get_by_alias == NULL)) | 164 | if (ctx->method == NULL || ctx->method->get_by_alias == NULL) |
| 169 | return 0; | 165 | return 0; |
| 170 | return ctx->method->get_by_alias(ctx, type, str, len, ret); | 166 | return ctx->method->get_by_alias(ctx, type, str, len, ret); |
| 171 | } | 167 | } |
