1BN_COPY(3)                          OpenSSL                         BN_COPY(3)
2
3
4

NAME

6       BN_copy, BN_dup, BN_with_flags - copy BIGNUMs
7

SYNOPSIS

9        #include <openssl/bn.h>
10
11        BIGNUM *BN_copy(BIGNUM *to, const BIGNUM *from);
12
13        BIGNUM *BN_dup(const BIGNUM *from);
14
15        void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags);
16

DESCRIPTION

18       BN_copy() copies from to to. BN_dup() creates a new BIGNUM containing
19       the value from.
20
21       BN_with_flags creates a temporary shallow copy of b in dest. It places
22       significant restrictions on the copied data. Applications that do no
23       adhere to these restrictions may encounter unexpected side effects or
24       crashes. For that reason use of this function is discouraged. Any flags
25       provided in flags will be set in dest in addition to any flags already
26       set in b. For example this might commonly be used to create a temporary
27       copy of a BIGNUM with the BN_FLG_CONSTTIME flag set for constant time
28       operations. The temporary copy in dest will share some internal state
29       with b. For this reason the following restrictions apply to the use of
30       dest:
31
32dest should be a newly allocated BIGNUM obtained via a call to
33         BN_new(). It should not have been used for other purposes or
34         initialised in any way.
35
36dest must only be used in "read-only" operations, i.e. typically
37         those functions where the relevant parameter is declared "const".
38
39dest must be used and freed before any further subsequent use of b
40

RETURN VALUES

42       BN_copy() returns to on success, NULL on error. BN_dup() returns the
43       new BIGNUM, and NULL on error. The error codes can be obtained by
44       ERR_get_error(3).
45

SEE ALSO

47       ERR_get_error(3)
48
50       Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
51
52       Licensed under the OpenSSL license (the "License").  You may not use
53       this file except in compliance with the License.  You can obtain a copy
54       in the file LICENSE in the source distribution or at
55       <https://www.openssl.org/source/license.html>.
56
57
58
591.1.1q                            2022-07-07                        BN_COPY(3)
Impressum