VirtualBox

source: vbox/trunk/src/libs/libtpms-0.9.0/src/tpm2/crypto/openssl/BnMath_fp.h@ 91612

最後變更 在這個檔案從91612是 91612,由 vboxsync 提交於 3 年 前

src/libs: Export libtpms-0.9.0, bugref:10078

檔案大小: 5.3 KB
 
1/********************************************************************************/
2/* */
3/* */
4/* Written by Ken Goldman */
5/* IBM Thomas J. Watson Research Center */
6/* $Id: BnMath_fp.h 809 2016-11-16 18:31:54Z kgoldman $ */
7/* */
8/* Licenses and Notices */
9/* */
10/* 1. Copyright Licenses: */
11/* */
12/* - Trusted Computing Group (TCG) grants to the user of the source code in */
13/* this specification (the "Source Code") a worldwide, irrevocable, */
14/* nonexclusive, royalty free, copyright license to reproduce, create */
15/* derivative works, distribute, display and perform the Source Code and */
16/* derivative works thereof, and to grant others the rights granted herein. */
17/* */
18/* - The TCG grants to the user of the other parts of the specification */
19/* (other than the Source Code) the rights to reproduce, distribute, */
20/* display, and perform the specification solely for the purpose of */
21/* developing products based on such documents. */
22/* */
23/* 2. Source Code Distribution Conditions: */
24/* */
25/* - Redistributions of Source Code must retain the above copyright licenses, */
26/* this list of conditions and the following disclaimers. */
27/* */
28/* - Redistributions in binary form must reproduce the above copyright */
29/* licenses, this list of conditions and the following disclaimers in the */
30/* documentation and/or other materials provided with the distribution. */
31/* */
32/* 3. Disclaimers: */
33/* */
34/* - THE COPYRIGHT LICENSES SET FORTH ABOVE DO NOT REPRESENT ANY FORM OF */
35/* LICENSE OR WAIVER, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, WITH */
36/* RESPECT TO PATENT RIGHTS HELD BY TCG MEMBERS (OR OTHER THIRD PARTIES) */
37/* THAT MAY BE NECESSARY TO IMPLEMENT THIS SPECIFICATION OR OTHERWISE. */
38/* Contact TCG Administration ([email protected]) for */
39/* information on specification licensing rights available through TCG */
40/* membership agreements. */
41/* */
42/* - THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED */
43/* WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR */
44/* FITNESS FOR A PARTICULAR PURPOSE, ACCURACY, COMPLETENESS, OR */
45/* NONINFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, OR ANY WARRANTY */
46/* OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. */
47/* */
48/* - Without limitation, TCG and its members and licensors disclaim all */
49/* liability, including liability for infringement of any proprietary */
50/* rights, relating to use of information in this specification and to the */
51/* implementation of this specification, and TCG disclaims all liability for */
52/* cost of procurement of substitute goods or services, lost profits, loss */
53/* of use, loss of data or any incidental, consequential, direct, indirect, */
54/* or special damages, whether under contract, tort, warranty or otherwise, */
55/* arising in any way out of use or reliance upon this specification or any */
56/* information herein. */
57/* */
58/* (c) Copyright IBM Corp. and others, 2016 */
59/* */
60/********************************************************************************/
61
62#ifndef BNMATH_FP_H
63#define BNMATH_FP_H
64
65LIB_EXPORT BOOL
66BnAdd(
67 bigNum result,
68 bigConst op1,
69 bigConst op2
70 );
71LIB_EXPORT BOOL
72BnAddWord(
73 bigNum result,
74 bigConst op,
75 crypt_uword_t word
76 );
77LIB_EXPORT BOOL
78BnSub(
79 bigNum result,
80 bigConst op1,
81 bigConst op2
82 );
83LIB_EXPORT BOOL
84BnSubWord(
85 bigNum result,
86 bigConst op,
87 crypt_uword_t word
88 );
89LIB_EXPORT int
90BnUnsignedCmp(
91 bigConst op1,
92 bigConst op2
93 );
94LIB_EXPORT int
95BnUnsignedCmpWord(
96 bigConst op1,
97 crypt_uword_t word
98 );
99LIB_EXPORT crypt_word_t
100BnModWord(
101 bigConst numerator,
102 crypt_word_t modulus
103 );
104LIB_EXPORT int
105Msb(
106 crypt_uword_t word
107 );
108LIB_EXPORT int
109BnMsb(
110 bigConst bn
111 );
112LIB_EXPORT unsigned
113BnSizeInBits(
114 bigConst n
115 );
116LIB_EXPORT bigNum
117BnSetWord(
118 bigNum n,
119 crypt_uword_t w
120 );
121LIB_EXPORT BOOL
122BnSetBit(
123 bigNum bn, // IN/OUT: big number to modify
124 unsigned int bitNum // IN: Bit number to SET
125 );
126LIB_EXPORT BOOL
127BnTestBit(
128 bigNum bn, // IN: number to check
129 unsigned int bitNum // IN: bit to test
130 );
131LIB_EXPORT BOOL
132BnMaskBits(
133 bigNum bn, // IN/OUT: number to mask
134 crypt_uword_t maskBit // IN: the bit number for the mask.
135 );
136LIB_EXPORT BOOL
137BnShiftRight(
138 bigNum result,
139 bigConst toShift,
140 uint32_t shiftAmount
141 );
142LIB_EXPORT BOOL
143BnGetRandomBits(
144 bigNum n,
145 size_t bits,
146 RAND_STATE *rand
147 );
148LIB_EXPORT BOOL
149BnGenerateRandomInRange(
150 bigNum dest,
151 bigConst limit,
152 RAND_STATE *rand
153 );
154// libtpms added begin
155LIB_EXPORT BOOL
156BnGenerateRandomInRangeAllBytes(
157 bigNum dest,
158 bigConst limit,
159 RAND_STATE *rand
160 );
161// libtpms added end
162
163#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette