BN_ADD_WORD(3ossl)
π NAME π
okay so this is the BN_ADD_WORD(3ossl) page, and itβs giving big βBIGNUM but make it a wordβ energy. It covers BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, and BN_mod_word β the arithmetic functions on BIGNUMs with integers. iykyk. π
β¨ 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);
π¦ DESCRIPTION π¦
These functions do arithmetic operations on BIGNUMs with unsigned integers, and they are much more efficient than the normal BIGNUM arithmetic operations. No cap, that efficiency is the whole moment.
BN_add_word()β addswtoa("a+=w"). simple, iconic.BN_sub_word()β subtractswfroma("a-=w"). math but make it subtraction, slay.BN_mul_word()β multipliesaandw("a*=w"). multiplication main character behavior.BN_div_word()β dividesabyw("a/=w") and returns the remainder. the way it hands back the remainder? obsessed.BN_mod_word()β returns the remainder ofadivided byw("a%w"). mod vibes only.
π¨ Important: forBN_div_word()andBN_mod_word(),wmust not be0. Like, do not. Thatβs the rule, bestie. π«Ά
πΈ RETURN VALUES πΈ
BN_add_word(), BN_sub_word(), and BN_mul_word() return 1 for success, 0 on error. The error codes can be obtained by ERR_get_error(3). Slay for success, sad little zero for error. π
BN_mod_word() and BN_div_word() return a%w on success and (BN_ULONG)-1 if an error occurred. That (BN_ULONG)-1 is the error signal, periodt. π
π SEE ALSO π
Go read ERR_get_error(3) and BN_add(3) next, bestie. Required reading, fr fr. πβ¨
π 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>.
π thatβs the whole page, bestie π This one ships with OpenSSL 3.5.6 and is dated 2026-04-07. Go forth and do your word-sized math, ily. πβ¨π¦
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms