xref: /openbsd/lib/libcrypto/man/BN_set_negative.3 (revision 4cfece93)
1.\"	$OpenBSD: BN_set_negative.3,v 1.5 2019/06/03 14:43:15 schwarze Exp $
2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: June 3 2019 $
18.Dt BN_SET_NEGATIVE 3
19.Os
20.Sh NAME
21.Nm BN_set_negative ,
22.Nm BN_is_negative
23.Nd change and inspect the sign of a BIGNUM
24.Sh SYNOPSIS
25.In openssl/bn.h
26.Ft void
27.Fo BN_set_negative
28.Fa "BIGNUM *b"
29.Fa "int n"
30.Fc
31.Ft int
32.Fo BN_is_negative
33.Fa "const BIGNUM *b"
34.Fc
35.Sh DESCRIPTION
36.Fn BN_set_negative
37sets
38.Fa b
39to negative if both
40.Fa b
41and
42.Fa n
43are non-zero, otherwise it sets it to positive.
44.Pp
45.Fn BN_is_negative
46tests the sign of
47.Fa b .
48It is currently implemented as a macro.
49.Sh RETURN VALUES
50.Fn BN_is_negative
51returns 1 if
52.Fa b
53is negative or 0 otherwise.
54.Sh SEE ALSO
55.Xr BN_add 3 ,
56.Xr BN_new 3 ,
57.Xr BN_set_bit 3 ,
58.Xr BN_zero 3
59.Sh HISTORY
60.Fn BN_set_negative
61and
62.Fn BN_is_negative
63first appeared in OpenSSL 0.9.8 and have been available since
64.Ox 4.5 .
65