-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FAPI Test: Add failure test no root certificate.
It is now checked whether the provisioning fails if the appropriate root certificate does not exist. For this purpose the EK certificate is generated with a self signed certificate which is not in the list of the FAPI cerificates. Signed-off-by: Juergen Repp <juergen_repp@web.de>
- Loading branch information
1 parent
50b7608
commit a5bea98
Showing
6 changed files
with
95 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* SPDX-License-Identifier: BSD-2-Clause */ | ||
/******************************************************************************* | ||
* Copyright 2017-2018, Fraunhofer SIT sponsored by Infineon Technologies AG | ||
* All rights reserved. | ||
*******************************************************************************/ | ||
|
||
#ifdef HAVE_CONFIG_H | ||
#include <config.h> | ||
#endif | ||
|
||
#include <stdlib.h> | ||
|
||
#include "tss2_fapi.h" | ||
#include "tss2_esys.h" | ||
|
||
#include "test-fapi.h" | ||
#include "fapi_util.h" | ||
#include "fapi_int.h" | ||
#include "tss2_esys.h" | ||
|
||
#include "esys_iutil.h" | ||
#define LOGMODULE test | ||
#include "util/log.h" | ||
#include "util/aux_util.h" | ||
#include "tss2_mu.h" | ||
#include "fapi_int.h" | ||
|
||
|
||
/** Test the FAPI cleanup in an error case. | ||
* | ||
* Tested FAPI commands: | ||
* - Fapi_Provision() | ||
* | ||
* @param[in,out] context The FAPI_CONTEXT. | ||
* @retval EXIT_FAILURE | ||
* @retval EXIT_SUCCESS | ||
*/ | ||
int | ||
test_fapi_test_provisioning_cert_error(FAPI_CONTEXT *context) | ||
{ | ||
TSS2_RC r; | ||
|
||
#ifndef SELF_SIGNED_CERTIFICATE | ||
return EXIT_SKIP; | ||
#endif | ||
|
||
|
||
setenv("FAPI_TEST_ROOT_CERT", "self", 1); | ||
setenv("FAPI_TEST_INT_CERT", "./ca/root-ca/root-ca.cert.pem", 1); | ||
|
||
r = Fapi_Provision(context, NULL, NULL, NULL); | ||
|
||
if (r == TSS2_FAPI_RC_GENERAL_FAILURE) | ||
return EXIT_SUCCESS; | ||
|
||
LOG_ERROR("Test with self signed certificate did not fail."); | ||
return EXIT_FAILURE; | ||
|
||
} | ||
|
||
int | ||
test_invoke_fapi(FAPI_CONTEXT *fapi_context) | ||
{ | ||
return test_fapi_test_provisioning_cert_error(fapi_context); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters