libressl-BN_set_negative(3)

libressl-BN_set_negative3

Change and inspect the sign of a bignum

Usage

Crypto Library (libcrypto, -lcrypto)

#include <openssl/bn.h>

void

BN_set_negative(BIGNUM *b, int n);

int

BN_is_negative(const BIGNUM *b);

Overview

BN_set_negative() sets b to negative if both b and n are non-zero, otherwise it sets it to positive.

BN_is_negative() tests the sign of b.

Return values

BN_is_negative() returns 1 if b is negative or 0 otherwise.

History

BN_set_negative() and BN_is_negative() first appeared in OpenSSL 0.9.8 and have been available since OpenBSD 4.5.

From libressl 4.4.0-1 in Arch Linux 2026-11-01. Parsed by carta from the page's mdoc source.