5 #ifndef OPENTITAN_SW_DEVICE_LIB_CRYPTO_INCLUDE_DATATYPES_H_
6 #define OPENTITAN_SW_DEVICE_LIB_CRYPTO_INCLUDE_DATATYPES_H_
11 #ifdef OTCRYPTO_IN_REPO
13 #include "sw/device/lib/base/status.h"
15 #include "freestanding/absl_status.h"
16 #include "freestanding/defs.h"
71 kOtcryptoStatusValueOk = (int32_t)0x739,
73 kOtcryptoStatusValueBadArgs = (int32_t)0x8000fea0 | kInvalidArgument,
75 kOtcryptoStatusValueInternalError = (int32_t)0x80005340 | kAborted,
77 kOtcryptoStatusValueFatalError = (int32_t)0x80006d80 | kFailedPrecondition,
79 kOtcryptoStatusValueAsyncIncomplete = (int32_t)0x8000ea40 | kUnavailable,
82 kOtcryptoStatusValueNotImplemented = (int32_t)0x80008d20 | kUnimplemented,
109 const uint8_t *
const data;
138 const uint32_t *
const data;
150 kOtcryptoKeyTypeAes = 0x8e9,
152 kOtcryptoKeyTypeHmac = 0xe3f,
154 kOtcryptoKeyTypeKmac = 0xb74,
156 kOtcryptoKeyTypeRsa = 0x7ee,
158 kOtcryptoKeyTypeEcc = 0x15b,
160 kOtcryptoKeyTypeKdf = 0xb87,
173 kOtcryptoAesKeyModeEcb = 0x1b6,
175 kOtcryptoAesKeyModeCbc = 0xf3a,
177 kOtcryptoAesKeyModeCfb = 0x0f9,
179 kOtcryptoAesKeyModeOfb = 0xb49,
181 kOtcryptoAesKeyModeCtr = 0x4ce,
183 kOtcryptoAesKeyModeGcm = 0xaa5,
185 kOtcryptoAesKeyModeKwp = 0x7d5,
198 kOtcryptoHmacKeyModeSha256 = 0x7fd,
200 kOtcryptoHmacKeyModeSha384 = 0x43b,
202 kOtcryptoHmacKeyModeSha512 = 0x7a2,
215 kOtcryptoKmacKeyModeKmac128 = 0xa56,
217 kOtcryptoKmacKeyModeKmac256 = 0x663,
230 kOtcryptoRsaKeyModeSignPkcs = 0x3d4,
232 kOtcryptoRsaKeyModeSignPss = 0x761,
234 kOtcryptoRsaKeyModeEncryptOaep = 0x585,
247 kOtcryptoEccKeyModeEcdsa = 0x4e5,
249 kOtcryptoEccKeyModeEcdh = 0x6bb,
251 kOtcryptoEccKeyModeEd25519 = 0xd32,
253 kOtcryptoEccKeyModeX25519 = 0x276,
266 kOtcryptoKdfKeyModeCtrHmac = 0x12f,
268 kOtcryptoKdfKeyModeKmac128 = 0xe5e,
270 kOtcryptoKdfKeyModeKmac256 = 0x353,
284 kOtcryptoKeyModeAesEcb = kOtcryptoKeyTypeAes << 16 | kOtcryptoAesKeyModeEcb,
286 kOtcryptoKeyModeAesCbc = kOtcryptoKeyTypeAes << 16 | kOtcryptoAesKeyModeCbc,
288 kOtcryptoKeyModeAesCfb = kOtcryptoKeyTypeAes << 16 | kOtcryptoAesKeyModeCfb,
290 kOtcryptoKeyModeAesOfb = kOtcryptoKeyTypeAes << 16 | kOtcryptoAesKeyModeOfb,
292 kOtcryptoKeyModeAesCtr = kOtcryptoKeyTypeAes << 16 | kOtcryptoAesKeyModeCtr,
294 kOtcryptoKeyModeAesGcm = kOtcryptoKeyTypeAes << 16 | kOtcryptoAesKeyModeGcm,
296 kOtcryptoKeyModeAesKwp = kOtcryptoKeyTypeAes << 16 | kOtcryptoAesKeyModeKwp,
298 kOtcryptoKeyModeHmacSha256 =
299 kOtcryptoKeyTypeHmac << 16 | kOtcryptoHmacKeyModeSha256,
301 kOtcryptoKeyModeHmacSha384 =
302 kOtcryptoKeyTypeHmac << 16 | kOtcryptoHmacKeyModeSha384,
304 kOtcryptoKeyModeHmacSha512 =
305 kOtcryptoKeyTypeHmac << 16 | kOtcryptoHmacKeyModeSha512,
307 kOtcryptoKeyModeKmac128 =
308 kOtcryptoKeyTypeKmac << 16 | kOtcryptoKmacKeyModeKmac128,
310 kOtcryptoKeyModeKmac256 =
311 kOtcryptoKeyTypeKmac << 16 | kOtcryptoKmacKeyModeKmac256,
313 kOtcryptoKeyModeRsaSignPkcs =
314 kOtcryptoKeyTypeRsa << 16 | kOtcryptoRsaKeyModeSignPkcs,
316 kOtcryptoKeyModeRsaSignPss =
317 kOtcryptoKeyTypeRsa << 16 | kOtcryptoRsaKeyModeSignPss,
319 kOtcryptoKeyModeRsaEncryptOaep =
320 kOtcryptoKeyTypeRsa << 16 | kOtcryptoRsaKeyModeEncryptOaep,
322 kOtcryptoKeyModeEcdsa = kOtcryptoKeyTypeEcc << 16 | kOtcryptoEccKeyModeEcdsa,
324 kOtcryptoKeyModeEcdh = kOtcryptoKeyTypeEcc << 16 | kOtcryptoEccKeyModeEcdh,
326 kOtcryptoKeyModeEd25519 =
327 kOtcryptoKeyTypeEcc << 16 | kOtcryptoEccKeyModeEd25519,
329 kOtcryptoKeyModeX25519 =
330 kOtcryptoKeyTypeEcc << 16 | kOtcryptoEccKeyModeX25519,
332 kOtcryptoKeyModeKdfCtrHmac =
333 kOtcryptoKeyTypeKdf << 16 | kOtcryptoKdfKeyModeCtrHmac,
335 kOtcryptoKeyModeKdfKmac128 =
336 kOtcryptoKeyTypeKdf << 16 | kOtcryptoKdfKeyModeKmac128,
338 kOtcryptoKeyModeKdfKmac256 =
339 kOtcryptoKeyTypeKdf << 16 | kOtcryptoKdfKeyModeKmac256,
356 kOtcryptoKeySecurityLevelLow = 0x1e9,
358 kOtcryptoKeySecurityLevelMedium = 0xeab,
360 kOtcryptoKeySecurityLevelHigh = 0xa7e,
375 kOtcryptoLibVersion1 = 0x7f4,
419 const size_t keyblob_length;
433 kOtcryptoHashModeSha256 = 0x69b,
435 kOtcryptoHashModeSha384 = 0x7ae,
437 kOtcryptoHashModeSha512 = 0x171,
439 kOtcryptoHashModeSha3_224 = 0x516,
441 kOtcryptoHashModeSha3_256 = 0x2d4,
443 kOtcryptoHashModeSha3_384 = 0x267,
445 kOtcryptoHashModeSha3_512 = 0x44d,
447 kOtcryptoHashXofModeShake128 = 0x5d8,
449 kOtcryptoHashXofModeShake256 = 0x34a,
451 kOtcryptoHashXofModeCshake128 = 0x0bd,
453 kOtcryptoHashXofModeCshake256 = 0x4e2,
470 #endif // __cplusplus
472 #endif // OPENTITAN_SW_DEVICE_LIB_CRYPTO_INCLUDE_DATATYPES_H_