| /* SPDX-License-Identifier: BSD-2 */ |
| /******************************************************************************* |
| * Copyright 2017-2018, Fraunhofer SIT sponsored by Infineon Technologies AG |
| * All rights reserved. |
| *******************************************************************************/ |
| |
| #include <stdlib.h> |
| |
| #include "tss2_esys.h" |
| |
| #include "esys_iutil.h" |
| #include "test-esapi.h" |
| #define LOGMODULE test |
| #include "util/log.h" |
| |
| /* Test the ESAPI function Esys_ECC_Parameters */ |
| int |
| test_invoke_esapi(ESYS_CONTEXT * esys_context) |
| { |
| TSS2_RC r; |
| int failure_return = EXIT_FAILURE; |
| |
| TPMI_ECC_CURVE curveID = TPM2_ECC_NIST_P256; |
| TPMS_ALGORITHM_DETAIL_ECC *parameters; |
| |
| r = Esys_ECC_Parameters( |
| esys_context, |
| ESYS_TR_NONE, |
| ESYS_TR_NONE, |
| ESYS_TR_NONE, |
| curveID, |
| ¶meters); |
| |
| if (r == TPM2_RC_CURVE + TPM2_RC_P + TPM2_RC_1) { |
| LOG_WARNING("Curve TPM2_ECC_NIST_P256 supported by TPM."); |
| failure_return = EXIT_SKIP; |
| goto error; |
| } |
| goto_if_error(r, "Error: ECC_Parameters", error); |
| |
| return EXIT_SUCCESS; |
| |
| error: |
| return failure_return; |
| } |