xref: /freebsd/secure/lib/libcrypto/man/man3/ASN1_INTEGER_get_int64.3 (revision c8e7f78a3d28ff6e6223ed136ada8e1e2f34965e)
Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "ASN1_INTEGER_GET_INT64 3ossl"
ASN1_INTEGER_GET_INT64 3ossl "2023-09-19" "3.0.11" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
ASN1_INTEGER_get_uint64, ASN1_INTEGER_set_uint64, ASN1_INTEGER_get_int64, ASN1_INTEGER_get, ASN1_INTEGER_set_int64, ASN1_INTEGER_set, BN_to_ASN1_INTEGER, ASN1_INTEGER_to_BN, ASN1_ENUMERATED_get_int64, ASN1_ENUMERATED_get, ASN1_ENUMERATED_set_int64, ASN1_ENUMERATED_set, BN_to_ASN1_ENUMERATED, ASN1_ENUMERATED_to_BN \- ASN.1 INTEGER and ENUMERATED utilities
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/asn1.h> \& int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); long ASN1_INTEGER_get(const ASN1_INTEGER *a); \& int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); \& int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); \& ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); \& int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a); long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); \& int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r); 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); .Ve
"DESCRIPTION"
Header "DESCRIPTION" These functions convert to and from \s-1ASN1_INTEGER\s0 and \s-1ASN1_ENUMERATED\s0 structures.

\fBASN1_INTEGER_get_int64() converts an \s-1ASN1_INTEGER\s0 into an int64_t type If successful it returns 1 and sets *pr to the value of a. If it fails (due to invalid type or the value being too big to fit into an int64_t type) it returns 0.

\fBASN1_INTEGER_get_uint64() is similar to ASN1_INTEGER_get_int64_t() except it converts to a uint64_t type and an error is returned if the passed integer is negative.

\fBASN1_INTEGER_get() also returns the value of a but it returns 0 if a is \s-1NULL\s0 and -1 on error (which is ambiguous because -1 is a legitimate value for an \s-1ASN1_INTEGER\s0). New applications should use ASN1_INTEGER_get_int64() instead.

\fBASN1_INTEGER_set_int64() sets the value of \s-1ASN1_INTEGER\s0 a to the \fBint64_t value r.

\fBASN1_INTEGER_set_uint64() sets the value of \s-1ASN1_INTEGER\s0 a to the \fBuint64_t value r.

\fBASN1_INTEGER_set() sets the value of \s-1ASN1_INTEGER\s0 a to the long value \fIv.

\fBBN_to_ASN1_INTEGER() converts \s-1BIGNUM\s0 bn to an \s-1ASN1_INTEGER\s0. If ai is \s-1NULL\s0 a new \s-1ASN1_INTEGER\s0 structure is returned. If ai is not \s-1NULL\s0 then the existing structure will be used instead.

\fBASN1_INTEGER_to_BN() converts \s-1ASN1_INTEGER\s0 ai into a \s-1BIGNUM\s0. If bn is \s-1NULL\s0 a new \s-1BIGNUM\s0 structure is returned. If bn is not \s-1NULL\s0 then the existing structure will be used instead.

\fBASN1_ENUMERATED_get_int64(), ASN1_ENUMERATED_set_int64(), \fBASN1_ENUMERATED_set(), BN_to_ASN1_ENUMERATED() and ASN1_ENUMERATED_to_BN() behave in an identical way to their \s-1ASN1_INTEGER\s0 counterparts except they operate on an \s-1ASN1_ENUMERATED\s0 value.

\fBASN1_ENUMERATED_get() returns the value of a in a similar way to \fBASN1_INTEGER_get() but it returns 0xffffffffL if the value of a will not fit in a long type. New applications should use ASN1_ENUMERATED_get_int64() instead.

"NOTES"
Header "NOTES" In general an \s-1ASN1_INTEGER\s0 or \s-1ASN1_ENUMERATED\s0 type can contain an integer of almost arbitrary size and so cannot always be represented by a C \fBint64_t type. However, in many cases (for example version numbers) they represent small integers which can be more easily manipulated if converted to an appropriate C integer type.
"BUGS"
Header "BUGS" The ambiguous return values of ASN1_INTEGER_get() and ASN1_ENUMERATED_get() mean these functions should be avoided if possible. They are retained for compatibility. Normally the ambiguous return values are not legitimate values for the fields they represent.
"RETURN VALUES"
Header "RETURN VALUES" \fBASN1_INTEGER_set_int64(), ASN1_INTEGER_set(), ASN1_ENUMERATED_set_int64() and \fBASN1_ENUMERATED_set() return 1 for success and 0 for failure. They will only fail if a memory allocation error occurs.

\fBASN1_INTEGER_get_int64() and ASN1_ENUMERATED_get_int64() return 1 for success and 0 for failure. They will fail if the passed type is incorrect (this will only happen if there is a programming error) or if the value exceeds the range of an int64_t type.

\fBBN_to_ASN1_INTEGER() and BN_to_ASN1_ENUMERATED() return an \s-1ASN1_INTEGER\s0 or \fB\s-1ASN1_ENUMERATED\s0 structure respectively or \s-1NULL\s0 if an error occurs. They will only fail due to a memory allocation error.

\fBASN1_INTEGER_to_BN() and ASN1_ENUMERATED_to_BN() return a \s-1BIGNUM\s0 structure of \s-1NULL\s0 if an error occurs. They can fail if the passed type is incorrect (due to programming error) or due to a memory allocation failure.

"SEE ALSO"
Header "SEE ALSO" \fBERR_get_error\|(3)
"HISTORY"
Header "HISTORY" \fBASN1_INTEGER_set_int64(), ASN1_INTEGER_get_int64(), \fBASN1_ENUMERATED_set_int64() and ASN1_ENUMERATED_get_int64() were added in OpenSSL 1.1.0.
"COPYRIGHT"
Header "COPYRIGHT" Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.