2
0

BN_copy.pod 2.0 KB

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