Skip to content

Commit 494031e

Browse files
degjorvaendre-nordic
authored andcommitted
nrf_security: drivers: cracen: Fix Ed25519ph bug for 54H
Hashing operation would fail due to dom2 being stored in memory inaccessible by cracen. Changed const to static to enforce storage in ram until operation is completed. Signed-off-by: Dag Erik Gjørvad <[email protected]>
1 parent 859caae commit 494031e

File tree

1 file changed

+7
-9
lines changed
  • subsys/nrf_security/src/drivers/cracen/sicrypto/src

1 file changed

+7
-9
lines changed

subsys/nrf_security/src/drivers/cracen/sicrypto/src/ed25519ph.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,13 @@
4848
/* This is the ASCII string with the
4949
* PHflag 1 and context size 0 appended as defined in:
5050
* https://datatracker.ietf.org/doc/html/rfc8032.html#section-2
51-
* used for domain seperation between Ed25519 and Ed25519ph
51+
* used for domain seperation between Ed25519 and Ed25519ph.
52+
* Due to hardware limitations dom2 needs to be stored in RAM
53+
* Therefore is not stored as a const.
5254
*/
53-
const char dom2[34] = {
54-
0x53, 0x69, 0x67, 0x45, 0x64, 0x32, 0x35,
55-
0x35, 0x31, 0x39, 0x20, 0x6e, 0x6f, 0x20,
56-
0x45, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39,
57-
0x20, 0x63, 0x6f, 0x6c, 0x6c, 0x69, 0x73,
58-
0x69, 0x6f, 0x6e, 0x73, 0x01, 0x00
59-
};
55+
static char dom2[34] = {0x53, 0x69, 0x67, 0x45, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x20, 0x6e,
56+
0x6f, 0x20, 0x45, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x20, 0x63, 0x6f,
57+
0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x01, 0x00};
6058

6159
static int finish_ed25519ph_ver(struct sitask *t, struct siwq *wq)
6260
{
@@ -103,7 +101,7 @@ static void run_ed25519ph_ver(struct sitask *t)
103101
}
104102

105103
static void si_sig_create_ed25519ph_verify(struct sitask *t, const struct si_sig_pubkey *pubkey,
106-
const struct si_sig_signature *signature)
104+
const struct si_sig_signature *signature)
107105
{
108106
if (t->workmemsz < SX_ED25519_DGST_SZ) {
109107
si_task_mark_final(t, SX_ERR_WORKMEM_BUFFER_TOO_SMALL);

0 commit comments

Comments
 (0)