GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
BN_SWAP(3) FreeBSD Library Functions Manual BN_SWAP(3)

BN_swap, BN_consttime_swapexchange BIGNUMs

#include <openssl/bn.h>

void
BN_swap(BIGNUM *a, BIGNUM *b);

void
BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords);

() and BN_consttime_swap() exchange the values of a and b.

() implements this by exchanging the pointers to the data buffers of a and b and also exchanging the values of the BN_FLG_STATIC_DATA bits. Consequently, the operation is fast and execution time does not depend on any properties of the two numbers. However, execution time obviously differs between swapping (by calling this function) and not swapping (by not calling this function).

() only performs the exchange if the condition is non-zero; otherwise, it has no effect. It implements the exchange by exchanging the contents of the data buffers rather than the pointers to the data buffers. This is slower, but implemented in such a way that the execution time is not only independent of the properties of the two numbers, but also independent of the condition argument, i.e. the same for swapping or not swapping. Execution time does however grow in an approximately linear manner with the nwords argument.

() calls abort(3) if at least one of a or b has fewer than nwords data words allocated or more than nwords data words are currently in use in at least one of them.

BN_new(3), BN_set_flags(3)

BN_swap() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.2.

BN_consttime_swap() first appeared in OpenSSL 1.0.1g and has been available since OpenBSD 5.6.

December 19, 2021 FreeBSD 14.3-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.