---
name: "libressl-BN_set_negative"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-BN_set_negative"
---

# libressl-BN\_set\_negative(3)

change and inspect the sign of a BIGNUM

## NAME

**BN\_set\_negative**, **BN\_is\_negative** – change and inspect the sign of a BIGNUM

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/bn.h\>**

*void*\

**BN\_set\_negative**(*BIGNUM \*b*, *int n*);

*int*\

**BN\_is\_negative**(*const BIGNUM \*b*);

## DESCRIPTION

**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.

## SEE ALSO

BN\_add(3), BN\_new(3), BN\_set\_bit(3), BN\_zero(3)

## HISTORY

**BN\_set\_negative**() and **BN\_is\_negative**() first appeared in OpenSSL 0.9.8 and have been available since OpenBSD 4.5.
