diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2023-04-26 19:08:11 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2023-04-26 19:08:11 +0000 |
commit | 50bda56290efebd9390b2f85cf44ddd99c0a7308 (patch) | |
tree | c8b30e57d1b42540a361cdbc9701d5592be56cbc | |
parent | b5d726e61f8f673983c0a579e428a19620011129 (diff) |
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@
-rw-r--r-- | lib/libcrypto/x509/x509_policy.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/libcrypto/x509/x509_policy.c b/lib/libcrypto/x509/x509_policy.c index c25ffe96467..c9618dbf230 100644 --- a/lib/libcrypto/x509/x509_policy.c +++ b/lib/libcrypto/x509/x509_policy.c @@ -139,6 +139,29 @@ DECLARE_STACK_OF(X509_POLICY_LEVEL) #define sk_X509_POLICY_LEVEL_sort(st) SKM_sk_sort(X509_POLICY_LEVEL, (st)) #define sk_X509_POLICY_LEVEL_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_LEVEL, (st)) +/* + * Don't look Ethel, but you would really not want to look if we did + * this the OpenSSL way either, and we are not using this boringsslism + * anywhere else. + */ +void +sk_X509_POLICY_NODE_delete_if(STACK_OF(X509_POLICY_NODE) *nodes, + int (*delete_if)(X509_POLICY_NODE *, void *), + void *data) +{ + _STACK *sk = (_STACK *)nodes; + X509_POLICY_NODE *node; + int new_num = 0; + int i; + + for (i = 0; i < sk_X509_POLICY_NODE_num(nodes); i++) { + node = sk_X509_POLICY_NODE_value(nodes, i); + if (!delete_if(node, data)) + sk->data[new_num++] = (char *)node; + } + sk->num = new_num; +} + static int is_any_policy(const ASN1_OBJECT *obj) { return OBJ_obj2nid(obj) == NID_any_policy; } |