OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
BigNumLibInternal.h File Reference
#include "BigNumLib.h"

Go to the source code of this file.

Functions

OC_BN_WORD BigNumWordMul64 (OUT OC_BN_WORD *Hi, IN OC_BN_WORD A, IN OC_BN_WORD B)
 
OC_BN_WORD BigNumWordMul (OUT OC_BN_WORD *Hi, IN OC_BN_WORD A, IN OC_BN_WORD B)
 
VOID BigNumSub (IN OUT OC_BN_WORD *Result, IN OC_BN_NUM_WORDS NumWords, IN CONST OC_BN_WORD *A, IN CONST OC_BN_WORD *B)
 
VOID BigNumOrWord (IN OUT OC_BN_WORD *A, IN OC_BN_NUM_WORDS NumWords, IN OC_BN_WORD Value, IN UINTN Exponent)
 
VOID BigNumMod (IN OUT OC_BN_WORD *Result, IN OC_BN_NUM_WORDS NumWordsRest, IN CONST OC_BN_WORD *A, IN OC_BN_NUM_WORDS NumWordsA, IN CONST OC_BN_WORD *B, IN OC_BN_WORD *Scratch)
 
INTN BigNumCmp (IN CONST OC_BN_WORD *A, IN OC_BN_NUM_WORDS NumWords, IN CONST OC_BN_WORD *B)
 
OC_BN_NUM_BITS BigNumSignificantBits (IN CONST OC_BN_WORD *A, IN OC_BN_NUM_WORDS NumWords)
 

Function Documentation

◆ BigNumCmp()

INTN BigNumCmp ( IN CONST OC_BN_WORD * A,
IN OC_BN_NUM_WORDS NumWords,
IN CONST OC_BN_WORD * B )

Returns the relative order of A and B. A and B must have the same precision.

Parameters
[in]AThe first number to compare.
[in]NumWordsThe number of Words to compare.
[in]BThe second number to compare.
Return values
<0 A is lower than B.
0A is as big as B.
>0 A is greater than B.

Definition at line 540 of file BigNumPrimitives.c.

◆ BigNumMod()

VOID BigNumMod ( IN OUT OC_BN_WORD * Result,
IN OC_BN_NUM_WORDS NumWordsRest,
IN CONST OC_BN_WORD * A,
IN OC_BN_NUM_WORDS NumWordsA,
IN CONST OC_BN_WORD * B,
IN OC_BN_WORD * Scratch )

Calculates the remainder of A and B.

Parameters
[in,out]ResultThe buffer to return the result into.
[in]NumWordsRestThe number of Words of Result and B.
[in]AThe dividend.
[in]NumWordsAThe number of Words of A.
[in]BThe divisor.
[in]ScratchScratch buffer 2 * OC_BN_SIZE (NumWordsA).

Definition at line 566 of file BigNumPrimitives.c.

◆ BigNumOrWord()

VOID BigNumOrWord ( IN OUT OC_BN_WORD * A,
IN OC_BN_NUM_WORDS NumWords,
IN OC_BN_WORD Value,
IN UINTN Exponent )

Calculates the binary union of A and (Value << Exponent).

Parameters
[in,out]AThe number to OR with and store the result into.
[in]NumWordsThe number of Words of A.
[in]ValueThe Word value to OR with.
[in]ExponentThe Word shift exponent.

Definition at line 518 of file BigNumPrimitives.c.

◆ BigNumSignificantBits()

OC_BN_NUM_BITS BigNumSignificantBits ( IN CONST OC_BN_WORD * A,
IN OC_BN_NUM_WORDS NumWords )

Returns the number of significant bits in a number. Logically matches OpenSSL's BN_num_bits.

Parameters
[in]AThe number to gather the number of significant bits of.
[in]NumWordsThe number of Words of A.
Returns
The number of significant bits in A.

Definition at line 503 of file BigNumPrimitives.c.

◆ BigNumSub()

VOID BigNumSub ( IN OUT OC_BN_WORD * Result,
IN OC_BN_NUM_WORDS NumWords,
IN CONST OC_BN_WORD * A,
IN CONST OC_BN_WORD * B )

Calulates the difference of A and B. A must have the same precision as B. Result must have a precision at most as bit as A and B.

Parameters
[in,out]ResultThe buffer to return the result into.
[in]NumWordsThe number of Words of Result, minimum number of Words of A and B.
[in]AThe minuend.
[in]BThe subtrahend.

Definition at line 404 of file BigNumPrimitives.c.

◆ BigNumWordMul()

OC_BN_WORD BigNumWordMul ( OUT OC_BN_WORD * Hi,
IN OC_BN_WORD A,
IN OC_BN_WORD B )

Calculates the product of A and B.

Parameters
[out]HiBuffer in which the high Word of the result is returned.
[in]AThe multiplicant.
[in]BThe multiplier.
Returns
The low Word of the result.

Definition at line 379 of file BigNumPrimitives.c.

◆ BigNumWordMul64()

OC_BN_WORD BigNumWordMul64 ( OUT OC_BN_WORD * Hi,
IN OC_BN_WORD A,
IN OC_BN_WORD B )

Copyright (C) 2019, Download-Fritz. All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Calculates the product of A and B.

Parameters
[out]HiBuffer in which the high Word of the result is returned.
[in]AThe multiplicant.
[in]BThe multiplier.
Returns
The low Word of the result.

Definition at line 17 of file BigNumWordMul64.c.