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