STSAFE A120: Reprovisioning is successful, but returns error STSE_INVALID_C_MAC
Los mantenedores suelen responder en 1 día
@Grom- ya está trabajando en esto.
Desde el 14/11/2025.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Hello,
in our setup, we allow host key reprovisioning.
These are our provisioning control fields:
provisioningControlFields.change_right = 0; // The control fields can only be set once!
provisioningControlFields.reprovision = 1; // Allow reprovisioning.
provisioningControlFields.plaintext = 0; // Do not allow plain text.
provisioningControlFields.wrapped_anonymous = 1; // We are using DH derived KEK.
provisioningControlFields.wrapped_or_DH_derived_authentication_key = 0xFF; // Do not use private/public keys when starting a KEK session.
Then, we are using host key slot V2 and provision the host session keys with a 128-Bit AES key:
stse_host_key_provisioning_wrapped(context, STSAFEA_AES_128_HOST_KEY, aes128keys, STSE_ECC_KT_NIST_P_384);
Next we activate the command access condition for all commands to STSE_CMD_AC_HOST and set the host encryption flags to STSE_HOST_ENCRYPT_ALL.
Afterwards everything works as expected, the Host C-MAC and R-MAC are used for all commands and Host C-encryption/R-encryption are active for all commands.
But now comes the problem: When we reprovision the device with a call to
stse_host_key_provisioning_wrapped(context, STSAFEA_AES_256_HOST_KEY, aes256keys, STSE_ECC_KT_NIST_P_384);
the return value is STSE_INVALID_C_MAC, indicating that the provisioning failed.
However, this is not the case: the STSAFE has accepted the new keys and is using them.
I have digged a little deeper and found that the CMAC counter is stored in the session object in the device.
When a new host key is provisioned, stsafea_stop_volatile_KEK_session() is called.
It seems that the STSAFE is resetting the internal CMAC when a new host key is sent, however when stsafea_stop_volatile_KEK_session() is called at the end of the reprovisioning process STSELib is using the CMAC value of the current session and the STSAFE uses the resetted value and thus returns STSE_INVALID_C_MAC (last line in stsafea_frame_receive()).
Could you please advise me whether it is safe to ignore the error STSE_INVALID_C_MAC when reprovisioning the host keys with stse_host_key_provisioning_wrapped()?
Or is this a bug in STSELib that must be fixed?
- Lenguaje dominante
- C
- Estrellas
- 15
- Forks
- 12
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 11
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de STMicroelectronics/STSELib
-
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
STMicroelectronics/STSELib#115 ·
Los mantenedores suelen responder en 1 día
-
Max `pBuffer` size for `stse_data_storage_update_data_zone()` unclear due to hidden overhead bytesAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
STMicroelectronics/STSELib#84 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
# Bug: `stse_perso_info_t` AC status 2-bit mask truncates valid AC valuesQuizá libre de nuevo @Grom- la tomó hace 204 días y no hay ningún pull request abierto. Abiertobug
STMicroelectronics/STSELib#69 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
`stse_platform_Crc16_Accumulate()` is not safeQuizá libre de nuevo @nils-cercariolo-st la tomó hace 192 días y no hay ningún pull request abierto. Abierto
STMicroelectronics/STSELib#65 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de STMicroelectronics/STSELib
Issues similares
-
VIEW_TYPE set for computer playersPosiblemente ocupada @Loobinex la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 2 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
grayscale-lang/grayscale#3133 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ChrisTitusTech/dwm-titus#397 ·
Los mantenedores suelen responder en 1 día