diff options
| author | job <> | 2024-01-22 13:44:59 +0000 |
|---|---|---|
| committer | job <> | 2024-01-22 13:44:59 +0000 |
| commit | 1e537811a790deec4072a7aa593bee6216cbe197 (patch) | |
| tree | 8cb808a8bcbe0863be927e96482b7a7db7fb3be1 /src | |
| parent | 005770d6dd6412b58627e24177f07671f9ced763 (diff) | |
| download | openbsd-1e537811a790deec4072a7aa593bee6216cbe197.tar.gz openbsd-1e537811a790deec4072a7aa593bee6216cbe197.tar.bz2 openbsd-1e537811a790deec4072a7aa593bee6216cbe197.zip | |
Document various CMS_{signed,unsigned}_* functions
These functions change signed & unsigned attributes of a CMS SignerInfo object
With & OK tb@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/CMS_signed_add1_attr.3 | 391 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 |
2 files changed, 393 insertions, 1 deletions
diff --git a/src/lib/libcrypto/man/CMS_signed_add1_attr.3 b/src/lib/libcrypto/man/CMS_signed_add1_attr.3 new file mode 100644 index 0000000000..9927047b1b --- /dev/null +++ b/src/lib/libcrypto/man/CMS_signed_add1_attr.3 | |||
| @@ -0,0 +1,391 @@ | |||
| 1 | .\" $OpenBSD: CMS_signed_add1_attr.3,v 1.1 2024/01/22 13:44:59 job Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2024 Job Snijders <job@openbsd.org> | ||
| 4 | .\" Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | ||
| 5 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | ||
| 6 | .\" | ||
| 7 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 8 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 9 | .\" copyright notice and this permission notice appear in all copies. | ||
| 10 | .\" | ||
| 11 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 12 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 13 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 14 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 15 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 18 | .\" | ||
| 19 | .Dd $Mdocdate: January 22 2024 $ | ||
| 20 | .Dt CMS_SIGNED_ADD1_ATTR 3 | ||
| 21 | .Os | ||
| 22 | .Sh NAME | ||
| 23 | .Nm CMS_signed_add1_attr , | ||
| 24 | .Nm CMS_signed_add1_attr_by_NID , | ||
| 25 | .Nm CMS_signed_add1_attr_by_OBJ , | ||
| 26 | .Nm CMS_signed_add1_attr_by_txt , | ||
| 27 | .Nm CMS_signed_delete_attr , | ||
| 28 | .Nm CMS_signed_get0_data_by_OBJ , | ||
| 29 | .Nm CMS_signed_get_attr , | ||
| 30 | .Nm CMS_signed_get_attr_by_NID , | ||
| 31 | .Nm CMS_signed_get_attr_by_OBJ , | ||
| 32 | .Nm CMS_signed_get_attr_count , | ||
| 33 | .Nm CMS_unsigned_add1_attr , | ||
| 34 | .Nm CMS_unsigned_add1_attr_by_NID , | ||
| 35 | .Nm CMS_unsigned_add1_attr_by_OBJ , | ||
| 36 | .Nm CMS_unsigned_add1_attr_by_txt , | ||
| 37 | .Nm CMS_unsigned_delete_attr , | ||
| 38 | .Nm CMS_unsigned_get0_data_by_OBJ , | ||
| 39 | .Nm CMS_unsigned_get_attr , | ||
| 40 | .Nm CMS_unsigned_get_attr_by_NID , | ||
| 41 | .Nm CMS_unsigned_get_attr_by_OBJ , | ||
| 42 | .Nm CMS_unsigned_get_attr_count | ||
| 43 | .Nd change signed and unsigned attributes of a CMS SignerInfo object | ||
| 44 | .Sh SYNOPSIS | ||
| 45 | .In openssl/cms.h | ||
| 46 | .Ft int | ||
| 47 | .Fo CMS_signed_add1_attr | ||
| 48 | .Fa "CMS_SignerInfo *si" | ||
| 49 | .Fa "X509_ATTRIBUTE *attr" | ||
| 50 | .Fc | ||
| 51 | .Ft int | ||
| 52 | .Fo CMS_signed_add1_attr_by_NID | ||
| 53 | .Fa "CMS_SignerInfo *si" | ||
| 54 | .Fa "int nid" | ||
| 55 | .Fa "int type" | ||
| 56 | .Fa "const void *bytes" | ||
| 57 | .Fa "int len" | ||
| 58 | .Fc | ||
| 59 | .Ft int | ||
| 60 | .Fo CMS_signed_add1_attr_by_OBJ | ||
| 61 | .Fa "CMS_SignerInfo *si" | ||
| 62 | .Fa "const ASN1_OBJECT *obj" | ||
| 63 | .Fa "int type" | ||
| 64 | .Fa "const void *bytes" | ||
| 65 | .Fa "int len" | ||
| 66 | .Fc | ||
| 67 | .Ft int | ||
| 68 | .Fo CMS_signed_add1_attr_by_txt | ||
| 69 | .Fa "CMS_SignerInfo *si" | ||
| 70 | .Fa "const char *attrname" | ||
| 71 | .Fa "int type" | ||
| 72 | .Fa "const void *bytes" | ||
| 73 | .Fa "int len" | ||
| 74 | .Fc | ||
| 75 | .Ft "X509_ATTRIBUTE *" | ||
| 76 | .Fo CMS_signed_delete_attr | ||
| 77 | .Fa "CMS_SignerInfo *si" | ||
| 78 | .Fa "int loc" | ||
| 79 | .Fc | ||
| 80 | .Ft "void *" | ||
| 81 | .Fo CMS_signed_get0_data_by_OBJ | ||
| 82 | .Fa "CMS_SignerInfo *si" | ||
| 83 | .Fa "const ASN1_OBJECT *oid" | ||
| 84 | .Fa "int lastpos" | ||
| 85 | .Fa "int type" | ||
| 86 | .Fc | ||
| 87 | .Ft "X509_ATTRIBUTE *" | ||
| 88 | .Fo CMS_signed_get_attr | ||
| 89 | .Fa "const CMS_SignerInfo *si" | ||
| 90 | .Fa "int loc" | ||
| 91 | .Fc | ||
| 92 | .Ft int | ||
| 93 | .Fo CMS_signed_get_attr_by_NID | ||
| 94 | .Fa "const CMS_SignerInfo *si" | ||
| 95 | .Fa "int nid" | ||
| 96 | .Fa "int lastpos" | ||
| 97 | .Fc | ||
| 98 | .Ft int | ||
| 99 | .Fo CMS_signed_get_attr_by_OBJ | ||
| 100 | .Fa "const CMS_SignerInfo *si" | ||
| 101 | .Fa "const ASN1_OBJECT *obj" | ||
| 102 | .Fa "int lastpos" | ||
| 103 | .Fc | ||
| 104 | .Ft int | ||
| 105 | .Fo CMS_signed_get_attr_count | ||
| 106 | .Fa "const CMS_SignerInfo *si" | ||
| 107 | .Fc | ||
| 108 | .Ft int | ||
| 109 | .Fo CMS_unsigned_add1_attr | ||
| 110 | .Fa "CMS_SignerInfo *si" | ||
| 111 | .Fa "X509_ATTRIBUTE *attr" | ||
| 112 | .Fc | ||
| 113 | .Ft int | ||
| 114 | .Fo CMS_unsigned_add1_attr_by_NID | ||
| 115 | .Fa "CMS_SignerInfo *si" | ||
| 116 | .Fa "int nid" | ||
| 117 | .Fa "int type" | ||
| 118 | .Fa "const void *bytes" | ||
| 119 | .Fa "int len" | ||
| 120 | .Fc | ||
| 121 | .Ft int | ||
| 122 | .Fo CMS_unsigned_add1_attr_by_OBJ | ||
| 123 | .Fa "CMS_SignerInfo *si" | ||
| 124 | .Fa "const ASN1_OBJECT *obj" | ||
| 125 | .Fa "int type" | ||
| 126 | .Fa "const void *bytes" | ||
| 127 | .Fa "int len" | ||
| 128 | .Fc | ||
| 129 | .Ft int | ||
| 130 | .Fo CMS_unsigned_add1_attr_by_txt | ||
| 131 | .Fa "CMS_SignerInfo *si" | ||
| 132 | .Fa "const char *attrname" | ||
| 133 | .Fa "int type" | ||
| 134 | .Fa "const void *bytes" | ||
| 135 | .Fa "int len" | ||
| 136 | .Fc | ||
| 137 | .Ft "X509_ATTRIBUTE *" | ||
| 138 | .Fo CMS_unsigned_delete_attr | ||
| 139 | .Fa "CMS_SignerInfo *si" | ||
| 140 | .Fa "int loc" | ||
| 141 | .Fc | ||
| 142 | .Ft "void *" | ||
| 143 | .Fo CMS_unsigned_get0_data_by_OBJ | ||
| 144 | .Fa "CMS_SignerInfo *si" | ||
| 145 | .Fa "ASN1_OBJECT *oid" | ||
| 146 | .Fa "int lastpos" | ||
| 147 | .Fa "int type" | ||
| 148 | .Fc | ||
| 149 | .Ft "X509_ATTRIBUTE *" | ||
| 150 | .Fo CMS_unsigned_get_attr | ||
| 151 | .Fa "const CMS_SignerInfo *si" | ||
| 152 | .Fa "int loc" | ||
| 153 | .Fc | ||
| 154 | .Ft int | ||
| 155 | .Fo CMS_unsigned_get_attr_by_NID | ||
| 156 | .Fa "const CMS_SignerInfo *si" | ||
| 157 | .Fa "int nid" | ||
| 158 | .Fa "int lastpos" | ||
| 159 | .Fc | ||
| 160 | .Ft int | ||
| 161 | .Fo CMS_unsigned_get_attr_by_OBJ | ||
| 162 | .Fa "const CMS_SignerInfo *si" | ||
| 163 | .Fa "const ASN1_OBJECT *obj" | ||
| 164 | .Fa "int lastpos" | ||
| 165 | .Fc | ||
| 166 | .Ft int | ||
| 167 | .Fo CMS_unsigned_get_attr_count | ||
| 168 | .Fa "const CMS_SignerInfo *si" | ||
| 169 | .Fc | ||
| 170 | .Sh DESCRIPTION | ||
| 171 | A | ||
| 172 | .Em CMS_SignerInfo | ||
| 173 | object has two optional sets of X.501 attributes: | ||
| 174 | a set of signed attributes in the | ||
| 175 | .Fa signedAttrs | ||
| 176 | array and a set of unsigned attributes in the | ||
| 177 | .Fa unsignedAttrs | ||
| 178 | array. | ||
| 179 | The functions in this manual are wrappers of the | ||
| 180 | .Fn X509at_* | ||
| 181 | functions. | ||
| 182 | All arguments except | ||
| 183 | .Fa si | ||
| 184 | are passed to | ||
| 185 | .Fn X509at_* . | ||
| 186 | The | ||
| 187 | .Fn CMS_signed_* | ||
| 188 | and | ||
| 189 | .Fn CMS_unsigned_* | ||
| 190 | functions are similar, except | ||
| 191 | .Fn CMS_signed_* | ||
| 192 | calls | ||
| 193 | .Fn X509at_* | ||
| 194 | with the | ||
| 195 | .Em CMS_SignerInfo | ||
| 196 | object's set of signed attributes and | ||
| 197 | .Fn CMS_unsigned_* | ||
| 198 | calls | ||
| 199 | .Fn X509at_* | ||
| 200 | with the | ||
| 201 | .Em CMS_SignerInfo | ||
| 202 | object's set of unsigned attributes. | ||
| 203 | For brevity only the | ||
| 204 | .Fn CMS_signed_* | ||
| 205 | functions are described below. | ||
| 206 | .Pp | ||
| 207 | .Fn CMS_signed_add1_attr | ||
| 208 | appends a deep copy of | ||
| 209 | .Fa attr | ||
| 210 | to the | ||
| 211 | .Fa signedAttrs | ||
| 212 | array of | ||
| 213 | .Fa si , | ||
| 214 | allocating a new array if necessary. | ||
| 215 | .Pp | ||
| 216 | .Fn CMS_signed_add1_attr_by_NID , | ||
| 217 | .Fn CMS_signed_add1_attr_by_OBJ , | ||
| 218 | and | ||
| 219 | .Fn CMS_signed_add1_attr_by_txt | ||
| 220 | create a new X.501 Attribute object using | ||
| 221 | .Xr X509at_add1_attr_by_NID 3 , | ||
| 222 | .Xr X509at_add1_attr_by_OBJ 3 , | ||
| 223 | and | ||
| 224 | .Xr X509at_add1_attr_by_txt 3 , | ||
| 225 | and append it to the | ||
| 226 | .Fa signedAttrs | ||
| 227 | array of | ||
| 228 | .Fa si . | ||
| 229 | .Pp | ||
| 230 | .Fn CMS_signed_delete_attr | ||
| 231 | deletes the element with the zero-based | ||
| 232 | .Fa loc | ||
| 233 | in | ||
| 234 | .Fa signedAttrs | ||
| 235 | of | ||
| 236 | .Fa si . | ||
| 237 | .Pp | ||
| 238 | .Fn CMS_signed_get0_data_by_OBJ , | ||
| 239 | .Fn CMS_signed_get_attr_by_NID , | ||
| 240 | and | ||
| 241 | .Fn CMS_signed_get_attr_by_OBJ | ||
| 242 | search the array starting after the index | ||
| 243 | .Fa lastpos . | ||
| 244 | They fail if no matching object is found. | ||
| 245 | .Fn CMS_signed_get0_data_by_OBJ | ||
| 246 | also fails if the data is not of the requested | ||
| 247 | .Fa type . | ||
| 248 | .Pp | ||
| 249 | Additionally, the | ||
| 250 | .Fa lastpos | ||
| 251 | argument of | ||
| 252 | .Fn CMS_signed_get0_data_by_OBJ | ||
| 253 | is interpreted in a special way. | ||
| 254 | If | ||
| 255 | .Fa lastpos | ||
| 256 | is \-2 or smaller, the function also fails if the | ||
| 257 | .Fa signedAttrs | ||
| 258 | array of | ||
| 259 | .Fa si , | ||
| 260 | contains more than one matching object. | ||
| 261 | If | ||
| 262 | .Fa lastpos | ||
| 263 | is \-3 or smaller, it also fails unless the matching object contains exactly | ||
| 264 | one value. | ||
| 265 | .Pp | ||
| 266 | .Fn CMS_signed_get_attr | ||
| 267 | returns the array element at the zero-based | ||
| 268 | .Fa loc . | ||
| 269 | It fails if the | ||
| 270 | .Fa loc | ||
| 271 | argument is negative or greater than or equal to the number of objects in the | ||
| 272 | array. | ||
| 273 | .Pp | ||
| 274 | .Fn CMS_signed_get_attr_count | ||
| 275 | returns the number of objects currently stored in the | ||
| 276 | .Fa signedAttrs | ||
| 277 | array of | ||
| 278 | .Fa si . | ||
| 279 | .Sh RETURN VALUES | ||
| 280 | .Fn CMS_signed_add1_attr , | ||
| 281 | .Fn CMS_signed_add1_attr_by_NID , | ||
| 282 | .Fn CMS_signed_add1_attr_by_OBJ , | ||
| 283 | .Fn CMS_signed_add1_attr_by_txt , | ||
| 284 | .Fn CMS_unsigned_add1_attr , | ||
| 285 | .Fn CMS_unsigned_add1_attr_by_NID , | ||
| 286 | .Fn CMS_unsigned_add1_attr_by_OBJ , | ||
| 287 | and | ||
| 288 | .Fn CMS_unsigned_add1_attr_by_txt | ||
| 289 | return 1 for success or 0 if an error occurs. | ||
| 290 | .Pp | ||
| 291 | .Fn CMS_signed_delete_attr | ||
| 292 | returns the deleted element or | ||
| 293 | .Dv NULL | ||
| 294 | if the | ||
| 295 | .Fa signedAttrs | ||
| 296 | array is | ||
| 297 | .Dv NULL , | ||
| 298 | or if the requested | ||
| 299 | .Fa loc | ||
| 300 | argument is negative, or greater than or equal to the number of objects in it. | ||
| 301 | .Pp | ||
| 302 | .Fn CMS_unsigned_delete_attr | ||
| 303 | returns the deleted element or | ||
| 304 | .Dv NULL | ||
| 305 | if the | ||
| 306 | .Fa unsignedAttrs | ||
| 307 | array is | ||
| 308 | .Dv NULL , | ||
| 309 | or if the requested | ||
| 310 | .Fa loc | ||
| 311 | argument is negative, or greater than or equal to the number of objects in it. | ||
| 312 | .Pp | ||
| 313 | .Fn CMS_signed_get0_data_by_OBJ | ||
| 314 | and | ||
| 315 | .Fn CMS_unsigned_get0_data_by_OBJ | ||
| 316 | return an internal pointer to the data contained in the value of the first | ||
| 317 | object that has an index greater than | ||
| 318 | .Fa lastpos | ||
| 319 | and a type matching | ||
| 320 | .Fa type , | ||
| 321 | or NULL on failure. | ||
| 322 | .Pp | ||
| 323 | .Fn CMS_signed_get_attr | ||
| 324 | and | ||
| 325 | .Fn CMS_unsigned_get_attr | ||
| 326 | return an internal pointer or NULL on failure. | ||
| 327 | .Pp | ||
| 328 | .Fn CMS_signed_get_attr_by_NID , | ||
| 329 | .Fn CMS_signed_get_attr_by_OBJ , | ||
| 330 | .Fn CMS_unsigned_get_attr_by_NID , | ||
| 331 | and | ||
| 332 | .Fn CMS_unsigned_get_attr_by_OBJ | ||
| 333 | return the index of the first object in the array that has an index greater than | ||
| 334 | .Fa lastpos | ||
| 335 | and a type matching | ||
| 336 | .Fa nid | ||
| 337 | or | ||
| 338 | .Fa oid , | ||
| 339 | respectively, or \-1 on failure. | ||
| 340 | In addition, | ||
| 341 | .Fn CMS_signed_get_attr_by_OBJ | ||
| 342 | and | ||
| 343 | .Fn CMS_unsigned_get_attr_by_OBJ | ||
| 344 | return \-2 if | ||
| 345 | .Xr OBJ_nid2obj 3 | ||
| 346 | fails on the requested | ||
| 347 | .Fa nid . | ||
| 348 | .Pp | ||
| 349 | .Fn CMS_signed_get_attr_count | ||
| 350 | and | ||
| 351 | .Fn CMS_unsigned_get_attr_count | ||
| 352 | return the number of array elements or \-1 on failure. | ||
| 353 | .Sh SEE ALSO | ||
| 354 | .Xr CMS_add1_signer 3 , | ||
| 355 | .Xr CMS_get0_SignerInfos 3 , | ||
| 356 | .Xr OBJ_nid2obj 3 , | ||
| 357 | .Xr X509_ATTRIBUTE_create_by_OBJ 3 , | ||
| 358 | .Xr X509_ATTRIBUTE_new 3 , | ||
| 359 | .Xr X509at_add1_attr 3 | ||
| 360 | .Sh STANDARDS | ||
| 361 | RFC 5652: Cryptographic Message Syntax (CMS) | ||
| 362 | .Bl -dash -compact -offset indent | ||
| 363 | .It | ||
| 364 | section 5.3: SignerInfo Type | ||
| 365 | .It | ||
| 366 | section 11: Useful Attributes | ||
| 367 | .El | ||
| 368 | .Sh HISTORY | ||
| 369 | .Fn CMS_signed_add1_attr , | ||
| 370 | .Fn CMS_signed_add1_attr_by_NID , | ||
| 371 | .Fn CMS_signed_add1_attr_by_OBJ , | ||
| 372 | .Fn CMS_signed_add1_attr_by_txt , | ||
| 373 | .Fn CMS_signed_delete_attr , | ||
| 374 | .Fn CMS_signed_get0_data_by_OBJ , | ||
| 375 | .Fn CMS_signed_get_attr , | ||
| 376 | .Fn CMS_signed_get_attr_by_NID , | ||
| 377 | .Fn CMS_signed_get_attr_by_OBJ , | ||
| 378 | .Fn CMS_signed_get_attr_count , | ||
| 379 | .Fn CMS_unsigned_add1_attr , | ||
| 380 | .Fn CMS_unsigned_add1_attr_by_NID , | ||
| 381 | .Fn CMS_unsigned_add1_attr_by_OBJ , | ||
| 382 | .Fn CMS_unsigned_add1_attr_by_txt , | ||
| 383 | .Fn CMS_unsigned_delete_attr , | ||
| 384 | .Fn CMS_unsigned_get0_data_by_OBJ , | ||
| 385 | .Fn CMS_unsigned_get_attr , | ||
| 386 | .Fn CMS_unsigned_get_attr_by_NID , | ||
| 387 | .Fn CMS_unsigned_get_attr_by_OBJ | ||
| 388 | and | ||
| 389 | .Fn CMS_unsigned_get_attr_count | ||
| 390 | first appeared in OpenSSL 0.9.9 and have been available since | ||
| 391 | .Ox 6.6 . | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 72ddcd3435..1123f1729c 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.280 2023/12/29 19:15:15 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.281 2024/01/22 13:44:59 job Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
| 4 | 4 | ||
| @@ -100,6 +100,7 @@ MAN= \ | |||
| 100 | CMS_get1_ReceiptRequest.3 \ | 100 | CMS_get1_ReceiptRequest.3 \ |
| 101 | CMS_sign.3 \ | 101 | CMS_sign.3 \ |
| 102 | CMS_sign_receipt.3 \ | 102 | CMS_sign_receipt.3 \ |
| 103 | CMS_signed_add1_attr.3 \ | ||
| 103 | CMS_uncompress.3 \ | 104 | CMS_uncompress.3 \ |
| 104 | CMS_verify.3 \ | 105 | CMS_verify.3 \ |
| 105 | CMS_verify_receipt.3 \ | 106 | CMS_verify_receipt.3 \ |
