Home | History | Annotate | Download | only in tpm2
      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 
     10 LIB_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                            );
     15 LIB_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
     19                                    );
     20 LIB_EXPORT BOOL _math__IsPrime(const UINT32 prime);
     21 LIB_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               );
     31 LIB_EXPORT UINT16 _math__Normalize2B(TPM2B *b  // IN/OUT: number to normalize
     32                                      );
     33 LIB_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                           );
     40 LIB_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
     44                             );
     45 
     46 #endif  // __TPM2_MATHFUNCTIONS_FP_H
     47