blob: 8a34c61b346946b3dc99bc8b16aab833ca70d5c3 [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
10LIB_EXPORT CRYPT_RESULT _math__Div(
11 const TPM2B *n, // IN: numerator
12 const TPM2B *d, // IN: denominator
13 TPM2B *q, // OUT: quotient
14 TPM2B *r // OUT: remainder
15 );
Vadim Bendebury42c3ea12015-05-29 22:46:51 -070016LIB_EXPORT BOOL _math__IsPrime(
17 const UINT32 prime
18);
19LIB_EXPORT CRYPT_RESULT _math__ModExp(
20 UINT32 cSize, // IN: size of the result
21 BYTE *c, // OUT: results buffer
22 const UINT32 mSize, // IN: size of number to be exponentiated
23 const BYTE *m, // IN: number to be exponentiated
24 const UINT32 eSize, // IN: size of power
25 const BYTE *e, // IN: power
26 const UINT32 nSize, // IN: modulus size
27 const BYTE *n // IN: modulu
28);
Vadim Bendebury0a050712015-05-29 11:35:04 -070029LIB_EXPORT UINT16 _math__Normalize2B(
30 TPM2B *b // IN/OUT: number to normalize
31);
32LIB_EXPORT int _math__sub(
33 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(
41 const UINT32 aSize, // IN: size of a
42 const BYTE *a, // IN: a
43 const UINT32 bSize, // IN: size of b
44 const BYTE *b // IN: b
45 );
46
47#endif // __TPM2_MATHFUNCTIONS_FP_H