ASN1_BIT_STRING_SET(3) Library Functions Manual ASN1_BIT_STRING_SET(3) NAME ASN1_BIT_STRING_set, ASN1_BIT_STRING_set_bit, ASN1_BIT_STRING_get_bit - ASN.1 BIT STRING accessors SYNOPSIS #include int ASN1_BIT_STRING_set(ASN1_BIT_STRING *bitstr, unsigned char *data, int len); int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *bitstr, int bitnumber, int set); int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *bitstr, int bitnumber); DESCRIPTION ASN1_BIT_STRING_set() sets the length attribute of bitstr to len and copies that number of bytes from data into bitstr, overwriting any previous data, by merely calling ASN1_STRING_set(3). This function does no validation whatsoever. In particular, it neither checks that bitstr is actually of the type V_ASN1_BIT_STRING nor, even if it is, that the data and len arguments make sense for this particular bit string. If the set argument is non-zero, ASN1_BIT_STRING_set_bit() sets the bit with the given bitnumber in the bitstr; otherwise, it clears that bit. A bitnumber of 0 addresses the most significant bit in the first data byte of bitstr, 7 the least significant bit in the same byte, 8 the most significant bit in the second data byte, and so on. If setting a bit is requested beyond the last existing data byte, additional bytes are added to the bitstr as needed. After clearing a bit, any trailing NUL bytes are removed from the bitstr. ASN1_BIT_STRING_get_bit() checks that the bit with the given bitnumber is set in bitstr. RETURN VALUES ASN1_BIT_STRING_set() returns 1 on success or 0 if memory allocation fails or if data is NULL and len is -1 in the same call. ASN1_BIT_STRING_set_bit() returns 1 on success or 0 if bitstr is NULL or if memory allocation fails. ASN1_BIT_STRING_get_bit() returns 1 if the bit with the given bitnumber is set in the bitstr or 0 if bitstr is NULL, if bitnumber points beyond the last data byte in bitstr, or if the requested bit is not set. SEE ALSO ASN1_BIT_STRING_new(3), ASN1_STRING_set(3), d2i_ASN1_BIT_STRING(3) HISTORY ASN1_BIT_STRING_set() first appeared in SSLeay 0.6.5. ASN1_BIT_STRING_set_bit() and ASN1_BIT_STRING_get_bit() first appeared in SSLeay 0.9.0. These functions have been available since OpenBSD 2.4. Linux 6.8.7-arch1-1 July 28, 2023 Linux 6.8.7-arch1-1