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