blob: 0e82ba576d797b691664c0f7dd64851e49c2c2ad [file] [log] [blame]
Vadim Bendebury0a050712015-05-29 11:35:04 -07001/*
2 * Copyright 2015 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7#ifndef __TPM2_MATHFUNCTIONS_FP_H
8#define __TPM2_MATHFUNCTIONS_FP_H
9
Vadim Bendeburyf788ffb2015-06-05 12:57:27 -070010LIB_EXPORT int _math__Comp(const UINT32 aSize, // IN: size of a
11 const BYTE *a, // IN: a buffer
12 const UINT32 bSize, // IN: size of b
13 const BYTE *b // IN: b buffer
14 );
15LIB_EXPORT CRYPT_RESULT _math__Div(const TPM2B *n, // IN: numerator
16 const TPM2B *d, // IN: denominator
17 TPM2B *q, // OUT: quotient
18 TPM2B *r // OUT: remainder
Vadim Bendebury0a050712015-05-29 11:35:04 -070019 );
Vadim Bendeburyf788ffb2015-06-05 12:57:27 -070020LIB_EXPORT BOOL _math__IsPrime(const UINT32 prime);
21LIB_EXPORT CRYPT_RESULT
22_math__ModExp(UINT32 cSize, // IN: size of the result
23 BYTE *c, // OUT: results buffer
24 const UINT32 mSize, // IN: size of number to be exponentiated
25 const BYTE *m, // IN: number to be exponentiated
26 const UINT32 eSize, // IN: size of power
27 const BYTE *e, // IN: power
28 const UINT32 nSize, // IN: modulus size
29 const BYTE *n // IN: modulu
30 );
31LIB_EXPORT UINT16 _math__Normalize2B(TPM2B *b // IN/OUT: number to normalize
32 );
33LIB_EXPORT int _math__sub(const UINT32 aSize, // IN: size of a
34 const BYTE *a, // IN: a
35 const UINT32 bSize, // IN: size of b
36 const BYTE *b, // IN: b
37 UINT16 *cSize, // OUT: set to MAX(aSize, bSize)
38 BYTE *c // OUT: the difference
39 );
40LIB_EXPORT int _math__uComp(const UINT32 aSize, // IN: size of a
41 const BYTE *a, // IN: a
42 const UINT32 bSize, // IN: size of b
43 const BYTE *b // IN: b
Vadim Bendebury0a050712015-05-29 11:35:04 -070044 );
45
Vadim Bendeburyf788ffb2015-06-05 12:57:27 -070046#endif // __TPM2_MATHFUNCTIONS_FP_H