Vadim Bendebury | 0a05071 | 2015-05-29 11:35:04 -0700 | [diff] [blame] | 1 | /* |
| 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 Bendebury | c00055c | 2015-05-29 22:50:18 -0700 | [diff] [blame] | 10 | LIB_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 Bendebury | 0a05071 | 2015-05-29 11:35:04 -0700 | [diff] [blame] | 16 | LIB_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 Bendebury | 42c3ea1 | 2015-05-29 22:46:51 -0700 | [diff] [blame] | 22 | LIB_EXPORT BOOL _math__IsPrime( |
| 23 | const UINT32 prime |
| 24 | ); |
| 25 | LIB_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 Bendebury | 0a05071 | 2015-05-29 11:35:04 -0700 | [diff] [blame] | 35 | LIB_EXPORT UINT16 _math__Normalize2B( |
| 36 | TPM2B *b // IN/OUT: number to normalize |
| 37 | ); |
| 38 | LIB_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 | ); |
| 46 | LIB_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 |