[refactoring] Regroup DICE types in types.h
This refactoring is a preparation for supporting multi-algorithm
in DICE. More types will be added in types.h later with the
multi-alg work.
Bug: 357008987
Change-Id: I35625828879578ebfde6c4ac3c3a8329c63c25b0
Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/243212
Pigweed-Auto-Submit: Alice Wang <aliceywang@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Reviewed-by: Darren Krahn <dkrahn@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/include/dice/dice.h b/include/dice/dice.h
index cf54942..b95f6ca 100644
--- a/include/dice/dice.h
+++ b/include/dice/dice.h
@@ -18,6 +18,8 @@
#include <stddef.h>
#include <stdint.h>
+#include "dice/types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -29,25 +31,6 @@
#define DICE_PRIVATE_KEY_SEED_SIZE 32
#define DICE_ID_SIZE 20
-typedef enum {
- kDiceResultOk,
- kDiceResultInvalidInput,
- kDiceResultBufferTooSmall,
- kDiceResultPlatformError,
-} DiceResult;
-
-typedef enum {
- kDiceModeNotInitialized,
- kDiceModeNormal,
- kDiceModeDebug,
- kDiceModeMaintenance,
-} DiceMode;
-
-typedef enum {
- kDiceConfigTypeInline,
- kDiceConfigTypeDescriptor,
-} DiceConfigType;
-
// Contains a full set of input values describing the target program or system.
// See the Open Profile for DICE specification for a detailed explanation of
// these inputs.
diff --git a/include/dice/types.h b/include/dice/types.h
new file mode 100644
index 0000000..99050c8
--- /dev/null
+++ b/include/dice/types.h
@@ -0,0 +1,37 @@
+// Copyright 2024 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+#ifndef DICE_TYPES_H_
+#define DICE_TYPES_H_
+
+typedef enum {
+ kDiceResultOk,
+ kDiceResultInvalidInput,
+ kDiceResultBufferTooSmall,
+ kDiceResultPlatformError,
+} DiceResult;
+
+typedef enum {
+ kDiceModeNotInitialized,
+ kDiceModeNormal,
+ kDiceModeDebug,
+ kDiceModeMaintenance,
+} DiceMode;
+
+typedef enum {
+ kDiceConfigTypeInline,
+ kDiceConfigTypeDescriptor,
+} DiceConfigType;
+
+#endif // DICE_TYPES_H_