Software APIs
defs.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_LIB_CRYPTO_INCLUDE_FREESTANDING_DEFS_H_
6 #define OPENTITAN_SW_DEVICE_LIB_CRYPTO_INCLUDE_FREESTANDING_DEFS_H_
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif // __cplusplus
11 
12 /**
13  * OpenTitan's status_t is a single 32-bit word conveying either a result code
14  * or an error code.
15  * - The otcrypto has only one result code: The `Ok` value which is
16  * equivalent in value to kHardenedBoolTrue.
17  * - The otcrypto error codes all have the MSB set and encode an error type of
18  * absl_status_t in the lower 5 bits.
19  *
20  * This definition is supplied to provide the status_t definition when
21  * otcrypto is exported out of the OpenTitan repository.
22  */
23 typedef struct status {
24  int32_t value;
25 } status_t;
26 
27 /**
28  * Attribute for functions which return errors that must be acknowledged.
29  */
30 #define OT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
31 
32 #ifdef __cplusplus
33 } // extern "C"
34 #endif // __cplusplus
35 #endif // OPENTITAN_SW_DEVICE_LIB_CRYPTO_INCLUDE_FREESTANDING_DEFS_H_