BN_ADD_WORD(3ossl)
β¨ BN_ADD_WORD β¨
okay bestie, welcome to the BN_ADD_WORD(3ossl) page π this is the OpenSSL manual, and today we're doing math with BIGNUMs and regular little unsigned ints. no cap, it's giving "why would I use full bignum arithmetic when I have a whole number" energy. let's go π¦
πΈ NAME πΈ
BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word β literally arithmetic functions on BIGNUMs but with integers. iconic behavior honestly π
π SYNOPSIS π
#include <openssl/bn.h>
int BN_add_word(BIGNUM *a, BN_ULONG w);
int BN_sub_word(BIGNUM *a, BN_ULONG w);
int BN_mul_word(BIGNUM *a, BN_ULONG w);
BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
look at that cast, so clean, so demure π«Ά
π DESCRIPTION π
So the whole vibe here: these functions do arithmetic operations on BIGNUMs using unsigned integers. and the tea? they are much more efficient than the normal BIGNUM arithmetic operations. main character speed, fr fr β
BN_add_word()β addswtoa, aka"a+=w". simple. stunning. slay β¨BN_sub_word()β subtractswfroma, aka"a-=w". it's giving subtraction πBN_mul_word()β multipliesaandw, aka"a*=w". math but make it fashion πBN_div_word()β dividesabyw("a/=w") and returns the remainder. yes babe, you get the leftovers too πBN_mod_word()β returns the remainder ofadivided byw, aka"a%w". the classic modulo moment π
π¨ okay important bestie: forBN_div_word()andBN_mod_word(),wmust not be 0. do not do that. not even as a joke. dividing by zero is NOT the move π
π₯ RETURN VALUES π₯
BN_add_word(),BN_sub_word()andBN_mul_word()return1for success,0on error. if you got an error, you can pull the error codes withERR_get_error(3)πBN_mod_word()andBN_div_word()returna%won success, and(BN_ULONG)-1if an error occurred. so if you see that, it's not a real remainder, it's a cry for help π
π SEE ALSO π
go read those too, they're part of the lore π§
π 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 OpenSSL 3.5.9, dated 2026-09-29, filed under BN_ADD_WORD(3ossl) β periodt. go do some efficient math, you've got this πβ¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms