summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/cms/cms_att.c
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2025-04-14 17:32:06 +0000
committercvs2svn <admin@example.com>2025-04-14 17:32:06 +0000
commiteb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch)
treeedb6da6af7e865d488dc1a29309f1e1ec226e603 /src/lib/libcrypto/cms/cms_att.c
parent247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff)
downloadopenbsd-tb_20250414.tar.gz
openbsd-tb_20250414.tar.bz2
openbsd-tb_20250414.zip
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to 'src/lib/libcrypto/cms/cms_att.c')
-rw-r--r--src/lib/libcrypto/cms/cms_att.c231
1 files changed, 0 insertions, 231 deletions
diff --git a/src/lib/libcrypto/cms/cms_att.c b/src/lib/libcrypto/cms/cms_att.c
deleted file mode 100644
index 5dbaf3cb20..0000000000
--- a/src/lib/libcrypto/cms/cms_att.c
+++ /dev/null
@@ -1,231 +0,0 @@
1/* $OpenBSD: cms_att.c,v 1.13 2024/08/27 01:19:27 tb Exp $ */
2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project.
5 */
6/* ====================================================================
7 * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this
22 * software must display the following acknowledgment:
23 * "This product includes software developed by the OpenSSL Project
24 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25 *
26 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27 * endorse or promote products derived from this software without
28 * prior written permission. For written permission, please contact
29 * licensing@OpenSSL.org.
30 *
31 * 5. Products derived from this software may not be called "OpenSSL"
32 * nor may "OpenSSL" appear in their names without prior written
33 * permission of the OpenSSL Project.
34 *
35 * 6. Redistributions of any form whatsoever must retain the following
36 * acknowledgment:
37 * "This product includes software developed by the OpenSSL Project
38 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51 * OF THE POSSIBILITY OF SUCH DAMAGE.
52 * ====================================================================
53 */
54
55#include <openssl/asn1.h>
56#include <openssl/cms.h>
57#include <openssl/x509.h>
58
59#include "cms_local.h"
60#include "x509_local.h"
61
62/* CMS SignedData Attribute utilities */
63
64int
65CMS_signed_get_attr_count(const CMS_SignerInfo *si)
66{
67 return sk_X509_ATTRIBUTE_num(si->signedAttrs);
68}
69LCRYPTO_ALIAS(CMS_signed_get_attr_count);
70
71int
72CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos)
73{
74 return X509at_get_attr_by_NID(si->signedAttrs, nid, lastpos);
75}
76LCRYPTO_ALIAS(CMS_signed_get_attr_by_NID);
77
78int
79CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
80 int lastpos)
81{
82 return X509at_get_attr_by_OBJ(si->signedAttrs, obj, lastpos);
83}
84LCRYPTO_ALIAS(CMS_signed_get_attr_by_OBJ);
85
86X509_ATTRIBUTE *
87CMS_signed_get_attr(const CMS_SignerInfo *si, int loc)
88{
89 return sk_X509_ATTRIBUTE_value(si->signedAttrs, loc);
90}
91LCRYPTO_ALIAS(CMS_signed_get_attr);
92
93X509_ATTRIBUTE *
94CMS_signed_delete_attr(CMS_SignerInfo *si, int loc)
95{
96 return sk_X509_ATTRIBUTE_delete(si->signedAttrs, loc);
97}
98LCRYPTO_ALIAS(CMS_signed_delete_attr);
99
100int
101CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr)
102{
103 if (X509at_add1_attr(&si->signedAttrs, attr))
104 return 1;
105 return 0;
106}
107LCRYPTO_ALIAS(CMS_signed_add1_attr);
108
109int
110CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj, int type,
111 const void *bytes, int len)
112{
113 if (X509at_add1_attr_by_OBJ(&si->signedAttrs, obj, type, bytes, len))
114 return 1;
115 return 0;
116}
117LCRYPTO_ALIAS(CMS_signed_add1_attr_by_OBJ);
118
119int
120CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type,
121 const void *bytes, int len)
122{
123 if (X509at_add1_attr_by_NID(&si->signedAttrs, nid, type, bytes, len))
124 return 1;
125 return 0;
126}
127LCRYPTO_ALIAS(CMS_signed_add1_attr_by_NID);
128
129int
130CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname, int type,
131 const void *bytes, int len)
132{
133 if (X509at_add1_attr_by_txt(&si->signedAttrs, attrname, type, bytes, len))
134 return 1;
135 return 0;
136}
137LCRYPTO_ALIAS(CMS_signed_add1_attr_by_txt);
138
139void *
140CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid,
141 int lastpos, int type)
142{
143 return X509at_get0_data_by_OBJ(si->signedAttrs, oid, lastpos, type);
144}
145LCRYPTO_ALIAS(CMS_signed_get0_data_by_OBJ);
146
147int
148CMS_unsigned_get_attr_count(const CMS_SignerInfo *si)
149{
150 return sk_X509_ATTRIBUTE_num(si->unsignedAttrs);
151}
152LCRYPTO_ALIAS(CMS_unsigned_get_attr_count);
153
154int
155CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos)
156{
157 return X509at_get_attr_by_NID(si->unsignedAttrs, nid, lastpos);
158}
159LCRYPTO_ALIAS(CMS_unsigned_get_attr_by_NID);
160
161int
162CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
163 int lastpos)
164{
165 return X509at_get_attr_by_OBJ(si->unsignedAttrs, obj, lastpos);
166}
167LCRYPTO_ALIAS(CMS_unsigned_get_attr_by_OBJ);
168
169X509_ATTRIBUTE *
170CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc)
171{
172 return sk_X509_ATTRIBUTE_value(si->unsignedAttrs, loc);
173}
174LCRYPTO_ALIAS(CMS_unsigned_get_attr);
175
176X509_ATTRIBUTE *
177CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc)
178{
179 return sk_X509_ATTRIBUTE_delete(si->unsignedAttrs, loc);
180}
181LCRYPTO_ALIAS(CMS_unsigned_delete_attr);
182
183int
184CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr)
185{
186 if (X509at_add1_attr(&si->unsignedAttrs, attr))
187 return 1;
188 return 0;
189}
190LCRYPTO_ALIAS(CMS_unsigned_add1_attr);
191
192int
193CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj,
194 int type, const void *bytes, int len)
195{
196 if (X509at_add1_attr_by_OBJ(&si->unsignedAttrs, obj, type, bytes, len))
197 return 1;
198 return 0;
199}
200LCRYPTO_ALIAS(CMS_unsigned_add1_attr_by_OBJ);
201
202int
203CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type,
204 const void *bytes, int len)
205{
206 if (X509at_add1_attr_by_NID(&si->unsignedAttrs, nid, type, bytes, len))
207 return 1;
208 return 0;
209}
210LCRYPTO_ALIAS(CMS_unsigned_add1_attr_by_NID);
211
212int
213CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname,
214 int type, const void *bytes, int len)
215{
216 if (X509at_add1_attr_by_txt(&si->unsignedAttrs, attrname, type,
217 bytes, len))
218 return 1;
219 return 0;
220}
221LCRYPTO_ALIAS(CMS_unsigned_add1_attr_by_txt);
222
223void *
224CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, int lastpos,
225 int type)
226{
227 return X509at_get0_data_by_OBJ(si->unsignedAttrs, oid, lastpos, type);
228}
229LCRYPTO_ALIAS(CMS_unsigned_get0_data_by_OBJ);
230
231/* Specific attribute cases */