Package: kmac_pkg
- File: kmac_pkg.sv
Description
Copyright lowRISC contributors.
Licensed under the Apache License, Version 2.0, see LICENSE for details.
SPDX-License-Identifier: Apache-2.0
kmac_pkg
Constants
Name | Type | Value | Description |
---|---|---|---|
MsgWidth | int | sha3_pkg::MsgWidth | |
MsgStrbW | int | sha3_pkg::MsgStrbW | |
RegIntfWidth | int | 32 | 32bit interface |
RegLatency | int | 5 | 5 cycle to write one Word |
Sha3Latency | int | 72 | Expected masked sha3 processing time 24x3 |
BufferCycles | int | RegLatency | Total required buffer size while SHA3 is in processing |
BufferSizeBits | int | RegIntfWidth * BufferCycles | |
MsgFifoDepth | int | 2 | Required MsgFifoDepth. Adding slightly more buffer for margin |
MsgFifoDepthW | int | $clog2(MsgFifoDepth+1) | |
MsgWindowWidth | int | 32 | Register width |
MsgWindowDepth | int | 512 | 2kB space |
MaxKeyLen | int | 512 | Key related definitions If this value is changed, please modify the logic inside kmac_core that assigns the value into encoded_key |
MaxEncodedKeyLenW | int | $clog2(MaxKeyLen+1) | size of encode_string(Key) $ceil($clog2(MaxKeyLen+1)/8) |
MaxEncodedKeyLenByte | int | 8 | |
MaxEncodedKeyLenSize | int | MaxEncodedKeyLenByte * 8 | |
MaxEncodedKeyW | int | MaxKeyLen + MaxEncodedKeyLenSize + 8 | Secret Key left_encode(len(Key)) ---------- ------------------------ |
TimerPrescalerW | int unsigned | 10 | Timer |
EdnWaitTimerW | int unsigned | 16 | |
EntropyLfsrW | int unsigned | 64 | entropy lfsr related |
lfsr_perm_t | lfsr_perm_t | ||
NumAppIntf | int unsigned | 3 | ///////////////////////// Application interface // ///////////////////////// Number of the application interface Currently KMAC has three interface. 0: KeyMgr 1: LC_CTRL 2: ROM_CTRL Make sure to change width of app inter-module signal definition if this value is changed. |
EncodedStringEmpty | logic [15:0] | 0001 | Predefined encoded_string |
EncodedStringKMAC | logic [47:0] | _4D4B_2001 | |
NSPrefixW | int unsigned | sha3_pkg::NSRegisterSize*8 |
Types
Name | Type | Description |
---|---|---|
key_len_e | enum logic [2:0] { Key128 = 3'b 000, Key192 = 3'b 001, Key256 = 3'b 010, Key384 = 3'b 011, Key512 = 3'b 100 } |
key_len is SW configurable CSR. Current KMAC allows 5 key length options. This value determines the KMAC core how to map the value from Secret Key register to key size block |
kmac_cmd_e | enum logic [3:0] { CmdNone = 4'b 0000, CmdStart = 4'b 0001, CmdProcess = 4'b 0010, CmdManualRun = 4'b 0100, CmdDone = 4'b 1000 } |
kmac_cmd_e defines the possible command sets that software issues via !!CMD register. This is mainly to limit the error scenario that SW writes multiple commands at once. |
entropy_mode_e | enum logic [1:0] { EntropyModeNone = 2'h 0, EntropyModeEdn = 2'h 1, EntropyModeSw = 2'h 2 } |
Entropy Mode Selection : Should be matched to register package Enum value |
lfsr_perm_t | logic [EntropyLfsrW-1:0][$clog2(EntropyLfsrW)-1:0] | |
app_mode_e | enum bit [1:0] { AppSHA3 = 0, AppCShake = 1, AppKMAC = 2 } |
Application Algorithm Each interface can choose algorithms among SHA3, cSHAKE, KMAC |
app_config_t | struct packed { app_mode_e Mode; sha3_pkg::keccak_strength_e Strength; bit PrefixMode; logic [NSPrefixW-1:0] Prefix; } |