forked from DMTF/spdm-emu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the spdm_device_validator_sample to SPDM-Responder-Validator
Fix the issue: DMTF#148 Make the SPDM-Responder-Validator independent. The SPDM-Responder-Validator will not be submodule after this PR. Signed-off-by: Wenxing Hou <[email protected]>
- Loading branch information
1 parent
1bb6798
commit 65216ed
Showing
29 changed files
with
13,836 additions
and
627 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
[submodule "libspdm"] | ||
path = libspdm | ||
url = https://github.com/DMTF/libspdm | ||
[submodule "SPDM-Responder-Validator"] | ||
path = SPDM-Responder-Validator | ||
url = https://github.com/DMTF/SPDM-Responder-Validator |
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
Submodule SPDM-Responder-Validator
deleted from
61debb
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,175 @@ | ||
/** | ||
* Copyright Notice: | ||
* Copyright 2021 DMTF, Componolit. All rights reserved. | ||
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md | ||
**/ | ||
|
||
#ifndef __COMMON_TEST_UTILITY_LIB_H__ | ||
#define __COMMON_TEST_UTILITY_LIB_H__ | ||
|
||
#include "library/spdm_common_lib.h" | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include <string.h> | ||
#include <assert.h> | ||
#include <stdarg.h> | ||
|
||
typedef uint32_t common_test_group_id; | ||
typedef uint32_t common_test_case_id; | ||
typedef uint32_t common_test_assertion_id; | ||
|
||
/* This can be used as "end of list" indicator. */ | ||
#define COMMON_TEST_ID_END 0 | ||
/* This can be used as "test skip" indicator. */ | ||
#define COMMON_TEST_ID_SKIP 0xFFFFFFFF | ||
|
||
typedef enum { | ||
COMMON_TEST_RESULT_NOT_TESTED, | ||
COMMON_TEST_RESULT_PASS, | ||
COMMON_TEST_RESULT_FAIL, | ||
} common_test_result_t; | ||
|
||
typedef void (*common_test_case_func_t) (void *test_context); | ||
|
||
/** | ||
* @return true setup successfully | ||
* @return false setup fail | ||
**/ | ||
typedef bool (*common_test_case_setup_func_t) (void *test_context); | ||
typedef void (*common_test_case_teardown_func_t) (void *test_context); | ||
|
||
/** | ||
* @return true setup successfully | ||
* @return false setup fail | ||
**/ | ||
typedef bool (*common_test_group_setup_func_t) (void *test_context); | ||
typedef void (*common_test_group_teardown_func_t) (void *test_context); | ||
|
||
/** | ||
* | ||
+------------+ | ||
| test suite | | ||
+------------+ | ||
| +------------+ | ||
+----------->| test group | | ||
| +------------+ | ||
| | +------------+ | ||
| +----------->| test case | | ||
| | +------------+ | ||
| | | ||
| | +------------+ | ||
| +----------->| test case | | ||
| +------------+ | ||
| +------------+ | ||
+----------->| test group | | ||
+------------+ | ||
| | ||
**/ | ||
|
||
typedef struct { | ||
uint32_t case_id; | ||
char *case_name; | ||
common_test_case_func_t case_func; | ||
common_test_case_setup_func_t case_setup_func; | ||
common_test_case_teardown_func_t case_teardown_func; | ||
} common_test_case_t; | ||
|
||
typedef struct { | ||
uint32_t group_id; | ||
char *group_name; | ||
common_test_case_t *test_cases; | ||
common_test_group_setup_func_t group_setup_func; | ||
common_test_group_teardown_func_t group_teardown_func; | ||
} common_test_group_t; | ||
|
||
typedef struct { | ||
char *name; | ||
common_test_group_t *test_groups; | ||
} common_test_suite_t; | ||
|
||
/** | ||
* | ||
+-------------------+ | ||
| test suite config | | ||
+-------------------+ | ||
| +-------------------+ | ||
+----------->| test group config | | ||
| +-------------------+ | ||
| | +-------------------+ | ||
| +----------->| test case config | | ||
| | +-------------------+ | ||
| | | ||
| | +-------------------+ | ||
| +----------->| test case config | | ||
| +-------------------+ | ||
| +-------------------+ | ||
+----------->| test group config | | ||
+-------------------+ | ||
| | ||
| rules: | ||
| 1) NULL == RUN | ||
| 2) not-found == SKIP | ||
| 3) SKIP + RUN == RUN + SKIP == SKIP | ||
| | ||
+==========================================+ | ||
| suite | group | case | ACTION | | ||
+==========================================+ | ||
| NULL | - | - | RUN | | ||
+------------------------------------------+ | ||
| exist | NULL | - | RUN | | ||
+------------------------------------------+ | ||
| exist | not-found | - | SKIP | | ||
+------------------------------------------+ | ||
| exist | found:SKIP | - | SKIP | | ||
+------------------------------------------+ | ||
| exist | found:RUN | NULL | RUN | | ||
+------------------------------------------+ | ||
| exist | found:RUN | not-found | SKIP | | ||
+------------------------------------------+ | ||
| exist | found:RUN | found:SKIP | SKIP | | ||
+------------------------------------------+ | ||
| exist | found:RUN | found:RUN | RUN | | ||
+==========================================+ | ||
| | ||
**/ | ||
|
||
typedef enum { | ||
COMMON_TEST_ACTION_RUN, | ||
COMMON_TEST_ACTION_SKIP, | ||
} common_test_action_t; | ||
|
||
typedef struct { | ||
uint32_t case_id; | ||
common_test_action_t action; | ||
} common_test_case_config_t; | ||
|
||
typedef struct { | ||
uint32_t group_id; | ||
common_test_action_t action; | ||
common_test_case_config_t *test_case_configs; | ||
} common_test_group_config_t; | ||
|
||
typedef struct { | ||
char *config_name; | ||
common_test_group_config_t *test_group_configs; | ||
} common_test_suite_config_t; | ||
|
||
void common_test_run_test_suite ( | ||
void *test_context, | ||
const common_test_suite_t *test_suite, | ||
const common_test_suite_config_t *test_suite_config); | ||
|
||
void common_test_record_test_assertion ( | ||
common_test_group_id group_id, | ||
common_test_case_id case_id, | ||
common_test_assertion_id assertion_id, | ||
common_test_result_t test_result, | ||
const char *message_format, | ||
...); | ||
|
||
void common_test_record_test_message(const char *message_format, ...); | ||
|
||
#endif |
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,132 @@ | ||
/** | ||
* Copyright Notice: | ||
* Copyright 2021 DMTF, Componolit. All rights reserved. | ||
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md | ||
**/ | ||
|
||
#ifndef __SPDM_RESPONDER_CONFORMANCE_TEST_LIB_H__ | ||
#define __SPDM_RESPONDER_CONFORMANCE_TEST_LIB_H__ | ||
|
||
#include "library/spdm_common_lib.h" | ||
#include "library/common_test_utility_lib.h" | ||
|
||
void spdm_responder_conformance_test (void *spdm_context, | ||
const common_test_suite_config_t *test_config); | ||
|
||
/* below definition should be aligned with test case description in doc dir */ | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_VERSION 1 | ||
#define SPDM_RESPONDER_TEST_CASE_VERSION_SUCCESS_10 1 | ||
#define SPDM_RESPONDER_TEST_CASE_VERSION_INVALID_REQUEST 2 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_CAPABILITIES 2 | ||
#define SPDM_RESPONDER_TEST_CASE_CAPABILITIES_SUCCESS_10 1 | ||
#define SPDM_RESPONDER_TEST_CASE_CAPABILITIES_VERSION_MISMATCH 2 | ||
#define SPDM_RESPONDER_TEST_CASE_CAPABILITIES_SUCCESS_11 3 | ||
#define SPDM_RESPONDER_TEST_CASE_CAPABILITIES_INVALID_REQUEST 4 | ||
#define SPDM_RESPONDER_TEST_CASE_CAPABILITIES_SUCCESS_12 5 | ||
#define SPDM_RESPONDER_TEST_CASE_CAPABILITIES_UNEXPECTED_REQUEST_NON_IDENTICAL 6 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_ALGORITHMS 3 | ||
#define SPDM_RESPONDER_TEST_CASE_ALGORITHMS_SUCCESS_10 1 | ||
#define SPDM_RESPONDER_TEST_CASE_ALGORITHMS_VERSION_MISMATCH 2 | ||
#define SPDM_RESPONDER_TEST_CASE_ALGORITHMS_UNEXPECTED_REQUEST 3 | ||
#define SPDM_RESPONDER_TEST_CASE_ALGORITHMS_INVALID_REQUEST 4 | ||
#define SPDM_RESPONDER_TEST_CASE_ALGORITHMS_SUCCESS_11 5 | ||
#define SPDM_RESPONDER_TEST_CASE_ALGORITHMS_SUCCESS_12 6 | ||
#define SPDM_RESPONDER_TEST_CASE_ALGORITHMS_UNEXPECTED_REQUEST_NON_IDENTICAL 7 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_DIGESTS 4 | ||
#define SPDM_RESPONDER_TEST_CASE_DIGESTS_SUCCESS_10 1 | ||
#define SPDM_RESPONDER_TEST_CASE_DIGESTS_VERSION_MISMATCH 2 | ||
#define SPDM_RESPONDER_TEST_CASE_DIGESTS_UNEXPECTED_REQUEST 3 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_CERTIFICATE 5 | ||
#define SPDM_RESPONDER_TEST_CASE_CERTIFICATE_SUCCESS_10 1 | ||
#define SPDM_RESPONDER_TEST_CASE_CERTIFICATE_VERSION_MISMATCH 2 | ||
#define SPDM_RESPONDER_TEST_CASE_CERTIFICATE_UNEXPECTED_REQUEST 3 | ||
#define SPDM_RESPONDER_TEST_CASE_CERTIFICATE_INVALID_REQUEST 4 | ||
#define SPDM_RESPONDER_TEST_CASE_CERTIFICATE_SPDM_X509_CERTIFICATE 5 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_CHALLENGE_AUTH 6 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_10_A1B1C1 1 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_10_A1B2C1 2 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_10_A1B3C1 3 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_VERSION_MISMATCH 4 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_UNEXPECTED_REQUEST 5 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_INVALID_REQUEST 6 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_12_A1B1C1 11 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_12_A1B2C1 12 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_12_A1B3C1 13 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_12_A1B4C1 14 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_12_A2B1C1 15 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_12_A2B2C1 16 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_12_A2B3C1 17 | ||
#define SPDM_RESPONDER_TEST_CASE_CHALLENGE_AUTH_SUCCESS_12_A2B4C1 18 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_MEASUREMENTS 7 | ||
#define SPDM_RESPONDER_TEST_CASE_MEASUREMENTS_SUCCESS_10 1 | ||
#define SPDM_RESPONDER_TEST_CASE_MEASUREMENTS_VERSION_MISMATCH 2 | ||
#define SPDM_RESPONDER_TEST_CASE_MEASUREMENTS_UNEXPECTED_REQUEST 3 | ||
#define SPDM_RESPONDER_TEST_CASE_MEASUREMENTS_INVALID_REQUEST 4 | ||
#define SPDM_RESPONDER_TEST_CASE_MEASUREMENTS_SPDM_MEASUREMENT_BLOCK 5 | ||
#define SPDM_RESPONDER_TEST_CASE_MEASUREMENTS_SUCCESS_11 6 | ||
#define SPDM_RESPONDER_TEST_CASE_MEASUREMENTS_SUCCESS_11_IN_DHE_SESSION 7 | ||
#define SPDM_RESPONDER_TEST_CASE_MEASUREMENTS_UNEXPECTED_REQUEST_IN_DHE_SESSION_HS 8 | ||
#define SPDM_RESPONDER_TEST_CASE_MEASUREMENTS_SUCCESS_12 9 | ||
#define SPDM_RESPONDER_TEST_CASE_MEASUREMENTS_SUCCESS_12_IN_DHE_SESSION 10 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_KEY_EXCHANGE_RSP 8 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_EXCHANGE_RSP_SUCCESS_11 1 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_EXCHANGE_RSP_SUCCESS_11_HS_CLEAR 2 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_EXCHANGE_RSP_VERSION_MISMATCH 3 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_EXCHANGE_RSP_UNEXPECTED_REQUEST 4 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_EXCHANGE_RSP_UNEXPECTED_REQUEST_IN_SESSION 5 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_EXCHANGE_RSP_INVALID_REQUEST 6 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_EXCHANGE_RSP_SUCCESS_12 7 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_EXCHANGE_RSP_SUCCESS_12_HS_CLEAR 8 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_FINISH_RSP 9 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_SUCCESS_11 \ | ||
1 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_SUCCESS_11_HS_CLEAR \ | ||
2 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_VERSION_MISMATCH \ | ||
3 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_UNEXPECTED_REQUEST \ | ||
4 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_UNEXPECTED_REQUEST_IN_SESSION \ | ||
5 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_INVALID_REQUEST \ | ||
6 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_DECRYPT_ERROR_INVALID_VERIFY_DATA \ | ||
7 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_DECRYPT_ERROR_INVALID_VERIFY_DATA_HS_CLEAR \ | ||
8 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_SUCCESS_12 \ | ||
9 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_SUCCESS_12_HS_CLEAR \ | ||
10 | ||
#define SPDM_RESPONDER_TEST_CASE_FINISH_RSP_SESSION_REQUIRED \ | ||
11 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_HEARTBEAT_ACK 12 | ||
#define SPDM_RESPONDER_TEST_CASE_HEARTBEAT_ACK_SUCCESS_11_IN_DHE_SESSION 1 | ||
#define SPDM_RESPONDER_TEST_CASE_HEARTBEAT_ACK_VERSION_MISMATCH_IN_DHE_SESSION 2 | ||
#define SPDM_RESPONDER_TEST_CASE_HEARTBEAT_ACK_UNEXPECTED_REQUEST_IN_DHE_SESSION_HS 3 | ||
#define SPDM_RESPONDER_TEST_CASE_HEARTBEAT_ACK_SESSION_REQUIRED 4 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_KEY_UPDATE_ACK 13 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_UPDATE_ACK_SUCCESS_11_IN_DHE_SESSION 1 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_UPDATE_ACK_VERSION_MISMATCH_IN_DHE_SESSION 2 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_UPDATE_ACK_INVALID_REQUEST_IN_DHE_SESSION 3 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_UPDATE_ACK_UNEXPECTED_REQUEST_IN_DHE_SESSION_HS 4 | ||
#define SPDM_RESPONDER_TEST_CASE_KEY_UPDATE_ACK_SESSION_REQUIRED 5 | ||
|
||
#define SPDM_RESPONDER_TEST_GROUP_END_SESSION_ACK 16 | ||
#define SPDM_RESPONDER_TEST_CASE_END_SESSION_ACK_SUCCESS_11_IN_DHE_SESSION 1 | ||
#define SPDM_RESPONDER_TEST_CASE_END_SESSION_ACK_VERSION_MISMATCH_IN_DHE_SESSION 2 | ||
#define SPDM_RESPONDER_TEST_CASE_END_SESSION_ACK_UNEXPECTED_REQUEST_IN_DHE_SESSION_HS 3 | ||
#define SPDM_RESPONDER_TEST_CASE_END_SESSION_ACK_SESSION_REQUIRED 4 | ||
|
||
#endif |
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,13 @@ | ||
cmake_minimum_required(VERSION 2.6) | ||
|
||
INCLUDE_DIRECTORIES(${LIBSPDM_DIR}/include | ||
${LIBSPDM_DIR}/include/hal/${ARCH} | ||
${COMMON_TEST_FRAMEWORK_DIR}/include | ||
${PROJECT_SOURCE_DIR}/include | ||
) | ||
|
||
SET(src_common_test_utility_lib | ||
common_test_utility_lib.c | ||
) | ||
|
||
ADD_LIBRARY(common_test_utility_lib STATIC ${src_common_test_utility_lib}) |
Oops, something went wrong.