diff options
author | tb <> | 2024-07-26 13:33:39 +0000 |
---|---|---|
committer | tb <> | 2024-07-26 13:33:39 +0000 |
commit | 5b4420abd2732d5067b6c39e009681a5dab1bfb1 (patch) | |
tree | 9e3b00b7082b06bc6f223c7dca10b8f332baa24e /src | |
parent | 965175becb37ff83ae67cfe98c9ca0d9b4675d78 (diff) | |
download | openbsd-5b4420abd2732d5067b6c39e009681a5dab1bfb1.tar.gz openbsd-5b4420abd2732d5067b6c39e009681a5dab1bfb1.tar.bz2 openbsd-5b4420abd2732d5067b6c39e009681a5dab1bfb1.zip |
Disable X509at_get_attr{,_count}() and X509at_delete_attr()
These are (not so) thin wrappers around the stack API and only make
things unreadable by adding an unneccesary layer of indirection and
repeating checks already present in the stack API. X509at_delete_attr()
is a masterpiece.
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/x509/x509_att.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/lib/libcrypto/x509/x509_att.c b/src/lib/libcrypto/x509/x509_att.c index 2bf6aa498e..21b47ce96f 100644 --- a/src/lib/libcrypto/x509/x509_att.c +++ b/src/lib/libcrypto/x509/x509_att.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_att.c,v 1.23 2024/07/26 13:30:40 tb Exp $ */ | 1 | /* $OpenBSD: x509_att.c,v 1.24 2024/07/26 13:33:39 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 | * |
@@ -71,7 +71,8 @@ | |||
71 | int | 71 | int |
72 | X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x) | 72 | X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x) |
73 | { | 73 | { |
74 | return sk_X509_ATTRIBUTE_num(x); | 74 | X509error(ERR_R_DISABLED); |
75 | return 0; | ||
75 | } | 76 | } |
76 | LCRYPTO_ALIAS(X509at_get_attr_count); | 77 | LCRYPTO_ALIAS(X509at_get_attr_count); |
77 | 78 | ||
@@ -112,22 +113,16 @@ LCRYPTO_ALIAS(X509at_get_attr_by_OBJ); | |||
112 | X509_ATTRIBUTE * | 113 | X509_ATTRIBUTE * |
113 | X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc) | 114 | X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc) |
114 | { | 115 | { |
115 | if (x == NULL || sk_X509_ATTRIBUTE_num(x) <= loc || loc < 0) | 116 | X509error(ERR_R_DISABLED); |
116 | return NULL; | 117 | return NULL; |
117 | else | ||
118 | return sk_X509_ATTRIBUTE_value(x, loc); | ||
119 | } | 118 | } |
120 | LCRYPTO_ALIAS(X509at_get_attr); | 119 | LCRYPTO_ALIAS(X509at_get_attr); |
121 | 120 | ||
122 | X509_ATTRIBUTE * | 121 | X509_ATTRIBUTE * |
123 | X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc) | 122 | X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc) |
124 | { | 123 | { |
125 | X509_ATTRIBUTE *ret; | 124 | X509error(ERR_R_DISABLED); |
126 | 125 | return NULL; | |
127 | if (x == NULL || sk_X509_ATTRIBUTE_num(x) <= loc || loc < 0) | ||
128 | return (NULL); | ||
129 | ret = sk_X509_ATTRIBUTE_delete(x, loc); | ||
130 | return (ret); | ||
131 | } | 126 | } |
132 | LCRYPTO_ALIAS(X509at_delete_attr); | 127 | LCRYPTO_ALIAS(X509at_delete_attr); |
133 | 128 | ||