OSSL_CMP_ATAV_SET0(3SSL)

πŸ’– NAME πŸ’–

okay bestie, gather round, this is the OSSL_CMP_ATAV squad and their little utility glow-up corner β€” part of the OpenSSL manual, section 3SSL, no big deal πŸ’…

The whole crew: OSSL_CMP_ATAV, OSSL_CMP_ATAV_create, OSSL_CMP_ATAV_set0, OSSL_CMP_ATAV_get0_type, OSSL_CMP_ATAV_get0_value, OSSL_CMP_ATAV_new_algId, OSSL_CMP_ATAV_get0_algId, OSSL_CMP_ATAV_new_rsaKeyLen, OSSL_CMP_ATAV_get_rsaKeyLen, OSSL_CMP_ATAVS, OSSL_CMP_ATAV_push1, and OSSL_CMP_ATAV_free β€” collectively known as the OSSL_CMP_ATAV utility functions ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <openssl/cmp.h>

typedef OSSL_CRMF_ATTRIBUTETYPEANDVALUE OSSL_CMP_ATAV;
OSSL_CMP_ATAV *OSSL_CMP_ATAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);
void OSSL_CMP_ATAV_set0(OSSL_CMP_ATAV *atav, ASN1_OBJECT *type,
                        ASN1_TYPE *value);
ASN1_OBJECT *OSSL_CMP_ATAV_get0_type(const OSSL_CMP_ATAV *atav);
ASN1_TYPE *OSSL_CMP_ATAV_get0_value(const OSSL_CMP_ATAV *atav);

OSSL_CMP_ATAV *OSSL_CMP_ATAV_new_algId(const X509_ALGOR *alg);
X509_ALGOR *OSSL_CMP_ATAV_get0_algId(const OSSL_CMP_ATAV *atav);
OSSL_CMP_ATAV *OSSL_CMP_ATAV_new_rsaKeyLen(int len);
int OSSL_CMP_ATAV_get_rsaKeyLen(const OSSL_CMP_ATAV *atav);

typedef STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) OSSL_CMP_ATAVS;
int OSSL_CMP_ATAV_push1(OSSL_CMP_ATAVS **sk_p, const OSSL_CMP_ATAV *atav);
void OSSL_CMP_ATAV_free(OSSL_CMP_ATAV *atav);

πŸŽ€ DESCRIPTION πŸŽ€

So OSSL_CMP_ATAV is literally just a cute nickname for OSSL_CRMF_ATTRIBUTETYPEANDVALUE, which is defined over in RFC 4211 Appendix B. Where does it show up? Mainly in CertRequest structures, but also in CertReqTemplateContent structures when we're talking key specifications. It's giving "small but booked and busy" ✨

  • OSSL_CMP_ATAV_create() β€” makes a brand-new OSSL_CMP_ATAV structure and fills it all in. It's lowkey just OSSL_CMP_ATAV_new() and OSSL_CMP_ATAV_set0() combined into one iconic move πŸ’…
  • OSSL_CMP_ATAV_set0() β€” sets the atav with an infoType of type and an infoValue of value. The pointers type and value may be NULL, but if they're not, bestie, you must not free them up after the call, because their ownership has been transferred to atav. Ownership transfer, periodt. And heads up: the itav pointer must not be NULL. 🚨
  • OSSL_CMP_ATAV_get0_type() β€” hands you a direct pointer to the infoType in the atav, unless it's NULL, in which case... yeah.
  • OSSL_CMP_ATAV_get0_value() β€” gives you a direct pointer to the infoValue in the atav as a generic ASN1_TYPE pointer, unless atav is NULL.
  • OSSL_CMP_ATAV_new_algId() β€” creates a shiny new OSSL_CMP_ATAV structure of type algId and fills it in with a copy of the given alg.
  • OSSL_CMP_ATAV_get0_algId() β€” returns a direct pointer to the algId infoValue in the atav of type X509_ALGOR, or NULL if atav is NULL or doesn't contain an algId.
  • OSSL_CMP_ATAV_new_rsaKeyLen() β€” creates a new OSSL_CMP_ATAV structure of type rsaKeyLen and fills it in with the given len, which must be positive. That's the vibe check, fr fr. ✨
  • OSSL_CMP_ATAV_get_rsaKeyLen() β€” returns the RSA key length in rsaKeyLen infoValue in the atav. It returns -1 if atav is NULL, or doesn't contain an rsaKeyLen, or it cannot be parsed; or -2 if the value is less than 1 or is greater than INT_MAX. 😭
  • OSSL_CMP_ATAV_push1() β€” pushes a copy of atav onto the stack of OSSL_CMP_ATAV pointed to by *sk_p. If *sk_p points to NULL, it creates a new stack for you. Iconic behaviour honestly.
  • OSSL_CMP_ATAV_free() β€” deallocates atav. It is defined as a macro, fyi. 🫢

🌈 NOTES 🌈

CMP is defined in RFC 9810. CRMF is defined in RFC 4211. iykyk πŸ’œ


πŸ‘‘ RETURN VALUES πŸ‘‘

  • OSSL_CMP_ATAV_create(), OSSL_CMP_ATAV_new_algId(), and OSSL_CMP_ATAV_new_rsaKeyLen() β€” return a pointer to the ATAV structure on success, or NULL on error. Slay or fail, no in-between.
  • OSSL_CMP_ATAV_set0() and OSSL_CMP_ATAV_free() β€” do not return a value. They're above returning things, respectfully.
  • OSSL_CMP_ATAV_get0_type(), OSSL_CMP_ATAV_get0_value(), and OSSL_CMP_ATAV_get0_algId() β€” return the respective pointer, or NULL if their input is NULL.
  • OSSL_CMP_ATAV_get_rsaKeyLen() β€” returns a key length in bits, or < 0 on error. 🚩
  • OSSL_CMP_ATAV_push1() β€” returns 1 on success, 0 on error.

🌸 SEE ALSO 🌸

OSSL_CMP_ITAV_new0_certReqTemplate(3), ASN1_TYPE_set(3)


⭐ HISTORY ⭐

The OSSL_CMP_ATAV type and related functions were added in OpenSSL 3.4. Baby's not even that old, and already this useful πŸŽ€


Copyright 2022-2024 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 πŸ’– go forth and build your ATAVs, stan OpenSSL, drink water, and don't leak those pointers 🫢

mwah πŸ’… β€” this was the 4.0.3 version of the OSSL_CMP_ATAV_SET0(3SSL) page, dated 2026-09-29, brought to you by the OpenSSL girlies ✨

πŸ“¦ where this page comes from