OpenBSD manual page server

Manual Page Search Parameters

ASN1_BIT_STRING_NUM_ASC(3) Library Functions Manual ASN1_BIT_STRING_NUM_ASC(3)

ASN1_BIT_STRING_num_asc, ASN1_BIT_STRING_set_asc, ASN1_BIT_STRING_name_printnames for individual bits

#include <openssl/asn1.h>

typedef struct {
	int bitnum;
	const char *lname;
	const char *sname;
} BIT_STRING_BITNAME;


int
ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *table);

int
ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bitstr, const char *name, int set, BIT_STRING_BITNAME *table);

int
ASN1_BIT_STRING_name_print(BIO *bio, ASN1_BIT_STRING *bitstr, BIT_STRING_BITNAME *table, int indent);

These functions provide access to individual bits of an ASN.1 BIT STRING based on a table assigning names to individual bits. The table is a variable-sized array. Each element contains a long name lname and a short name sname for the bit with the bit number bitnum. The table needs to be terminated with a dummy element containing a NULL pointer in the lname field.

() retrieves the bitnum from the first element in the table where at least one of the names matches the name argument in the sense of strcmp(3). That bit number can then be used for ASN1_BIT_STRING_get_bit(3).

() converts the name to a bit number using ASN1_BIT_STRING_num_asc() and sets or clears that bit in bitstr according to the set argument, using ASN1_BIT_STRING_set_bit(3). If bitstr is a NULL pointer, no action occurs.

() prints a single line of text to the given BIO. The line starts with indent space characters, contains the long names of the bit contained in the table that are set in bitstr, separated by commas, and ends with a newline character. If any bits are set in bitstr that have no corresponding entries in the table, those bits are silently ignored and nothing is printed for them.

ASN1_BIT_STRING_num_asc() returns a non-negative bit number or -1 if the name is not found in the table.

ASN1_BIT_STRING_set_asc() returns 1 on success or 0 if the name is not found in the table or if memory allocation fails.

ASN1_BIT_STRING_name_print() is intended to return 1 for success or 0 for failure.

ASN1_BIT_STRING_new(3), ASN1_BIT_STRING_set(3), BIO_new(3), strcmp(3)

These functions first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.

ASN1_BIT_STRING_name_print() ignores all errors and always returns 1, even if nothing or only part of the desired output was printed.

November 19, 2021 OpenBSD-7.3