OpenBSD manual page server

Manual Page Search Parameters

ASN1_STRING_TABLE_ADD(3) Library Functions Manual ASN1_STRING_TABLE_ADD(3)

ASN1_STRING_TABLE_add, ASN1_STRING_TABLE_get, ASN1_STRING_TABLE_cleanupmaintain the global ASN.1 string table

#include <openssl/asn1.h>

int
ASN1_STRING_TABLE_add(int nid, long minsize, long maxsize, unsigned long mask, unsigned long flags);

ASN1_STRING_TABLE *
ASN1_STRING_TABLE_get(int nid);

void
ASN1_STRING_TABLE_cleanup(void);

The ASN.1 string table is a unique global object. Each entry is of the type ASN1_STRING_TABLE and contains information about one NID object. Some entries are predefined according to RFC 3280 appendix A.1.

By default, the upper bounds for the number of characters in various kinds of ASN1_STRING objects are:

object type maxsize symbolic constant
64
2
32768
32768
128
32768
64
64
128
64
128
32768

The function () changes the existing entry for nid or, if there is none, allocates a new entry. The fields of the entry are overwritten with the function arguments of the same name. If minsize or maxsize is negative or mask is 0, that argument is ignored and the respective field remains unchanged, or for a new entry, it is set to -1, -1, 0, or STABLE_FLAGS_MALLOC, respectively.

The bits set in the flags argument are OR'ed into the existing field rather than overwriting it. The only useful flag is STABLE_NO_MASK. If it is set, ASN1_STRING_set_by_NID(3) skips applying the global mask that can be set with ASN1_STRING_set_default_mask(3). Otherwise, the table entry only accepts types permitted by both the global mask and the mask argument. Setting STABLE_FLAGS_MALLOC or any other bit in the mask argument has no effect.

The function () retrieves the entry for nid.

The function () removes and frees all entries except the predefined ones and restores the predefined ones to their default state.

The ASN1_STRING_TABLE_add() function returns 1 if successful; otherwise 0 is returned and an error code can be retrieved with ERR_get_error(3).

ASN1_STRING_TABLE_get() returns a valid ASN1_STRING_TABLE structure or NULL if nothing is found.

ASN1_OBJECT_new(3), ASN1_STRING_set_by_NID(3), OBJ_create(3), OBJ_nid2obj(3)

ASN1_STRING_TABLE_add(), ASN1_STRING_TABLE_get(), and ASN1_STRING_TABLE_cleanup() first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.

Most aspects of the semantics considerably differ from OpenSSL.

December 15, 2021 OpenBSD-7.1