diff options
author | beck <> | 2023-04-26 19:08:10 +0000 |
---|---|---|
committer | beck <> | 2023-04-26 19:08:10 +0000 |
commit | 044e73e94f288a201e6ef15bb65075250510d821 (patch) | |
tree | 89ebd69fc39e15bc745980127c42e8514c304d85 /src | |
parent | 6ffb28298670459d0df0cbe863c548c2858f3792 (diff) | |
download | openbsd-044e73e94f288a201e6ef15bb65075250510d821.tar.gz openbsd-044e73e94f288a201e6ef15bb65075250510d821.tar.bz2 openbsd-044e73e94f288a201e6ef15bb65075250510d821.zip |
Add a shim to mimic the BoringSSL sk_delete_if function.
We add this locally as a function to avoid delving into
the unholy macro madness of STACK_OF(3).
ok tb@ jsing@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/x509/x509_policy.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/libcrypto/x509/x509_policy.c b/src/lib/libcrypto/x509/x509_policy.c index c25ffe9646..c9618dbf23 100644 --- a/src/lib/libcrypto/x509/x509_policy.c +++ b/src/lib/libcrypto/x509/x509_policy.c | |||
@@ -139,6 +139,29 @@ DECLARE_STACK_OF(X509_POLICY_LEVEL) | |||
139 | #define sk_X509_POLICY_LEVEL_sort(st) SKM_sk_sort(X509_POLICY_LEVEL, (st)) | 139 | #define sk_X509_POLICY_LEVEL_sort(st) SKM_sk_sort(X509_POLICY_LEVEL, (st)) |
140 | #define sk_X509_POLICY_LEVEL_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_LEVEL, (st)) | 140 | #define sk_X509_POLICY_LEVEL_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_LEVEL, (st)) |
141 | 141 | ||
142 | /* | ||
143 | * Don't look Ethel, but you would really not want to look if we did | ||
144 | * this the OpenSSL way either, and we are not using this boringsslism | ||
145 | * anywhere else. | ||
146 | */ | ||
147 | void | ||
148 | sk_X509_POLICY_NODE_delete_if(STACK_OF(X509_POLICY_NODE) *nodes, | ||
149 | int (*delete_if)(X509_POLICY_NODE *, void *), | ||
150 | void *data) | ||
151 | { | ||
152 | _STACK *sk = (_STACK *)nodes; | ||
153 | X509_POLICY_NODE *node; | ||
154 | int new_num = 0; | ||
155 | int i; | ||
156 | |||
157 | for (i = 0; i < sk_X509_POLICY_NODE_num(nodes); i++) { | ||
158 | node = sk_X509_POLICY_NODE_value(nodes, i); | ||
159 | if (!delete_if(node, data)) | ||
160 | sk->data[new_num++] = (char *)node; | ||
161 | } | ||
162 | sk->num = new_num; | ||
163 | } | ||
164 | |||
142 | static int is_any_policy(const ASN1_OBJECT *obj) { | 165 | static int is_any_policy(const ASN1_OBJECT *obj) { |
143 | return OBJ_obj2nid(obj) == NID_any_policy; | 166 | return OBJ_obj2nid(obj) == NID_any_policy; |
144 | } | 167 | } |