• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 //   public_key_size: Actual size of the public key.
49 //   signature_size: Actual size of the signature.
50 //   cose_key_type: Key type that is represented as the 'kty' member of the
51 //    COSE_Key object as per RFC 8152.
52 //   cose_key_algorithm: COSE algorithm identifier for the key.
53 //   cose_key_curve: COSE curve identifier for the key.
54 typedef struct DiceKeyParam_ {
55   size_t public_key_size;
56   size_t signature_size;
57   int64_t cose_key_type;
58   int64_t cose_key_algorithm;
59   int64_t cose_key_curve;
60 } DiceKeyParam;
61 
62 #endif  // DICE_TYPES_H_
63