X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=doc%2Fcrypto%2Fbn_internal.pod;h=6b01e2570b48f0ee7633a885077e2eab44b45d01;hb=8a4af56fc6ef29c938d0e181bf39533f941decb3;hp=8da244aed47ce3ba08cb4814b9e1b7c93213cafb;hpb=c8973693abbe48a037638041719ec3f41222fe32;p=oweals%2Fopenssl.git diff --git a/doc/crypto/bn_internal.pod b/doc/crypto/bn_internal.pod index 8da244aed4..6b01e2570b 100644 --- a/doc/crypto/bn_internal.pod +++ b/doc/crypto/bn_internal.pod @@ -13,6 +13,8 @@ library internal functions =head1 SYNOPSIS + #include + BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); @@ -34,9 +36,9 @@ library internal functions int nb); void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n); void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, - BN_ULONG *tmp); + int dna,int dnb,BN_ULONG *tmp); void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, - int tn, int n, BN_ULONG *tmp); + int n, int tna,int tnb, BN_ULONG *tmp); void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, BN_ULONG *tmp); void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, @@ -72,19 +74,19 @@ applications. typedef struct bignum_st { - int top; /* index of last used d (most significant word) */ - BN_ULONG *d; /* pointer to an array of 'BITS2' bit chunks */ + int top; /* number of words used in d */ + BN_ULONG *d; /* pointer to an array containing the integer value */ int max; /* size of the d array */ int neg; /* sign */ } BIGNUM; -The big number is stored in B, a malloc()ed array of Bs, -least significant first. A B can be either 16, 32 or 64 bits -in size (B), depending on the 'number of bits' specified in +The integer value is stored in B, a malloc()ed array of words (B), +least significant word first. A B can be either 16, 32 or 64 bits +in size, depending on the 'number of bits' (B) specified in C. B is the size of the B array that has been allocated. B -is the 'last' entry being used, so for a value of 4, bn.d[0]=4 and +is the number of words being used, so for a value of 4, bn.d[0]=4 and bn.top=1. B is 1 if the number is negative. When a B is B<0>, the B field can be B and B == B<0>. @@ -152,14 +154,15 @@ bn_mul_low_normal(B, B, B, B) operates on the B word arrays B, B and B. It computes the B low words of B*B and places the result in B. -bn_mul_recursive(B, B, B, B, B) operates on the B -word arrays B and B and the 2*B word arrays B and B. -B must be a power of 2. It computes B*B and places the -result in B. +bn_mul_recursive(B, B, B, B, B, B, B) operates +on the word arrays B and B of length B+B and B+B +(B and B are currently allowed to be 0 or negative) and the 2*B +word arrays B and B. B must be a power of 2. It computes +B*B and places the result in B. -bn_mul_part_recursive(B, B, B, B, B, B) operates -on the B+B word arrays B and B and the 4*B word arrays -B and B. +bn_mul_part_recursive(B, B, B, B, B, B, B) +operates on the word arrays B and B of length B+B and +B+B and the 4*B word arrays B and B. bn_mul_low_recursive(B, B, B, B, B) operates on the B word arrays B and B and the B/2 word arrays B @@ -201,7 +204,7 @@ call bn_expand2(), which allocates a new B array and copies the data. They return B on error, B otherwise. The bn_fix_top() macro reduces Btop> to point to the most -significant non-zero word when B has shrunk. +significant non-zero word plus one when B has shrunk. =head2 Debugging