Vadim Bendebury | fea3a14 | 2015-05-28 18:53:22 -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_CPRIRSA_FP_H |
| 8 | #define __TPM2_CPRIRSA_FP_H |
| 9 | |
| 10 | LIB_EXPORT BOOL _cpri__RsaStartup(void); |
Vadim Bendebury | c00055c | 2015-05-29 22:50:18 -0700 | [diff] [blame] | 11 | LIB_EXPORT CRYPT_RESULT _cpri__DecryptRSA( |
Vadim Bendebury | f788ffb | 2015-06-05 12:57:27 -0700 | [diff] [blame] | 12 | UINT32 *dOutSize, // OUT: the size of the decrypted data |
| 13 | BYTE *dOut, // OUT: the decrypted data |
| 14 | RSA_KEY *key, // IN: the key to use for decryption |
| 15 | TPM_ALG_ID padType, // IN: the type of padding |
| 16 | UINT32 cInSize, // IN: the amount of data to decrypt |
| 17 | BYTE *cIn, // IN: the data to decrypt |
| 18 | TPM_ALG_ID hashAlg, // IN: in case this is needed for the scheme |
| 19 | const char *label // IN: in case it is needed for the scheme |
| 20 | ); |
| 21 | LIB_EXPORT CRYPT_RESULT |
| 22 | _cpri__EncryptRSA(UINT32 *cOutSize, // OUT: the size of the encrypted data |
| 23 | BYTE *cOut, // OUT: the encrypted data |
| 24 | RSA_KEY *key, // IN: the key to use for encryption |
| 25 | TPM_ALG_ID padType, // IN: the type of padding |
| 26 | UINT32 dInSize, // IN: the amount of data to encrypt |
| 27 | BYTE *dIn, // IN: the data to encrypt |
| 28 | TPM_ALG_ID hashAlg, // IN: in case this is needed |
| 29 | const char *label // IN: in case it is needed |
| 30 | ); |
Vadim Bendebury | c00055c | 2015-05-29 22:50:18 -0700 | [diff] [blame] | 31 | LIB_EXPORT CRYPT_RESULT _cpri__GenerateKeyRSA( |
Vadim Bendebury | f788ffb | 2015-06-05 12:57:27 -0700 | [diff] [blame] | 32 | TPM2B *n, // OUT: The public modulu |
| 33 | TPM2B *p, // OUT: One of the prime factors of n |
| 34 | UINT16 keySizeInBits, // IN: Size of the public modulus in bit |
| 35 | UINT32 e, // IN: The public exponent |
| 36 | TPM_ALG_ID |
| 37 | hashAlg, // IN: hash algorithm to use in the key generation proce |
| 38 | TPM2B *seed, // IN: the seed to use |
| 39 | const char *label, // IN: A label for the generation process. |
| 40 | TPM2B *extra, // IN: Party 1 data for the KDF |
| 41 | UINT32 *counter // IN/OUT: Counter value to allow KFD iteration to be |
| 42 | // propagated across multiple routine |
| 43 | ); |
| 44 | LIB_EXPORT CRYPT_RESULT |
| 45 | _cpri__SignRSA(UINT32 *sigOutSize, // OUT: size of signature |
| 46 | BYTE *sigOut, // OUT: signature |
| 47 | RSA_KEY *key, // IN: key to use |
| 48 | TPM_ALG_ID scheme, // IN: the scheme to use |
| 49 | TPM_ALG_ID hashAlg, // IN: hash algorithm for PKSC1v1_5 |
| 50 | UINT32 hInSize, // IN: size of digest to be signed |
| 51 | BYTE *hIn // IN: digest buffer |
| 52 | ); |
Vadim Bendebury | c00055c | 2015-05-29 22:50:18 -0700 | [diff] [blame] | 53 | LIB_EXPORT CRYPT_RESULT _cpri__TestKeyRSA( |
Vadim Bendebury | f788ffb | 2015-06-05 12:57:27 -0700 | [diff] [blame] | 54 | TPM2B *d, // OUT: the address to receive the private exponent |
| 55 | UINT32 exponent, // IN: the public modulu |
| 56 | TPM2B *publicKey, // IN/OUT: an input if only one prime is provided. an |
| 57 | // output if both primes are provided |
| 58 | TPM2B *prime1, // IN: a first prime |
| 59 | TPM2B *prime2 // IN: an optional second prime |
| 60 | ); |
Vadim Bendebury | c00055c | 2015-05-29 22:50:18 -0700 | [diff] [blame] | 61 | LIB_EXPORT CRYPT_RESULT _cpri__ValidateSignatureRSA( |
Vadim Bendebury | f788ffb | 2015-06-05 12:57:27 -0700 | [diff] [blame] | 62 | RSA_KEY *key, // IN: key to use |
| 63 | TPM_ALG_ID scheme, // IN: the scheme to use |
| 64 | TPM_ALG_ID hashAlg, // IN: hash algorithm |
| 65 | UINT32 hInSize, // IN: size of digest to be checked |
| 66 | BYTE *hIn, // IN: digest buffer |
| 67 | UINT32 sigInSize, // IN: size of signature |
| 68 | BYTE *sigIn, // IN: signature |
| 69 | UINT16 saltSize // IN: salt size for PSS |
| 70 | ); |
| 71 | |
| 72 | #endif // __TPM2_CPRIRSA_FP_H |