Software APIs
hmac_sca.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef OPENTITAN_SW_DEVICE_TESTS_PENETRATIONTESTS_FIRMWARE_SCA_HMAC_SCA_H_
6 #define OPENTITAN_SW_DEVICE_TESTS_PENETRATIONTESTS_FIRMWARE_SCA_HMAC_SCA_H_
7 
8 #include "sw/device/lib/base/status.h"
9 #include "sw/device/lib/ujson/ujson.h"
10 
11 /**
12  * Initializes the trigger and configures the device for the HMAC SCA test.
13  *
14  *
15  * @param uj An initialized uJSON context.
16  * @return OK or error.
17  */
18 status_t handle_hmac_pentest_init(ujson_t *uj);
19 
20 /**
21  * hmac.sca.batch_fvsr test
22  *
23  * This SCA penetration test triggers num_iterations HMAC-SHA256 operations
24  * using a Fixed vs Random (FvsR) dataset. This dataset is generated on the
25  * device using the PRNG from the SCA library.
26  *
27  * SCA traces are captured during trigger_high & trigger_low.
28  *
29  * @param uj An initialized uJSON context.
30  * @return OK or error.
31  */
32 status_t handle_hmac_sca_batch_fvsr(ujson_t *uj);
33 
34 /**
35  * hmac.sca.batch_random test
36  *
37  * This SCA penetration test triggers num_iterations HMAC-SHA256 operations
38  * using a random dataset. This dataset is generated on the device using the
39  * PRNG from the SCA library.
40  *
41  * SCA traces are captured during trigger_high & trigger_low.
42  *
43  * @param uj An initialized uJSON context.
44  * @return OK or error.
45  */
46 status_t handle_hmac_sca_batch_random(ujson_t *uj);
47 
48 /**
49  * hmac.sca.single test
50  *
51  * This SCA penetration test triggers a single HMAC-SHA256 operation using the
52  * provided key, mask, and message. The tag is returend to the host.
53  *
54  * SCA traces are captured during trigger_high & trigger_low.
55  *
56  * @param uj An initialized uJSON context.
57  * @return OK or error.
58  */
59 status_t handle_hmac_sca_single(ujson_t *uj);
60 
61 /**
62  * HMAC SCA command handler.
63  *
64  * Command handler for the HMAC SCA command.
65  *
66  * @param uj An initialized uJSON context.
67  * @return OK or error.
68  */
69 status_t handle_hmac_sca(ujson_t *uj);
70 
71 #endif // OPENTITAN_SW_DEVICE_TESTS_PENETRATIONTESTS_FIRMWARE_SCA_HMAC_SCA_H_