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