Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kmac] Rework masked SHA3 core and switch to Trivium-based PRNG implementation #21624

Merged
merged 6 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hw/ip/entropy_src/rtl/entropy_src_core.sv
Original file line number Diff line number Diff line change
Expand Up @@ -2582,6 +2582,7 @@ module entropy_src_core import entropy_src_pkg::*; #(
.rand_early_i (1'b0),
.rand_data_i ('0),
.rand_aux_i ('0),
.rand_update_o (),
.rand_consumed_o (),

// N, S: Used in cSHAKE mode
Expand Down
70 changes: 32 additions & 38 deletions hw/ip/kmac/data/kmac.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -145,29 +145,29 @@
desc: "Width of the hash counter in the entropy"
local: "true"
}
{ name: "NumSeedsEntropyLfsr",
{ name: "NumSeedsEntropy",
type: "int",
default: "5",
desc: "Number of words for the LFSR seed used for entropy generation",
default: "9",
desc: "Number of words for the PRNG seed used for entropy generation",
local: "true"
}
{ name: "RndCnstLfsrSeed"
desc: "Compile-time random data for LFSR default seed"
desc: "Compile-time random data for PRNG default seed"
type: "kmac_pkg::lfsr_seed_t"
randcount: "800"
randcount: "288"
randtype: "data"
}
{ name: "RndCnstLfsrPerm",
desc: "Compile-time random permutation for LFSR output",
desc: "Compile-time random permutation for PRNG output",
type: "kmac_pkg::lfsr_perm_t"
randcount: "800",
randtype: "perm",
}
{ name: "RndCnstLfsrFwdPerm",
desc: "Compile-time random permutation for forwarding LFSR state",
type: "kmac_pkg::lfsr_fwd_perm_t"
randcount: "32",
randtype: "perm",
{ name: "RndCnstBufferLfsrSeed"
desc: "Compile-time random data for PRNG buffer default seed"
type: "kmac_pkg::buffer_lfsr_seed_t"
randcount: "800"
randtype: "data"
}
{ name: "RndCnstMsgPerm"
desc: "Compile-time random permutation for LFSR Message output"
Expand Down Expand Up @@ -802,36 +802,30 @@
}
]
} // R: ENTROPY_REFRESH_THRESHOLD_SHADOWED
{ multireg: {
name: "ENTROPY_SEED"
desc: '''Entropy Seed
{
name: "ENTROPY_SEED"
desc: '''Entropy Seed

Entropy seed registers for the integrated entropy generator.
Entropy seed register for the integrated entropy generator.

If !!CFG_SHADOWED.entropy_mode is set to sw_mode, software first needs to set
!!CFG_SHADOWED.entropy_ready and then write the !!ENTROPY_SEED_0 -
!!ENTROPY_SEED_4 registers in ascending order. Software writes one 32-bit value
to every register which is subsequently loaded into the corresponding 32-bit LFSR
chunk of the entropy generator.
If !!CFG_SHADOWED.entropy_mode is set to sw_mode, software first needs to set !!CFG_SHADOWED.entropy_ready.
Then, software needs to write the !!ENTROPY_SEED register 9 times.
Upon each write, the written value is loaded into the corresponding state chunk of the entropy generator.

After writing all !!ENTROPY_SEED_0 registers, the entropy generator will start
its operation. After this point, writing these registers has no longer any
effect.
'''
count: "NumSeedsEntropyLfsr"
cname: "KMAC"
hwext: "true"
hwqe : "true"
swaccess: "wo"
hwaccess: "hro"
fields: [
{ bits: "31:0"
name: "seed"
desc: "32-bit chunk of the entropy generator seed"
}
]
} // R: ENTROPY_SEED
} // multireg: ENTROPY_SEED
After writing the !!ENTROPY_SEED register 9 times, the entropy generator will start its operation.
After this point, writing this register has no longer any effect.
'''
hwext: "true"
hwqe : "true"
swaccess: "wo"
hwaccess: "hro"
fields: [
{ bits: "31:0"
name: "seed"
desc: "32-bit chunk of the entropy generator seed"
}
]
} // R: ENTROPY_SEED
{ multireg: {
name: "KEY_SHARE0"
desc: '''KMAC Secret Key
Expand Down
Loading
Loading