summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/cms/cms_att.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/cms/cms_att.c')
-rw-r--r--src/lib/libcrypto/cms/cms_att.c122
1 files changed, 69 insertions, 53 deletions
diff --git a/src/lib/libcrypto/cms/cms_att.c b/src/lib/libcrypto/cms/cms_att.c
index 5b71722ebc..c6bc784fb8 100644
--- a/src/lib/libcrypto/cms/cms_att.c
+++ b/src/lib/libcrypto/cms/cms_att.c
@@ -10,7 +10,7 @@
10 * are met: 10 * are met:
11 * 11 *
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 14 *
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in 16 * notice, this list of conditions and the following disclaimer in
@@ -60,134 +60,150 @@
60 60
61/* CMS SignedData Attribute utilities */ 61/* CMS SignedData Attribute utilities */
62 62
63int CMS_signed_get_attr_count(const CMS_SignerInfo *si) 63int
64CMS_signed_get_attr_count(const CMS_SignerInfo *si)
64{ 65{
65 return X509at_get_attr_count(si->signedAttrs); 66 return X509at_get_attr_count(si->signedAttrs);
66} 67}
67 68
68int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, 69int
69 int lastpos) 70CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos)
70{ 71{
71 return X509at_get_attr_by_NID(si->signedAttrs, nid, lastpos); 72 return X509at_get_attr_by_NID(si->signedAttrs, nid, lastpos);
72} 73}
73 74
74int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj, 75int
75 int lastpos) 76CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,
77 int lastpos)
76{ 78{
77 return X509at_get_attr_by_OBJ(si->signedAttrs, obj, lastpos); 79 return X509at_get_attr_by_OBJ(si->signedAttrs, obj, lastpos);
78} 80}
79 81
80X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc) 82X509_ATTRIBUTE *
83CMS_signed_get_attr(const CMS_SignerInfo *si, int loc)
81{ 84{
82 return X509at_get_attr(si->signedAttrs, loc); 85 return X509at_get_attr(si->signedAttrs, loc);
83} 86}
84 87
85X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc) 88X509_ATTRIBUTE *
89CMS_signed_delete_attr(CMS_SignerInfo *si, int loc)
86{ 90{
87 return X509at_delete_attr(si->signedAttrs, loc); 91 return X509at_delete_attr(si->signedAttrs, loc);
88} 92}
89 93
90int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr) 94int
95CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr)
91{ 96{
92 if(X509at_add1_attr(&si->signedAttrs, attr)) return 1; 97 if (X509at_add1_attr(&si->signedAttrs, attr))
98 return 1;
93 return 0; 99 return 0;
94} 100}
95 101
96int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, 102int
97 const ASN1_OBJECT *obj, int type, 103CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj,
98 const void *bytes, int len) 104 int type, const void *bytes, int len)
99{ 105{
100 if(X509at_add1_attr_by_OBJ(&si->signedAttrs, obj, 106 if (X509at_add1_attr_by_OBJ(&si->signedAttrs, obj, type, bytes, len))
101 type, bytes, len)) return 1; 107 return 1;
102 return 0; 108 return 0;
103} 109}
104 110
105int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, 111int
106 int nid, int type, 112CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type,
107 const void *bytes, int len) 113 const void *bytes, int len)
108{ 114{
109 if(X509at_add1_attr_by_NID(&si->signedAttrs, nid, 115 if (X509at_add1_attr_by_NID(&si->signedAttrs, nid, type, bytes, len))
110 type, bytes, len)) return 1; 116 return 1;
111 return 0; 117 return 0;
112} 118}
113 119
114int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, 120int
115 const char *attrname, int type, 121CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname, int type,
116 const void *bytes, int len) 122 const void *bytes, int len)
117{ 123{
118 if(X509at_add1_attr_by_txt(&si->signedAttrs, attrname, 124 if (X509at_add1_attr_by_txt(&si->signedAttrs, attrname, type,
119 type, bytes, len)) return 1; 125 bytes, len))
126 return 1;
120 return 0; 127 return 0;
121} 128}
122 129
123void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, 130void *
124 int lastpos, int type) 131CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, int lastpos,
132 int type)
125{ 133{
126 return X509at_get0_data_by_OBJ(si->signedAttrs, oid, lastpos, type); 134 return X509at_get0_data_by_OBJ(si->signedAttrs, oid, lastpos, type);
127} 135}
128 136
129int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si) 137int
138CMS_unsigned_get_attr_count(const CMS_SignerInfo *si)
130{ 139{
131 return X509at_get_attr_count(si->unsignedAttrs); 140 return X509at_get_attr_count(si->unsignedAttrs);
132} 141}
133 142
134int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, 143int
135 int lastpos) 144CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos)
136{ 145{
137 return X509at_get_attr_by_NID(si->unsignedAttrs, nid, lastpos); 146 return X509at_get_attr_by_NID(si->unsignedAttrs, nid, lastpos);
138} 147}
139 148
140int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj, 149int
141 int lastpos) 150CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,
151 int lastpos)
142{ 152{
143 return X509at_get_attr_by_OBJ(si->unsignedAttrs, obj, lastpos); 153 return X509at_get_attr_by_OBJ(si->unsignedAttrs, obj, lastpos);
144} 154}
145 155
146X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc) 156X509_ATTRIBUTE *
157CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc)
147{ 158{
148 return X509at_get_attr(si->unsignedAttrs, loc); 159 return X509at_get_attr(si->unsignedAttrs, loc);
149} 160}
150 161
151X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc) 162X509_ATTRIBUTE *
163CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc)
152{ 164{
153 return X509at_delete_attr(si->unsignedAttrs, loc); 165 return X509at_delete_attr(si->unsignedAttrs, loc);
154} 166}
155 167
156int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr) 168int
169CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr)
157{ 170{
158 if(X509at_add1_attr(&si->unsignedAttrs, attr)) return 1; 171 if (X509at_add1_attr(&si->unsignedAttrs, attr))
172 return 1;
159 return 0; 173 return 0;
160} 174}
161 175
162int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, 176int
163 const ASN1_OBJECT *obj, int type, 177CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *obj,
164 const void *bytes, int len) 178 int type, const void *bytes, int len)
165{ 179{
166 if(X509at_add1_attr_by_OBJ(&si->unsignedAttrs, obj, 180 if (X509at_add1_attr_by_OBJ(&si->unsignedAttrs, obj, type, bytes, len))
167 type, bytes, len)) return 1; 181 return 1;
168 return 0; 182 return 0;
169} 183}
170 184
171int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, 185int
172 int nid, int type, 186CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, int nid, int type,
173 const void *bytes, int len) 187 const void *bytes, int len)
174{ 188{
175 if(X509at_add1_attr_by_NID(&si->unsignedAttrs, nid, 189 if (X509at_add1_attr_by_NID(&si->unsignedAttrs, nid, type, bytes, len))
176 type, bytes, len)) return 1; 190 return 1;
177 return 0; 191 return 0;
178} 192}
179 193
180int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, 194int
181 const char *attrname, int type, 195CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, const char *attrname,
182 const void *bytes, int len) 196 int type, const void *bytes, int len)
183{ 197{
184 if(X509at_add1_attr_by_txt(&si->unsignedAttrs, attrname, 198 if (X509at_add1_attr_by_txt(&si->unsignedAttrs, attrname, type,
185 type, bytes, len)) return 1; 199 bytes, len))
200 return 1;
186 return 0; 201 return 0;
187} 202}
188 203
189void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, 204void *
190 int lastpos, int type) 205CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
206 int lastpos, int type)
191{ 207{
192 return X509at_get0_data_by_OBJ(si->unsignedAttrs, oid, lastpos, type); 208 return X509at_get0_data_by_OBJ(si->unsignedAttrs, oid, lastpos, type);
193} 209}