BN_SET_NEGATIVE(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’… BN_SET_NEGATIVE(3) πŸ’…

okay so bestie, welcome to the Library Functions Manual era of your life β€” this is the page about poking at a BIGNUM and asking it "are you negative or not, be honest" 🫢


✨ NAME ✨

BN_set_negative, BN_is_negative β€” change and inspect the sign of a BIGNUM, no cap πŸŽ€


🌸 SYNOPSIS 🌸

library β€œlibcrypto”

#include <openssl/bn.h>

void
BN_set_negative(BIGNUM *b, int n);

int
BN_is_negative(const BIGNUM *b);

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so BN_set_negative() is literally the vibe-setter here. It sets b to negative if both b and n are non-zero β€” otherwise it sets it to positive. That's it, that's the whole mood. Both gotta be non-zero for the negativity to hit, iykyk ✨

And BN_is_negative()? That's the vibe check. It tests the sign of b. Just a little peek at whether your number is out here being negative or not πŸ‘‘


πŸ’– RETURN VALUES πŸ’–

BN_is_negative() returns 1 if b is negative, or 0 otherwise. Binary queen β€” no in-between, no "it's complicated" πŸ’…


🧚 SEE ALSO 🧚

BN_add(3), BN_new(3), BN_set_bit(3), BN_zero(3) β€” go read these next, they're all iconic in their own way 🌈


⭐ HISTORY ⭐

BN_set_negative() and BN_is_negative() first appeared in OpenSSL 0.9.8 and have been available since OpenBSD 4.5. like, they've been serving sign-flip realness since forever, fr fr πŸŽ€


ok that's the whole page bestie, go forth and be negative (or don't, that's also valid) πŸ’€βœ¨

Debian 🌸 June 8, 2025 πŸ¦‹ β€” signed off with love, mwah πŸ’– πŸ‘‘

πŸ“¦ where this page comes from