OSSL_CMP_ITAV_SET0(3SSL)
π OSSL_CMP_ITAV_SET0 β the ITAV bestie squad π
omg hi. so this is a page from the OpenSSL manual, section 3SSL, and it's all about the OSSL_CMP_ITAV utility functions. yes we're doing CMP today, and yes we're gonna have fun with it. π¦
β¨ NAME β¨
the girlies in question: OSSL_CMP_ITAV_create, OSSL_CMP_ITAV_set0, OSSL_CMP_ITAV_get0_type, OSSL_CMP_ITAV_get0_value, OSSL_CMP_ITAV_push0_stack_item, OSSL_CMP_ITAV_new0_certProfile, OSSL_CMP_ITAV_get0_certProfile β collectively known as the OSSL_CMP_ITAV utility functions. π
πΈ SYNOPSIS πΈ
okay so first you gotta pull in the header, obviously:
#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);
look at all those functions, we love a full roster. π
π DESCRIPTION π
so bestie, ITAV is short for InfoTypeAndValue. iconic name, no notes. this type is defined in RFC 9810 section 5.3.19 and Appendix F (yes we cite our sources, we're not animals). it shows up in various places in CMP messages β for example in the generalInfo PKIHeader field β and its whole job is to hold a key-value pair. it's giving pair-bonded. it's giving dynamic duo. π
OSSL_CMP_ITAV_create()β makes a brand newOSSL_CMP_ITAVstructure and fills it in. it's literally justOSSL_CMP_ITAV_new()andOSSL_CMP_ITAV_set0()combined into one little glow-up. two steps, one function, efficient queen. β¨OSSL_CMP_ITAV_set0()β sets theitavwith an infoType oftypeand an infoValue ofvalue. important warning moment: this function uses the pointerstypeandvalueinternally, so you must NOT free them up after the call. do not do it. put thefree()down. π ownership has been transferred, it's not yours anymore, it's the itav's now.OSSL_CMP_ITAV_get0_type()β hands you back a direct pointer to the infoType inside theitav. no copy, just vibes and addresses.OSSL_CMP_ITAV_get0_value()β same deal but for the infoValue, returned as a genericASN1_TYPEpointer. πOSSL_CMP_ITAV_push0_stack_item()β pushesitavonto the stack that*itav_sk_ppoints to. and if*itav_sk_pis pointing atNULL? it will just create a whole new stack for you. self-sufficient. main character energy fr. π«ΆOSSL_CMP_ITAV_new0_certProfile()β creates a freshOSSL_CMP_ITAVstructure of typecertProfilethat includes the optionally given list of profile names. and on success, ownership of the list belongs to the newOSSL_CMP_ITAVstructure. she takes custody. periodt.OSSL_CMP_ITAV_get0_certProfile()β on success, assigns to*outan internal pointer to the list of certificate profile names contained in theinfoValuefield ofitav. heads up: that pointer may be NULL if no profile name is included. also, it is an error if the infoType ofitavis notcertProfile. like, wrong type? not today. π
π¦ NOTES π¦
CMP is defined in RFC 9810. we said it once, we'll say it again, consistency is a love language. π
OIDs to use as types in OSSL_CMP_ITAV can be found at <https://datatracker.ietf.org/doc/html/rfc9480#section-4.2.2>. bookmark it, bestie. π
and the respective OpenSSL NIDs β such as NID_id_it_certProfile β are defined in the <openssl/obj_mac.h> header file. iykyk. π
π RETURN VALUES π
OSSL_CMP_ITAV_create()andOSSL_CMP_ITAV_new0_certProfile()β return a pointer to an ITAV structure on success, orNULLon error. we love a pointer, we hate aNULL. πOSSL_CMP_ITAV_set0()β does not return a value. she's a void girlie, she gives nothing back and that's fine.OSSL_CMP_ITAV_get0_type()andOSSL_CMP_ITAV_get0_value()β return the respective pointer, orNULLif their input isNULL. garbage in,NULLout, fair.OSSL_CMP_ITAV_push0_stack_item()andOSSL_CMP_ITAV_get0_certProfile()β return1on success,0on error. classic. binary baddies. π₯
β EXAMPLES β
okay so here's the whole scenario: this code creates and sets a structure representing a generic InfoTypeAndValue sequence, using an OID created from text as the type, and an integer as the value. and then afterwards, it's pushed to the OSSL_CMP_CTX so it can be included later in the requests' PKIHeader's genInfo field. full pipeline. ate. π
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 */
note the little comments in there bestie β those free() calls are doing double duty, OSSL_CMP_ITAV_free() also frees type and val, and OSSL_CMP_CTX_free() also frees itav. that's the ownership transfer in action, exactly like we said earlier. look at us connecting the dots. π§
π SEE ALSO π
go read these next, they're all in the same friend group: 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()andOSSL_CMP_ITAV_get0_certProfile()were added in OpenSSL 3.3.
so the certProfile girlies are the newer additions to the group chat. welcome, we're so glad you're here. πΈ
π 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>.
and that's the whole page bestie, no cap, every single detail preserved, nothing skipped, we did it. π
this was page 4.0.3, dated 2026-09-29, from the OpenSSL manual, section 3SSL. mwah. π
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms