OSSL_CMP_ITAV_SET0(3ossl)
okay so welcome to the OSSL_CMP_ITAV_SET0(3ossl) page from the OpenSSL docs, bestie π«Ά this one is all about the OSSL_CMP_ITAV utility functions, and honestly it's giving βtiny but importantβ energy β¨
πΈ NAME πΈ
Meet the whole squad of OSSL_CMP_ITAV utility functions:
OSSL_CMP_ITAV_createOSSL_CMP_ITAV_set0OSSL_CMP_ITAV_get0_typeOSSL_CMP_ITAV_get0_valueOSSL_CMP_ITAV_push0_stack_itemOSSL_CMP_ITAV_new0_certProfileOSSL_CMP_ITAV_get0_certProfile
Those are the OSSL_CMP_ITAV utility functions β periodt π
β¨ SYNOPSIS β¨
#include <openssl/cmp.h>
OSSL_CMP_ITAV *OSSL_CMP_ITAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);
void OSSL_CMP_ITAV_set0(OSSL_CMP_ITAV *itav, ASN1_OBJECT *type,
ASN1_TYPE *value);
ASN1_OBJECT *OSSL_CMP_ITAV_get0_type(const OSSL_CMP_ITAV *itav);
ASN1_TYPE *OSSL_CMP_ITAV_get0_value(const OSSL_CMP_ITAV *itav);
int OSSL_CMP_ITAV_push0_stack_item(STACK_OF(OSSL_CMP_ITAV) **itav_sk_p,
OSSL_CMP_ITAV *itav);
OSSL_CMP_ITAV
*OSSL_CMP_ITAV_new0_certProfile(STACK_OF(ASN1_UTF8STRING) *certProfile);
int OSSL_CMP_ITAV_get0_certProfile(const OSSL_CMP_ITAV *itav,
STACK_OF(ASN1_UTF8STRING) **out);
π DESCRIPTION π
okay so ITAV is short for InfoTypeAndValue. This type is defined in RFC 9810 section 5.3.19 and Appendix F. It is used at various places in CMP messages, e.g., in the generalInfo PKIHeader field, to hold a key-value pair ποΈβ¨
OSSL_CMP_ITAV_create()β creates a newOSSL_CMP_ITAVstructure and fills it in. It combinesOSSL_CMP_ITAV_new()andOSSL_CMP_ITAV_set0()πOSSL_CMP_ITAV_set0()β sets theitavwith aninfoTypeof type and aninfoValueof value. This function uses the pointers type and value internally, so they must not be freed up after the call. important!! do not free them afterward, fr fr π«ΆOSSL_CMP_ITAV_get0_type()β returns a direct pointer to theinfoTypein theitav.OSSL_CMP_ITAV_get0_value()β returns a direct pointer to theinfoValuein theitavas genericASN1_TYPEpointer.OSSL_CMP_ITAV_push0_stack_item()β pushesitavto the stack pointed to by*itav_sk_p. It creates a new stack if*itav_sk_ppoints toNULLπOSSL_CMP_ITAV_new0_certProfile()β creates a newOSSL_CMP_ITAVstructure of typecertProfilethat includes the optionally given list of profile names. On success, ownership of the list is with the newOSSL_CMP_ITAVstructure πOSSL_CMP_ITAV_get0_certProfile()β on success assigns to*outan internal pointer to the list of certificate profile names contained in theinfoValuefield ofitav. The pointer may beNULLif no profile name is included. It is an error if theinfoTypeofitavis notcertProfileπ
π NOTES π
CMP is defined in RFC 9810.
OIDs to use as types in OSSL_CMP_ITAV can be found at <https://datatracker.ietf.org/doc/html/rfc9480#section-4.2.2>. The respective OpenSSL NIDs, such as NID_id_it_certProfile, are defined in the <openssl/obj_mac.h> header file π
π RETURN VALUES π
OSSL_CMP_ITAV_create()andOSSL_CMP_ITAV_new0_certProfile()return a pointer to an ITAV structure on success, orNULLon error πOSSL_CMP_ITAV_set0()does not return a value.OSSL_CMP_ITAV_get0_type()andOSSL_CMP_ITAV_get0_value()return the respective pointer orNULLif their input isNULL.OSSL_CMP_ITAV_push0_stack_item()andOSSL_CMP_ITAV_get0_certProfile()return1on success,0on error.
π EXAMPLES π
The following code creates and sets a structure representing a generic InfoTypeAndValue sequence, using an OID created from text as type, and an integer as value. Afterwards, it is pushed to the OSSL_CMP_CTX to be later included in the requests' PKIHeader's genInfo field π¦
ASN1_OBJECT *type = OBJ_txt2obj("1.2.3.4.5", 1);
if (type == NULL) ...
ASN1_INTEGER *asn1int = ASN1_INTEGER_new();
if (asn1int == NULL || !ASN1_INTEGER_set(asn1int, 12345)) ...
ASN1_TYPE *val = ASN1_TYPE_new();
if (val == NULL) ...
ASN1_TYPE_set(val, V_ASN1_INTEGER, asn1int);
OSSL_CMP_ITAV *itav = OSSL_CMP_ITAV_create(type, val);
if (itav == NULL) ...
if (!OSSL_CMP_CTX_push0_geninfo_ITAV(ctx, itav)) {
OSSL_CMP_ITAV_free(itav); /* also frees type and val */
...
}
...
OSSL_CMP_CTX_free(ctx); /* also frees itav */
π¦ SEE ALSO π¦
OSSL_CMP_CTX_new(3), OSSL_CMP_CTX_free(3), ASN1_TYPE_set(3)
β HISTORY β
The OpenSSL CMP support was added in OpenSSL 3.0.
OSSL_CMP_ITAV_new0_certProfile() and OSSL_CMP_ITAV_get0_certProfile() were added in OpenSSL 3.3 β¨
π COPYRIGHT π
Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
mwah π this page is from OpenSSL 3.5.6, dated 2026-04-07 β bye bestie, go slay those ITAVs πΈππ
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms