| 
									
										
										
										
											2000-01-24 06:06:24 +08:00
										 |  |  | =pod | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | =head1 NAME | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-25 00:08:34 +08:00
										 |  |  | BN_copy, BN_dup, BN_with_flags - copy BIGNUMs | 
					
						
							| 
									
										
										
										
											2000-01-24 06:06:24 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | =head1 SYNOPSIS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  #include <openssl/bn.h> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  BIGNUM *BN_copy(BIGNUM *to, const BIGNUM *from); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  BIGNUM *BN_dup(const BIGNUM *from); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-25 00:08:34 +08:00
										 |  |  |  void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-01-24 06:06:24 +08:00
										 |  |  | =head1 DESCRIPTION | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | BN_copy() copies B<from> to B<to>. BN_dup() creates a new B<BIGNUM> | 
					
						
							|  |  |  | containing the value B<from>. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-25 00:08:34 +08:00
										 |  |  | BN_with_flags creates a B<temporary> shallow copy of B<b> in B<dest>. It places | 
					
						
							|  |  |  | significant restrictions on the copied data. Applications that do no adhere to | 
					
						
							|  |  |  | these restrictions may encounter unexpected side effects or crashes. For that | 
					
						
							|  |  |  | reason use of this function is discouraged. Any flags provided in B<flags> will | 
					
						
							|  |  |  | be set in B<dest> in addition to any flags already set in B<b>. For example this | 
					
						
							|  |  |  | might commonly be used to create a temporary copy of a BIGNUM with the | 
					
						
							|  |  |  | B<BN_FLG_CONSTTIME> flag set for constant time operations. The temporary copy in | 
					
						
							|  |  |  | B<dest> will share some internal state with B<b>. For this reason the following | 
					
						
							|  |  |  | restrictions apply to the use of B<dest>: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-08 01:37:47 +08:00
										 |  |  | =over 2 | 
					
						
							| 
									
										
										
										
											2015-11-25 00:08:34 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | =item * | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | B<dest> should be a newly allocated BIGNUM obtained via a call to BN_new(). It | 
					
						
							|  |  |  | should not have been used for other purposes or initialised in any way. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | =item * | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | B<dest> must only be used in "read-only" operations, i.e. typically those | 
					
						
							|  |  |  | functions where the relevant parameter is declared "const". | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | =item * | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | B<dest> must be used and freed before any further subsequent use of B<b> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | =back | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-01-24 06:06:24 +08:00
										 |  |  | =head1 RETURN VALUES | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | BN_copy() returns B<to> on success, NULL on error. BN_dup() returns | 
					
						
							|  |  |  | the new B<BIGNUM>, and NULL on error. The error codes can be obtained | 
					
						
							| 
									
										
										
										
											2015-08-18 03:21:33 +08:00
										 |  |  | by L<ERR_get_error(3)>. | 
					
						
							| 
									
										
										
										
											2000-01-24 06:06:24 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | =head1 SEE ALSO | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-11 21:56:44 +08:00
										 |  |  | L<ERR_get_error(3)> | 
					
						
							| 
									
										
										
										
											2000-01-24 06:06:24 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-18 23:44:05 +08:00
										 |  |  | =head1 COPYRIGHT | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-11 21:56:44 +08:00
										 |  |  | Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2016-05-18 23:44:05 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-06 21:04:44 +08:00
										 |  |  | Licensed under the Apache License 2.0 (the "License").  You may not use | 
					
						
							| 
									
										
										
										
											2016-05-18 23:44:05 +08:00
										 |  |  | this file except in compliance with the License.  You can obtain a copy | 
					
						
							|  |  |  | in the file LICENSE in the source distribution or at | 
					
						
							|  |  |  | L<https://www.openssl.org/source/license.html>. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | =cut |