-
Notifications
You must be signed in to change notification settings - Fork 792
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cryptotest] add ECDSA Verify test uJSON API definitions
Signed-off-by: Ryan Torok <[email protected]>
- Loading branch information
1 parent
4a7c5b0
commit ee12f7d
Showing
4 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright lowRISC contributors. | ||
// Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#define UJSON_SERDE_IMPL 1 | ||
#include "ecdsa_commands.h" |
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,63 @@ | ||
// Copyright lowRISC contributors. | ||
// Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef OPENTITAN_SW_DEVICE_TESTS_CRYPTO_CRYPTOTEST_JSON_ECDSA_COMMANDS_H_ | ||
#define OPENTITAN_SW_DEVICE_TESTS_CRYPTO_CRYPTOTEST_JSON_ECDSA_COMMANDS_H_ | ||
#include "sw/device/lib/ujson/ujson_derive.h" | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define ECDSA_CMD_MAX_MESSAGE_BYTES 64 | ||
#define ECDSA_CMD_MAX_SIGNATURE_SCALAR_BYTES 64 | ||
#define ECDSA_CMD_MAX_COORDINATE_BYTES 64 | ||
|
||
// clang-format off | ||
|
||
#define ECDSA_OPERATION(_, value) \ | ||
value(_, Verify) | ||
UJSON_SERDE_ENUM(CryptotestEcdsaOperation, cryptotest_ecdsa_operation_t, ECDSA_OPERATION); | ||
|
||
#define ECDSA_HASH_ALG(_, value) \ | ||
value(_, Sha256) \ | ||
value(_, Sha384) \ | ||
value(_, Sha512) \ | ||
value(_, Sha3_256) \ | ||
value(_, Sha3_384) \ | ||
value(_, Sha3_512) | ||
UJSON_SERDE_ENUM(CryptotestEcdsaHashAlg, cryptotest_ecdsa_hash_alg_t, ECDSA_HASH_ALG); | ||
|
||
#define ECDSA_CURVE(_, value) \ | ||
value(_, P256) \ | ||
value(_, P384) | ||
UJSON_SERDE_ENUM(CryptotestEcdsaCurve, cryptotest_ecdsa_curve_t, ECDSA_CURVE); | ||
|
||
#define ECDSA_MESSAGE(field, string) \ | ||
field(input, uint8_t, ECDSA_CMD_MAX_MESSAGE_BYTES) \ | ||
field(input_len, size_t) | ||
UJSON_SERDE_STRUCT(CryptotestEcdsaMessage, cryptotest_ecdsa_message_t, ECDSA_MESSAGE); | ||
|
||
#define ECDSA_SIGNATURE(field, string) \ | ||
field(r, uint8_t, ECDSA_CMD_MAX_SIGNATURE_SCALAR_BYTES) \ | ||
field(r_len, size_t) \ | ||
field(s, uint8_t, ECDSA_CMD_MAX_SIGNATURE_SCALAR_BYTES) \ | ||
field(s_len, size_t) | ||
UJSON_SERDE_STRUCT(CryptotestEcdsaSignature, cryptotest_ecdsa_signature_t, ECDSA_SIGNATURE); | ||
|
||
#define ECDSA_COORDINATE(field, string) \ | ||
field(coordinate, uint8_t, ECDSA_CMD_MAX_COORDINATE_BYTES) \ | ||
field(coordinate_len, size_t) | ||
UJSON_SERDE_STRUCT(CryptotestEcdsaCoordinate, cryptotest_ecdsa_coordinate_t, ECDSA_COORDINATE); | ||
|
||
#define ECDSA_VERIFY_OUTPUT(_, value) \ | ||
value(_, Success) \ | ||
value(_, Failure) | ||
UJSON_SERDE_ENUM(CryptotestEcdsaVerifyOutput, cryptotest_ecdsa_verify_output_t, ECDSA_VERIFY_OUTPUT); | ||
|
||
// clang-format on | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif // OPENTITAN_SW_DEVICE_TESTS_CRYPTO_CRYPTOTEST_JSON_ECDSA_COMMANDS_H_ |