@@ -32,6 +32,10 @@ static psa_key_id_t kmu_key_ids[3] = {
32
32
MAKE_PSA_KMU_KEY_ID (230 )
33
33
};
34
34
35
+ #if defined(CONFIG_BOOT_KEYS_REVOCATION )
36
+ static psa_key_id_t * validated_with = NULL ;
37
+ #endif
38
+
35
39
BUILD_ASSERT (CONFIG_BOOT_SIGNATURE_KMU_SLOTS <= ARRAY_SIZE (kmu_key_ids ),
36
40
"Invalid number of KMU slots, up to 3 are supported on nRF54L15" );
37
41
#endif
@@ -114,6 +118,10 @@ int ED25519_verify(const uint8_t *message, size_t message_len,
114
118
EDDSA_SIGNAGURE_LENGTH );
115
119
if (status == PSA_SUCCESS ) {
116
120
ret = 1 ;
121
+ #if defined(CONFIG_BOOT_KEYS_REVOCATION )
122
+ BOOT_LOG_ERR ("--------------- valid set to %d" , i );
123
+ validated_with = kmu_key_ids + i ;
124
+ #endif
117
125
break ;
118
126
}
119
127
@@ -122,4 +130,31 @@ int ED25519_verify(const uint8_t *message, size_t message_len,
122
130
123
131
return ret ;
124
132
}
133
+ #if defined(CONFIG_BOOT_KEYS_REVOCATION )
134
+ void revoke_in_kmu (void )
135
+ {
136
+
137
+ psa_status_t status = psa_crypto_init ();
138
+
139
+ if (status != PSA_SUCCESS ) {
140
+ printk ("PSA crypto init failed with error %d\n" , status );
141
+ return ;
142
+ }
143
+ BOOT_LOG_ERR ("--------------- for" );
144
+ for (int i = 0 ; i < CONFIG_BOOT_SIGNATURE_KMU_SLOTS ; i ++ ) {
145
+ if ((kmu_key_ids + i ) == validated_with ){
146
+ break ;
147
+ }
148
+ BOOT_LOG_ERR ("--------------- invalidating %d" , i );
149
+
150
+ status = psa_destroy_key (kmu_key_ids [i ]);
151
+ if (status == PSA_SUCCESS ) {
152
+ printk ("ok\n" );
153
+ } else {
154
+ printk ("destroy failed with: %d\n" , status );
155
+ }
156
+ }
157
+
158
+ }
159
+ #endif
125
160
#endif
0 commit comments