DragonFly On-Line Manual Pages

Search: Section:  


ASN1_INTEGER_GET(3)   DragonFly Library Functions Manual   ASN1_INTEGER_GET(3)

NAME

ASN1_INTEGER_get, ASN1_INTEGER_set, BN_to_ASN1_INTEGER, ASN1_INTEGER_to_BN, ASN1_ENUMERATED_get, ASN1_ENUMERATED_set, BN_to_ASN1_ENUMERATED, ASN1_ENUMERATED_to_BN - ASN.1 INTEGER and ENUMERATED utilities

SYNOPSIS

#include <openssl/asn1.h> long ASN1_INTEGER_get(const ASN1_INTEGER *a); int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); ASN1_INTEGER * BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); BIGNUM * ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); ASN1_ENUMERATED * BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai); BIGNUM * ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn);

DESCRIPTION

These functions convert to and from ASN1_INTEGER and ASN1_ENUMERATED objects. ASN1_INTEGER_get() converts a to the long type. ASN1_INTEGER_set() sets the value of a to v. BN_to_ASN1_INTEGER() converts bn to an ASN1_INTEGER. If ai is NULL, a new ASN1_INTEGER object is returned. Otherwise, the existing object ai is used instead. ASN1_INTEGER_to_BN() converts ai into a BIGNUM. If bn is NULL, a new BIGNUM object is returned. Otherwise, the existing object bn is used instead. ASN1_ENUMERATED_get(), ASN1_ENUMERATED_set(), BN_to_ASN1_ENUMERATED(), and ASN1_ENUMERATED_to_BN() behave like their ASN1_INTEGER counterparts except that they operate on an ASN1_ENUMERATED object.

RETURN VALUES

ASN1_INTEGER_get() and ASN1_ENUMERATED_get() return the converted value, 0 if a is NULL, or -1 on error, which is ambiguous because -1 is a legitimate value for an ASN1_INTEGER. ASN1_INTEGER_set() and ASN1_ENUMERATED_set() return 1 for success or 0 for failure. They only fail if a memory allocation error occurs. BN_to_ASN1_INTEGER() and BN_to_ASN1_ENUMERATED() return an ASN1_INTEGER or ASN1_ENUMERATED object, respectively, or NULL if an error occurs. They only fail due to memory allocation errors. ASN1_INTEGER_to_BN() and ASN1_ENUMERATED_to_BN() return a BIGNUM object of NULL if an error occurs. They can fail if the passed type is incorrect (due to a programming error) or due to memory allocation failures.

HISTORY

ASN1_INTEGER_set() first appeared in SSLeay 0.5.1. ASN1_INTEGER_get(), BN_to_ASN1_INTEGER(), and ASN1_INTEGER_to_BN() first appeared in SSLeay 0.6.0. These functions have been available since OpenBSD 2.3. ASN1_ENUMERATED_get(), ASN1_ENUMERATED_set(), BN_to_ASN1_ENUMERATED(), and ASN1_ENUMERATED_to_BN() first appeared in OpenSSL 0.9.2b and have been available since OpenBSD 2.6.

CAVEATS

In general an ASN1_INTEGER or ASN1_ENUMERATED type can contain an integer of almost arbitrary size and so cannot always be represented by a C long type. The ambiguous return values of ASN1_INTEGER_get() and ASN1_ENUMERATED_get() imply that these functions should be avoided if possible. DragonFly 5.7-DEVELOPMENT July 8, 2018 DragonFly 5.7-DEVELOPMENT

Search: Section: