BN_COPY(3ossl)
π BN_COPY(3ossl) π
okay bestie, so this is the OpenSSL page for BN_copy, BN_dup, and BN_with_flags β it's giving "copying BIGNUMs" and honestly it's a whole little saga πΈ
β¨ SYNOPSIS β¨
like, here's the whole vibe in code:
#include <openssl/bn.h>
BIGNUM *BN_copy(BIGNUM *to, const BIGNUM *from);
BIGNUM *BN_dup(const BIGNUM *from);
void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags);
π¦ DESCRIPTION π¦
BN_copy() copies from to to. iconic. very "just take it and go" energy π
BN_dup() creates a new BIGNUM containing the value from. fresh allocation, no cap, brand new bignum for you π
BN_with_flags creates a temporary shallow copy of b in dest. and bestie, this one comes with significant restrictions on the copied data. applications that do not adhere to these restrictions may encounter unexpected side effects or crashes π for that reason, use of this function is discouraged β I'm gonna say it plainly, this is a "you'd better know what you're doing" function π
any flags you put in flags will be set in dest in addition to any flags already set in b. for example, this might commonly be used to create a temporary copy of a BIGNUM with the BN_FLG_CONSTTIME flag set for constant time operations π₯
the temporary copy in dest will share some internal state with b. for this reason, the following restrictions apply to the use of dest:
destshould be a newly allocatedBIGNUMobtained via a call toBN_new(). it should not have been used for other purposes or initialised in any way π«Άdestmust only be used in "read-only" operations, i.e. typically those functions where the relevant parameter is declaredconstβ¨destmust be used and freed before any further subsequent use ofbβ
fr fr, read those three bullets again. the whole function lives or dies by them π
π RETURN VALUES π
BN_copy() returns to on success, NULL on error. BN_dup() returns the new BIGNUM, and NULL on error. the error codes can be obtained by ERR_get_error(3) π
π SEE ALSO π
ERR_get_error(3) β literally the only one, go check it out bestie π
π COPYRIGHT π
Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π§ this was manual page BN_COPY(3ossl) from OpenSSL 3.5.6, dated 2026-04-07 β slay, go copy some bignums responsibly πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms