What changed, and why it matters
This commit simply moves two constant definitions from a C source file to a header file so they can be used by Rust code later. There is no functional code change, no bug fix, and no security relevance visible in the diff.
No security action required. Treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit relocates MONOTONIC_COUNTER_MAX_USE and ARBITRARY_DATA_OBJECT_TYPE_3_MAX_SIZE from src/optiga/optiga.c to src/optiga/optiga.h. The values and comments remain identical. No logic, bounds checking, or behavior changes. It is a pure refactoring to expose symbols to other translation units (including future Rust FFI usage).
Changed components
src/optiga/optiga.csrc/optiga/optiga.hInspect captured patch +7 / −8
diff --git a/src/optiga/optiga.c b/src/optiga/optiga.c
index 8f7f3a4..bb79a2b 100644
--- a/src/optiga/optiga.c
+++ b/src/optiga/optiga.c
@@ -30,14 +30,6 @@
#define VERIFY_METADATA 0
#endif
-// Number of times the first kdf slot can be used over the lifetime of the device.
-// The maxmimum does not seem to be specified, so we use something a little below the endurance
-// indication of 600000 updates. See Solution Reference Manual Figure 32.
-#define MONOTONIC_COUNTER_MAX_USE (590000)
-
-// See Solution Reference Manual Table 79 "Data structure arbitrary data object".
-#define ARBITRARY_DATA_OBJECT_TYPE_3_MAX_SIZE 140
-
// This number of KDF iterations on the external kdf slot when stretching the device
// password using the V0 algorithm.
#define KDF_NUM_ITERATIONS_V0 (2)
diff --git a/src/optiga/optiga.h b/src/optiga/optiga.h
index 1dca574..425a4ce 100644
--- a/src/optiga/optiga.h
+++ b/src/optiga/optiga.h
@@ -42,6 +42,10 @@
// increments the counter. When the threshold `MONOTONIC_COUNTER_MAX_USE` is reached, further CMAC
// computations return an error.
#define OID_COUNTER 0xE120
+// Number of times the first KDF slot can be used over the lifetime of the device. The maximum
+// does not seem to be specified, so we use something a little below the endurance indication of
+// 600000 updates. See Solution Reference Manual Figure 32.
+#define MONOTONIC_COUNTER_MAX_USE (590000)
// The three objects below (`OID_PASSWORD_SECRET`, `OID_PASSWORD`, `OID_COUNTER_PASSWORD`) deal with
// implementing the small monotonic counter that limits the number of unlocks to a small number.
@@ -73,6 +77,9 @@
#define FINAL_LCSO_STATE_V0 LCSO_STATE_OPERATIONAL
#define FINAL_LCSO_STATE_V1 LCSO_STATE_OPERATIONAL
+// See Solution Reference Manual Table 79 "Data structure arbitrary data object".
+#define ARBITRARY_DATA_OBJECT_TYPE_3_MAX_SIZE 140
+
// Maximum size of metadata. See "Metadata Update Identifier":
// https://github.com/Infineon/optiga-trust-m-overview/blob/98b2b9c178f0391b1ab26b52082899704dab688a/docs/OPTIGA%E2%84%A2%20Trust%20M%20Solution%20Reference%20Manual.md#linka946a953_def2_41cf_850a_74fb7899fe11
// Two extra bytes for the `0x20 <len>` header bytes.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.