2 * Copyright (c) 2013-2015 TRUSTONIC LIMITED
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef TRUSTONIC_TEE_KEYMASTER_IMPL_H_
33 #define TRUSTONIC_TEE_KEYMASTER_IMPL_H_
35 #include "tlcTeeKeymasterM_if.h"
37 class TrustonicTeeKeymasterImpl
{
39 TrustonicTeeKeymasterImpl();
41 ~TrustonicTeeKeymasterImpl();
43 keymaster_error_t
get_supported_algorithms(
44 keymaster_algorithm_t
** algorithms
,
45 size_t* algorithms_length
);
47 keymaster_error_t
get_supported_block_modes(
48 keymaster_algorithm_t algorithm
,
49 keymaster_purpose_t purpose
,
50 keymaster_block_mode_t
** modes
,
51 size_t* modes_length
);
53 keymaster_error_t
get_supported_padding_modes(
54 keymaster_algorithm_t algorithm
,
55 keymaster_purpose_t purpose
,
56 keymaster_padding_t
** modes
,
57 size_t* modes_length
);
59 keymaster_error_t
get_supported_digests(
60 keymaster_algorithm_t algorithm
,
61 keymaster_purpose_t purpose
,
62 keymaster_digest_t
** digests
,
63 size_t* digests_length
);
65 keymaster_error_t
get_supported_import_formats(
66 keymaster_algorithm_t algorithm
,
67 keymaster_key_format_t
** formats
,
68 size_t* formats_length
);
70 keymaster_error_t
get_supported_export_formats(
71 keymaster_algorithm_t algorithm
,
72 keymaster_key_format_t
** formats
,
73 size_t* formats_length
);
75 keymaster_error_t
add_rng_entropy(
79 keymaster_error_t
generate_key(
80 const keymaster_key_param_set_t
* params
,
81 keymaster_key_blob_t
* key_blob
,
82 keymaster_key_characteristics_t
** characteristics
);
84 keymaster_error_t
get_key_characteristics(
85 const keymaster_key_blob_t
* key_blob
,
86 const keymaster_blob_t
* client_id
,
87 const keymaster_blob_t
* app_data
,
88 keymaster_key_characteristics_t
** character
);
90 keymaster_error_t
import_key(
91 const keymaster_key_param_set_t
* params
,
92 keymaster_key_format_t key_format
,
93 const keymaster_blob_t
* key_data
,
94 keymaster_key_blob_t
* key_blob
,
95 keymaster_key_characteristics_t
** characteristics
);
97 keymaster_error_t
export_key(
98 keymaster_key_format_t export_format
,
99 const keymaster_key_blob_t
* key_to_export
,
100 const keymaster_blob_t
* client_id
,
101 const keymaster_blob_t
* app_data
,
102 keymaster_blob_t
* export_data
);
104 keymaster_error_t
begin(
105 keymaster_purpose_t purpose
,
106 const keymaster_key_blob_t
* key
,
107 const keymaster_key_param_set_t
* params
,
108 keymaster_key_param_set_t
* out_params
,
109 keymaster_operation_handle_t
* operation_handle
);
111 keymaster_error_t
update(
112 keymaster_operation_handle_t operation_handle
,
113 const keymaster_key_param_set_t
* params
,
114 const keymaster_blob_t
* input
,
115 size_t* input_consumed
,
116 keymaster_key_param_set_t
* out_params
,
117 keymaster_blob_t
* output
);
119 keymaster_error_t
finish(
120 keymaster_operation_handle_t operation_handle
,
121 const keymaster_key_param_set_t
* params
,
122 const keymaster_blob_t
* signature
,
123 keymaster_key_param_set_t
* out_params
,
124 keymaster_blob_t
* output
);
126 keymaster_error_t
abort(
127 keymaster_operation_handle_t operation_handle
);
129 TEE_SessionHandle session_handle_
;
134 #endif // TRUSTONIC_TEE_KEYMASTER_IMPL_H_