seed

Seed for cryptographic random bit generators

The seed CSR provides an interface to a NIST SP 800-90B (Turan et al., 2018) or BSI AIS-31 (Killmann & Schindler, 2011) compliant physical Entropy Source (ES).

The CSR provides up to 16 physical entropy bits that can be used to seed cryptographic random bit generators. The write value is ignored by implementations; the write is used to signal polling and flushing.

Attributes

Requirement

Zkr

Defining extensions

Zkr

Entropy Source

CSR Address

0x15

Length

32-bit

Privilege Mode

U

Format

seed format
Figure 1. seed format

Field Summary

Name Location Type Reset Value

seed.OPST

31:30

RW-H

0

seed.ENTROPY

15:0

RW-H

0

Fields

OPST

Location

31:30

Description

Status bits returned by the entropy source.

Encodings are:

  • 0 - BIST

  • 1 - WAIT

  • 2 - ES16

  • 3 - DEAD

    Type

    RW-H

    Reset value

    0

ENTROPY

Location

15:0

Description

Sixteen bits of randomness.

This field is valid only when OPST is ES16. When OPST is not ES16, ENTROPY must be zero.

Type

RW-H

Reset value

0

Software write

This CSR may store a value that is different from what software attempts to write.

When a software write occurs (e.g., through csrrw), the following determines the written value:

OPST = write_seed();
return CSR[seed].OPST;

ENTROPY = return CSR[seed].ENTROPY;

Software read

This CSR may return a value that is different from what is stored in hardware.

Boolean read_only_access = ($encoding[13] == 1'b1) && ($encoding[19:15] == 5'b00000);
if (read_only_access) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
if (mode() == PrivilegeMode::U && CSR[mseccfg].USEED == 1'b0) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
} else if (mode() == PrivilegeMode::S && CSR[mseccfg].SSEED == 1'b0) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
} else if (mode() == PrivilegeMode::VS || mode() == PrivilegeMode::VU) {
  if (CSR[mseccfg].SSEED == 1'b1) {
    raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
  } else {
    raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
  }
}
return read_seed();