[#BN_consttime_swap]
= BN&lowbar;consttime&lowbar;swap
:mrdocs:

Conditionally swap the top `nwords` limbs (and top&sol;neg) of two BIGNUMs in constant time&period;

== Synopsis

Declared in `&lt;openssl&sol;bn&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
BN&lowbar;consttime&lowbar;swap(
    unsigned long swap,
    xref:BIGNUM.adoc[BIGNUM]* a,
    xref:BIGNUM.adoc[BIGNUM]* b,
    int nwords);
----

== Parameters

[cols="1,4"]
|===
| Name| Description
| *swap*
| Non&hyphen;zero to swap, or zero to leave `a` and `b` unchanged (must be 0 or 1)&period;
| *a*
| First BIGNUM (must have at least `nwords` usable limbs)&period;
| *b*
| Second BIGNUM (same size requirement as `a)&period;`
| *nwords*
| Number of limbs to exchange&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
