GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
BN_ADD_WORD(3) FreeBSD Library Functions Manual BN_ADD_WORD(3)

BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_wordarithmetic functions on BIGNUMs with integers

#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);

These functions perform arithmetic operations on BIGNUMs with unsigned integers. They are much more efficient than the normal BIGNUM arithmetic operations.

BN_ULONG is a macro that expands to unsigned long (= uint64_t) on _LP64 platforms and unsigned int (= uint32_t) elsewhere.

() adds w to a (a+=w).

() subtracts w from a (a-=w).

() multiplies a and w (a*=w).

() divides a by w (a/=w) and returns the remainder.

() returns the remainder of a divided by w (a%w).

For () and BN_mod_word(), w must not be 0.

BN_add_word(), BN_sub_word(), and BN_mul_word() return 1 for success or 0 on error. The error codes can be obtained by ERR_get_error(3).

BN_mod_word() and BN_div_word() return a%w on success and (BN_ULONG)-1 if an error occurred.

BN_add(3), BN_new(3)

BN_add_word(), BN_div_word(), and BN_mod_word() first appeared in SSLeay 0.5.1. BN_sub_word() and BN_mul_word() first appeared in SSLeay 0.9.0. All these functions have been available since OpenBSD 2.4.

Before 0.9.8a, the return value for BN_div_word() and BN_mod_word() in case of an error was 0.

November 22, 2022 FreeBSD 14.3-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.