1 // Copyright 2024 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 15 #ifndef DICE_TYPES_H_ 16 #define DICE_TYPES_H_ 17 18 #include <stddef.h> 19 #include <stdint.h> 20 21 typedef enum { 22 kDiceResultOk, 23 kDiceResultInvalidInput, 24 kDiceResultBufferTooSmall, 25 kDiceResultPlatformError, 26 } DiceResult; 27 28 typedef enum { 29 kDicePrincipalAuthority, 30 kDicePrincipalSubject, 31 } DicePrincipal; 32 33 typedef enum { 34 kDiceModeNotInitialized, 35 kDiceModeNormal, 36 kDiceModeDebug, 37 kDiceModeMaintenance, 38 } DiceMode; 39 40 typedef enum { 41 kDiceConfigTypeInline, 42 kDiceConfigTypeDescriptor, 43 } DiceConfigType; 44 45 // Parameters related to the DICE key operations. 46 // 47 // Fields: 48 // profile_name: Name of the profile. NULL if not specified. The pointer 49 // should point to a valid static string or NULL. 50 // public_key_size: Actual size of the public key. 51 // signature_size: Actual size of the signature. 52 // cose_key_type: Key type that is represented as the 'kty' member of the 53 // COSE_Key object as per RFC 8152. 54 // cose_key_algorithm: COSE algorithm identifier for the key. 55 // cose_key_curve: COSE curve identifier for the key. 56 typedef struct DiceKeyParam_ { 57 const char* profile_name; 58 size_t public_key_size; 59 size_t signature_size; 60 int64_t cose_key_type; 61 int64_t cose_key_algorithm; 62 int64_t cose_key_curve; 63 } DiceKeyParam; 64 65 #endif // DICE_TYPES_H_ 66