]>
Commit | Line | Data |
---|---|---|
dd8dec69 UM |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
e113c9c5 | 5 | BN_copy, BN_dup, BN_with_flags - copy BIGNUMs |
dd8dec69 UM |
6 | |
7 | =head1 SYNOPSIS | |
8 | ||
9 | #include <openssl/bn.h> | |
10 | ||
11 | BIGNUM *BN_copy(BIGNUM *to, const BIGNUM *from); | |
12 | ||
13 | BIGNUM *BN_dup(const BIGNUM *from); | |
14 | ||
e113c9c5 MC |
15 | void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); |
16 | ||
dd8dec69 UM |
17 | =head1 DESCRIPTION |
18 | ||
19 | BN_copy() copies B<from> to B<to>. BN_dup() creates a new B<BIGNUM> | |
20 | containing the value B<from>. | |
21 | ||
e113c9c5 MC |
22 | BN_with_flags creates a B<temporary> shallow copy of B<b> in B<dest>. It places |
23 | significant restrictions on the copied data. Applications that do no adhere to | |
24 | these restrictions may encounter unexpected side effects or crashes. For that | |
25 | reason use of this function is discouraged. Any flags provided in B<flags> will | |
26 | be set in B<dest> in addition to any flags already set in B<b>. For example this | |
27 | might commonly be used to create a temporary copy of a BIGNUM with the | |
28 | B<BN_FLG_CONSTTIME> flag set for constant time operations. The temporary copy in | |
29 | B<dest> will share some internal state with B<b>. For this reason the following | |
30 | restrictions apply to the use of B<dest>: | |
31 | ||
2f61bc2e | 32 | =over 2 |
e113c9c5 MC |
33 | |
34 | =item * | |
35 | ||
36 | B<dest> should be a newly allocated BIGNUM obtained via a call to BN_new(). It | |
37 | should not have been used for other purposes or initialised in any way. | |
38 | ||
39 | =item * | |
40 | ||
41 | B<dest> must only be used in "read-only" operations, i.e. typically those | |
42 | functions where the relevant parameter is declared "const". | |
43 | ||
44 | =item * | |
45 | ||
46 | B<dest> must be used and freed before any further subsequent use of B<b> | |
47 | ||
48 | =back | |
49 | ||
dd8dec69 UM |
50 | =head1 RETURN VALUES |
51 | ||
52 | BN_copy() returns B<to> on success, NULL on error. BN_dup() returns | |
53 | the new B<BIGNUM>, and NULL on error. The error codes can be obtained | |
9b86974e | 54 | by L<ERR_get_error(3)>. |
dd8dec69 UM |
55 | |
56 | =head1 SEE ALSO | |
57 | ||
9e183d22 | 58 | L<ERR_get_error(3)> |
dd8dec69 | 59 | |
e2f92610 RS |
60 | =head1 COPYRIGHT |
61 | ||
9e183d22 | 62 | Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved. |
e2f92610 | 63 | |
4746f25a | 64 | Licensed under the Apache License 2.0 (the "License"). You may not use |
e2f92610 RS |
65 | this file except in compliance with the License. You can obtain a copy |
66 | in the file LICENSE in the source distribution or at | |
67 | L<https://www.openssl.org/source/license.html>. | |
68 | ||
69 | =cut |