BN_ADD_WORD(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’– 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() β€” adds w to a ("a+=w"). simple, iconic.
  • BN_sub_word() β€” subtracts w from a ("a-=w"). math but make it subtraction, slay.
  • BN_mul_word() β€” multiplies a and w ("a*=w"). multiplication main character behavior.
  • BN_div_word() β€” divides a by w ("a/=w") and returns the remainder. the way it hands back the remainder? obsessed.
  • BN_mod_word() β€” returns the remainder of a divided by w ("a%w"). mod vibes only.
🚨 Important: for BN_div_word() and BN_mod_word(), w must not be 0. 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 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