summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2016-11-20 16:51:02 +0000
committerschwarze <>2016-11-20 16:51:02 +0000
commit4512d7be41e86f5aa329641c14e0cc1b9508dbcb (patch)
tree5c47e8ff140066dd9032bce7e92c14696842969d
parentff85eaaa8437a0691560878cbffb8657c421ffe8 (diff)
downloadopenbsd-4512d7be41e86f5aa329641c14e0cc1b9508dbcb.tar.gz
openbsd-4512d7be41e86f5aa329641c14e0cc1b9508dbcb.tar.bz2
openbsd-4512d7be41e86f5aa329641c14e0cc1b9508dbcb.zip
Add Copyright and license.
Merge documentation of BN_with_flags(3) from OpenSSL.
-rw-r--r--src/lib/libcrypto/man/BN_copy.3114
1 files changed, 109 insertions, 5 deletions
diff --git a/src/lib/libcrypto/man/BN_copy.3 b/src/lib/libcrypto/man/BN_copy.3
index 80b3087c62..f6110863a0 100644
--- a/src/lib/libcrypto/man/BN_copy.3
+++ b/src/lib/libcrypto/man/BN_copy.3
@@ -1,11 +1,61 @@
1.\" $OpenBSD: BN_copy.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BN_copy.3,v 1.3 2016/11/20 16:51:02 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
2.\" 3.\"
3.Dd $Mdocdate: November 6 2016 $ 4.\" This file was written by Ulf Moeller <ulf@openssl.org>
5.\" and Matt Caswell <matt@openssl.org>.
6.\" Copyright (c) 2000, 2015 The OpenSSL Project. All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\"
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\"
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\" notice, this list of conditions and the following disclaimer in
17.\" the documentation and/or other materials provided with the
18.\" distribution.
19.\"
20.\" 3. All advertising materials mentioning features or use of this
21.\" software must display the following acknowledgment:
22.\" "This product includes software developed by the OpenSSL Project
23.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24.\"
25.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26.\" endorse or promote products derived from this software without
27.\" prior written permission. For written permission, please contact
28.\" openssl-core@openssl.org.
29.\"
30.\" 5. Products derived from this software may not be called "OpenSSL"
31.\" nor may "OpenSSL" appear in their names without prior written
32.\" permission of the OpenSSL Project.
33.\"
34.\" 6. Redistributions of any form whatsoever must retain the following
35.\" acknowledgment:
36.\" "This product includes software developed by the OpenSSL Project
37.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38.\"
39.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\"
52.Dd $Mdocdate: November 20 2016 $
4.Dt BN_COPY 3 53.Dt BN_COPY 3
5.Os 54.Os
6.Sh NAME 55.Sh NAME
7.Nm BN_copy , 56.Nm BN_copy ,
8.Nm BN_dup 57.Nm BN_dup ,
58.Nm BN_with_flags
9.Nd copy BIGNUMs 59.Nd copy BIGNUMs
10.Sh SYNOPSIS 60.Sh SYNOPSIS
11.In openssl/bn.h 61.In openssl/bn.h
@@ -18,6 +68,12 @@
18.Fo BN_dup 68.Fo BN_dup
19.Fa "const BIGNUM *from" 69.Fa "const BIGNUM *from"
20.Fc 70.Fc
71.Ft void
72.Fo BN_with_flags
73.Fa "BIGNUM *dest"
74.Fa "const BIGNUM *b"
75.Fa "int flags"
76.Fc
21.Sh DESCRIPTION 77.Sh DESCRIPTION
22.Fn BN_copy 78.Fn BN_copy
23copies 79copies
@@ -29,16 +85,64 @@ creates a new
29.Vt BIGNUM 85.Vt BIGNUM
30containing the value 86containing the value
31.Fa from . 87.Fa from .
88.Pp
89.Fn BN_with_flags
90creates a
91.Em temporary
92shallow copy of
93.Fa b
94in
95.Fa dest .
96It places significant restrictions on the copied data.
97Applications that do not adhere to these restrictions
98may encounter unexpected side effects or crashes.
99For that reason, use of this function is discouraged.
100.Pp
101Any flags provided in
102.Fa flags
103will be set in
104.Fa dest
105in addition to any flags already set in
106.Fa b .
107For example, this can be used to create a temporary copy of a
108.Vt BIGNUM
109with the
110.Dv BN_FLG_CONSTTIME
111flag set for constant time operations.
112.Pp
113The temporary copy in
114.Fa dest
115will share some internal state with
116.Fa b .
117For this reason, the following restrictions apply to the use of
118.Fa dest :
119.Bl -bullet
120.It
121.Fa dest
122should be a newly allocated
123.Vt BIGNUM
124obtained via a call to
125.Xr BN_new 3 .
126It should not have been used for other purposes or initialised in any way.
127.It
128.Fa dest
129must only be used in "read-only" operations, i.e. typically those
130functions where the relevant parameter is declared "const".
131.It
132.Fa dest
133must be used and freed before any further subsequent use of
134.Fa b .
135.El
32.Sh RETURN VALUES 136.Sh RETURN VALUES
33.Fn BN_copy 137.Fn BN_copy
34returns 138returns
35.Fa to 139.Fa to
36on success, 140on success or
37.Dv NULL 141.Dv NULL
38on error. 142on error.
39.Fn BN_dup 143.Fn BN_dup
40returns the new 144returns the new
41.Vt BIGNUM , 145.Vt BIGNUM
42or 146or
43.Dv NULL 147.Dv NULL
44on error. 148on error.