BN_ZERO(3SSL)
π BN_ZERO β bestie, it's assignment ops for BIGNUMs π
Okay so real quick: this is a page from the OpenSSL manual, section 3SSL, all about the little assignment glow-ups you can do to a BIGNUM. It's called BN_ZERO but it's really the whole squad: BN_zero, BN_one, BN_value_one, BN_set_word, BN_get_word. No cap, it's a group chat situation.
β¨ NAME β¨
BN_zero, BN_one, BN_value_one, BN_set_word, BN_get_word β BIGNUM assignment operations π
β¨ SYNOPSIS β¨
#include <openssl/bn.h>
void BN_zero(BIGNUM *a);
int BN_one(BIGNUM *a);
const BIGNUM *BN_value_one(void);
int BN_set_word(BIGNUM *a, BN_ULONG w);
unsigned BN_ULONG BN_get_word(BIGNUM *a);
β¨ DESCRIPTION β¨
First things first bestie, let's talk about BN_ULONG π
It's a macro, and it expands to an unsigned integral type. Which type? The one that's optimized to be the most efficient implementation on your local platform. It's giving main character energy, tailored to wherever it lives. π
BN_zero(),BN_one()andBN_set_word()setato the values0,1andwrespectively. And okay fun fact:BN_zero()andBN_one()are macros. Not functions. Macros. β¨BN_value_one()returns aBIGNUMconstant that has the value1. This constant is lowkey so useful β you'd use it in comparisons and in assignment. It's the little1that could. π«ΆBN_get_word()hands you backa, but only if it can actually be represented as aBN_ULONG. Otherwise... keep reading, babes. π
β¨ RETURN VALUES β¨
BN_get_word()returns the valuea, OR β and this is the important part β all-bits-set ifacan't be represented as a single integer. π¨BN_one()andBN_set_word()return1on success,0otherwise.BN_value_one()returns the constant. Obviously. It's literally her whole job. πBN_zero()never fails and returns no value. She simply cannot flop. Periodt. π
β¨ BUGS β¨
Okay so here's the tea, and it's a little cursed π
If a BIGNUM is equal to the value of all-bits-set, it will collide with the error condition returned by BN_get_word() β because BN_get_word() uses that exact same all-bits-set value as its error value. So like... is it a real number or is it an error? The function does not know and honestly neither do we. π Watch out for that one, bestie.
Also: BN_ULONG should probably be a typedef. That's it, that's the note. π
β¨ SEE ALSO β¨
BN_bn2bin(3)π¦
β¨ HISTORY β¨
Back in OpenSSL 0.9.8, BN_zero() got changed to not return a value. Before that, older versions returned an int. Character development, honestly. πβ¨
β¨ COPYRIGHT β¨
Copyright 2000-2018 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. π«Ά
okay that's the whole page, you ate that, no crumbs left π
signed off with love β version 4.0.3, dated 2026-09-29 π β¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms