1 /* Copyright 2018 Intel Corporation, Inc
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
17 #include "tpm2_plugin_api.h"
18 //#include "plugin_register.h"
19 //#include "hwpluginif.h"
23 unsigned long mechanism =1;
26 void *keyHandle_sign = NULL;
27 unsigned long int hSession = 1;
34 SSHSM_HW_PLUGIN_ACTIVATE_LOAD_IN_INFO_t *activate_in_info;
35 activate_in_info = malloc(sizeof(SSHSM_HW_PLUGIN_ACTIVATE_LOAD_IN_INFO_t));
36 SSHSM_HW_PLUGIN_ACTIVATE_LOAD_IN_INFO_t *loadkey_in_info;
37 loadkey_in_info = malloc(sizeof(SSHSM_HW_PLUGIN_ACTIVATE_LOAD_IN_INFO_t));
38 loadkey_in_info->num_buffers = 2;
39 unsigned char *str ="abcde";
40 //loadkey_in_info->buffer_info[0]->buffer = str;
41 //loadkey_in_info->buffer_info[0]->length_of_buffer = 5;
42 //loadkey_in_info->buffer_info[1]->buffer = str;
43 //loadkey_in_info->buffer_info[1]->length_of_buffer = 5;
47 printf("---------------------------------------------\n");
48 printf("Test app calling tpm2_plugin APIs\n");
50 printf("---------------------------------------------\n");
53 printf("---------------------------------------------\n");
56 printf("---------------------------------------------\n");
57 tpm2_plugin_activate(activate_in_info);
59 printf("---------------------------------------------\n");
60 tpm2_plugin_rsa_sign_init(keyHandle_sign, mechanism, param, len, (void *)hSession);
62 printf("---------------------------------------------\n");
63 tpm2_plugin_load_key(loadkey_in_info, keyHandle);
65 printf("---------------------------------------------\n");
66 tpm2_plugin_rsa_sign(keyHandle_sign, mechanism, msg, msg_len, (void *)hSession, sig, sig_len);