Software APIs
sw
device
tests
penetrationtests
firmware
fi
crypto_fi.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_FI_CRYPTO_FI_H_
6
#define OPENTITAN_SW_DEVICE_TESTS_PENETRATIONTESTS_FIRMWARE_FI_CRYPTO_FI_H_
7
8
#include "sw/device/lib/base/status.h"
9
#include "sw/device/lib/ujson/ujson.h"
10
11
/**
12
* AES FI test.
13
*
14
* This test encrypts a static plaintext with a static key and returns the
15
* ciphertext over UART back to the host. The host can define, whether the
16
* trigger gets set and unset during(i) loading the key, (ii) loading the
17
* plaintext, (iii) encryption, or (iv) when reading back the ciphertext.
18
*
19
* @param uj An initialized uJSON context.
20
* @return OK or error.
21
*/
22
status_t
handle_crypto_fi_aes(
ujson_t
*uj);
23
24
/**
25
* Initializes the trigger and configures the device for the Crypto FI test.
26
*
27
* @param uj An initialized uJSON context.
28
* @return OK or error.
29
*/
30
status_t
handle_crypto_fi_init(
ujson_t
*uj);
31
32
/**
33
* KMAC FI test.
34
*
35
* This test absorbs a static message with a static key and returns the
36
* digest over UART back to the host. The host can define, whether the
37
* trigger gets set and unset during(i) loading the key, (ii) absorbing, or
38
* (iii) squeezing.
39
*
40
* @param uj An initialized uJSON context.
41
* @return OK or error.
42
*/
43
status_t
handle_crypto_fi_kmac(
ujson_t
*uj);
44
45
/**
46
* KMAC State FI test.
47
*
48
* Try to inject a fault into the KMAC state.
49
*
50
* @param uj An initialized uJSON context.
51
* @return OK or error.
52
*/
53
status_t
handle_crypto_fi_kmac_state(
ujson_t
*uj);
54
55
/**
56
* SHA256 FI test.
57
*
58
* Receive message & trigger configuration from host. Perform SHA256 operation
59
* and return the digest back to the host.
60
*
61
* @param uj An initialized uJSON context.
62
* @return OK or error.
63
*/
64
status_t
handle_crypto_fi_sha256(
ujson_t
*uj);
65
66
/**
67
* Shadow Register Access FI test.
68
*
69
* In this test, faults are injected when accessing KMAC shadow registers.
70
*
71
* @param uj An initialized uJSON context.
72
* @return OK or error.
73
*/
74
status_t
handle_crypto_fi_shadow_reg_access(
ujson_t
*uj);
75
76
/**
77
* Shadow Register Read FI test.
78
*
79
* In this test, faults are injected when reading the AES and KMAC shadow
80
* registers.
81
*
82
* @param uj An initialized uJSON context.
83
* @return OK or error.
84
*/
85
status_t
handle_crypto_fi_shadow_reg_read(
ujson_t
*uj);
86
87
/**
88
* Crypto FI command handler.
89
*
90
* Command handler for the Crypto FI command.
91
*
92
* @param uj An initialized uJSON context.
93
* @return OK or error.
94
*/
95
status_t
handle_crypto_fi(
ujson_t
*uj);
96
97
#endif
// OPENTITAN_SW_DEVICE_TESTS_PENETRATIONTESTS_FIRMWARE_FI_CRYPTO_FI_H_
Return to
OpenTitan Documentation