import libcrypto (LibreSSL 2.5.2)
[unleashed.git] / lib / libcrypto / man / BN_zero.3
blob49d08717e4bf1376b97b79cf859870e97483a62a
1 .\"     $OpenBSD: BN_zero.3,v 1.6 2016/12/10 21:13:25 schwarze Exp $
2 .\"     OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
3 .\"
4 .\" This file was written by Ulf Moeller <ulf@openssl.org>.
5 .\" Copyright (c) 2000, 2001, 2002 The OpenSSL Project.  All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\"
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\"
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in
16 .\"    the documentation and/or other materials provided with the
17 .\"    distribution.
18 .\"
19 .\" 3. All advertising materials mentioning features or use of this
20 .\"    software must display the following acknowledgment:
21 .\"    "This product includes software developed by the OpenSSL Project
22 .\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23 .\"
24 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25 .\"    endorse or promote products derived from this software without
26 .\"    prior written permission. For written permission, please contact
27 .\"    openssl-core@openssl.org.
28 .\"
29 .\" 5. Products derived from this software may not be called "OpenSSL"
30 .\"    nor may "OpenSSL" appear in their names without prior written
31 .\"    permission of the OpenSSL Project.
32 .\"
33 .\" 6. Redistributions of any form whatsoever must retain the following
34 .\"    acknowledgment:
35 .\"    "This product includes software developed by the OpenSSL Project
36 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37 .\"
38 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
42 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
50 .\"
51 .Dd $Mdocdate: December 10 2016 $
52 .Dt BN_ZERO 3
53 .Os
54 .Sh NAME
55 .Nm BN_zero ,
56 .Nm BN_one ,
57 .Nm BN_value_one ,
58 .Nm BN_set_word ,
59 .Nm BN_get_word
60 .Nd BIGNUM assignment operations
61 .Sh SYNOPSIS
62 .In openssl/bn.h
63 .Ft int
64 .Fo BN_zero
65 .Fa "BIGNUM *a"
66 .Fc
67 .Ft int
68 .Fo BN_one
69 .Fa "BIGNUM *a"
70 .Fc
71 .Ft const BIGNUM *
72 .Fo BN_value_one
73 .Fa void
74 .Fc
75 .Ft int
76 .Fo BN_set_word
77 .Fa "BIGNUM *a"
78 .Fa "unsigned long w"
79 .Fc
80 .Ft unsigned long
81 .Fo BN_get_word
82 .Fa "BIGNUM *a"
83 .Fc
84 .Sh DESCRIPTION
85 .Fn BN_zero ,
86 .Fn BN_one ,
87 and
88 .Fn BN_set_word
89 set
90 .Fa a
91 to the values 0, 1 and
92 .Fa w
93 respectively.
94 .Fn BN_zero
95 and
96 .Fn BN_one
97 are macros.
98 .Pp
99 .Fn BN_value_one
100 returns a
101 .Vt BIGNUM
102 constant of value 1.
103 This constant is useful for use in comparisons and assignment.
105 .Fn BN_get_word
106 returns
107 .Fa a
108 if it can be represented as an
109 .Vt unsigned long .
110 .Sh RETURN VALUES
111 .Fn BN_get_word
112 returns the value
113 .Fa a ,
114 or 0xffffffffL if
115 .Fa a
116 cannot be represented as an
117 .Vt unsigned long .
119 .Fn BN_zero ,
120 .Fn BN_one ,
122 .Fn BN_set_word
123 return 1 on success, 0 otherwise.
124 .Fn BN_value_one
125 returns the constant.
126 .Sh SEE ALSO
127 .Xr BN_bn2bin 3 ,
128 .Xr BN_new 3 ,
129 .Xr BN_set_bit 3 ,
130 .Xr BN_set_negative 3
131 .Sh HISTORY
132 .Fn BN_zero ,
133 .Fn BN_one ,
135 .Fn BN_set_word
136 are available in all versions of SSLeay and OpenSSL.
137 .Fn BN_value_one
139 .Fn BN_get_word
140 were added in SSLeay 0.8.
142 .Fn BN_value_one
143 was changed to return a true
144 .Vt const BIGNUM *
145 in OpenSSL 0.9.7.
146 .Sh BUGS
147 Someone might change the constant.
149 If a
150 .Vt BIGNUM
151 is equal to 0xffffffffL; it can be represented as an
152 .Vt unsigned long
153 but this value is also returned on error.