Skip to content

Commit

Permalink
Integrate DRG3 class for generating randomness
Browse files Browse the repository at this point in the history
Modify calls to secure_prng functions.
Change 64 bit seeds to 256 bit.
Update autogenerated files.

Signed-off-by: Vladimir Rozic <[email protected]>
  • Loading branch information
vrozic authored and vogelpi committed Aug 15, 2023
1 parent 628f43d commit 2d61350
Show file tree
Hide file tree
Showing 31 changed files with 361 additions and 351 deletions.
5 changes: 3 additions & 2 deletions hw/ip/lc_ctrl/data/lc_ctrl_state.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
// $ ./util/design/gen-lc-state-enc.py

{
// Seed to be used for generation of partition item default values.
// 256 bit seed to be used for generation of partition item default values.
// Can be overridden on the command line with the --seed switch.
seed: 10167336684108184581
// The default seed was generated using secrets.py module.
seed: 40182201019264397688411770949626922549663256047001778394918990008320537410392

// Secded used in prim_generic_otp.sv
// SECDED matrix used for ECC in OTP
Expand Down
200 changes: 100 additions & 100 deletions hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// DO NOT EDIT THIS FILE DIRECTLY.
// It has been generated with
// $ ./util/design/gen-lc-state-enc.py --seed 10167336684108184581
// $ ./util/design/gen-lc-state-enc.py --seed 40182201019264397688411770949626922549663256047001778394918990008320537410392
//
package lc_ctrl_state_pkg;

Expand Down Expand Up @@ -54,7 +54,7 @@ package lc_ctrl_state_pkg;
// - Minimum Hamming weight: 6
// - Maximum Hamming weight: 16
// - Minimum Hamming distance from any other value: 6
// - Maximum Hamming distance from any other value: 20
// - Maximum Hamming distance from any other value: 18
//
// Hamming distance histogram:
//
Expand All @@ -64,21 +64,21 @@ package lc_ctrl_state_pkg;
// 3: --
// 4: --
// 5: --
// 6: ||| (5.90%)
// 6: ||| (5.41%)
// 7: --
// 8: |||||||||| (16.14%)
// 8: ||||||||||| (17.69%)
// 9: --
// 10: |||||||||||||||||||| (30.15%)
// 10: |||||||||||||||||||| (30.62%)
// 11: --
// 12: |||||||||||||||||| (28.45%)
// 12: |||||||||||||||||| (28.47%)
// 13: --
// 14: |||||||||| (15.10%)
// 14: ||||||||| (13.87%)
// 15: --
// 16: || (3.87%)
// 16: || (3.50%)
// 17: --
// 18: (0.37%)
// 18: (0.44%)
// 19: --
// 20: (0.03%)
// 20: --
// 21: --
// 22: --
//
Expand All @@ -88,140 +88,140 @@ package lc_ctrl_state_pkg;

// SEC_CM: MANUF.STATE.SPARSE
// The A/B values are used for the encoded LC state.
parameter logic [15:0] A0 = 16'b0001011010010010; // ECC: 6'b110011
parameter logic [15:0] B0 = 16'b1001111111110010; // ECC: 6'b111011
parameter logic [15:0] A0 = 16'b0110010010101110; // ECC: 6'b001010
parameter logic [15:0] B0 = 16'b0111010111101110; // ECC: 6'b111110

parameter logic [15:0] A1 = 16'b1011000000101110; // ECC: 6'b011010
parameter logic [15:0] B1 = 16'b1011010000111111; // ECC: 6'b111111
parameter logic [15:0] A1 = 16'b0000011110110100; // ECC: 6'b100101
parameter logic [15:0] B1 = 16'b0000111111111110; // ECC: 6'b111101

parameter logic [15:0] A2 = 16'b1110001000010001; // ECC: 6'b110110
parameter logic [15:0] B2 = 16'b1110001100011111; // ECC: 6'b111111
parameter logic [15:0] A2 = 16'b0011000111010010; // ECC: 6'b000111
parameter logic [15:0] B2 = 16'b0111101111111110; // ECC: 6'b000111

parameter logic [15:0] A3 = 16'b1100100110010000; // ECC: 6'b011000
parameter logic [15:0] B3 = 16'b1111110111010010; // ECC: 6'b111000
parameter logic [15:0] A3 = 16'b0010111001001101; // ECC: 6'b001010
parameter logic [15:0] B3 = 16'b0011111101101111; // ECC: 6'b111010

parameter logic [15:0] A4 = 16'b0000111100100001; // ECC: 6'b010100
parameter logic [15:0] B4 = 16'b1010111110100111; // ECC: 6'b111101
parameter logic [15:0] A4 = 16'b0100000111111000; // ECC: 6'b011010
parameter logic [15:0] B4 = 16'b0101111111111100; // ECC: 6'b011110

parameter logic [15:0] A5 = 16'b1101010010110001; // ECC: 6'b110000
parameter logic [15:0] B5 = 16'b1101011011111111; // ECC: 6'b110001
parameter logic [15:0] A5 = 16'b1010110010000101; // ECC: 6'b110001
parameter logic [15:0] B5 = 16'b1111110110011111; // ECC: 6'b110001

parameter logic [15:0] A6 = 16'b0010101100110000; // ECC: 6'b100010
parameter logic [15:0] B6 = 16'b1010101101110110; // ECC: 6'b111111
parameter logic [15:0] A6 = 16'b1001100110001100; // ECC: 6'b010110
parameter logic [15:0] B6 = 16'b1111100110011111; // ECC: 6'b011110

parameter logic [15:0] A7 = 16'b0011110100110010; // ECC: 6'b010100
parameter logic [15:0] B7 = 16'b1111111110110011; // ECC: 6'b110100
parameter logic [15:0] A7 = 16'b0101001100001111; // ECC: 6'b100010
parameter logic [15:0] B7 = 16'b1101101101101111; // ECC: 6'b100111

parameter logic [15:0] A8 = 16'b1110100010110000; // ECC: 6'b101100
parameter logic [15:0] B8 = 16'b1110111010111010; // ECC: 6'b101111
parameter logic [15:0] A8 = 16'b0111000101100000; // ECC: 6'b111001
parameter logic [15:0] B8 = 16'b0111001101111111; // ECC: 6'b111001

parameter logic [15:0] A9 = 16'b1111010000011101; // ECC: 6'b000100
parameter logic [15:0] B9 = 16'b1111010011111111; // ECC: 6'b101100
parameter logic [15:0] A9 = 16'b0010110001100011; // ECC: 6'b101010
parameter logic [15:0] B9 = 16'b0110110001101111; // ECC: 6'b111111

parameter logic [15:0] A10 = 16'b1001100110100101; // ECC: 6'b011000
parameter logic [15:0] B10 = 16'b1111111110100101; // ECC: 6'b011110
parameter logic [15:0] A10 = 16'b0110110100001000; // ECC: 6'b110011
parameter logic [15:0] B10 = 16'b0110111110011110; // ECC: 6'b111011

parameter logic [15:0] A11 = 16'b1110010010000101; // ECC: 6'b110100
parameter logic [15:0] B11 = 16'b1110010011101111; // ECC: 6'b110111
parameter logic [15:0] A11 = 16'b1001001001001100; // ECC: 6'b000011
parameter logic [15:0] B11 = 16'b1101001111011100; // ECC: 6'b111111

parameter logic [15:0] A12 = 16'b0100100101110111; // ECC: 6'b100000
parameter logic [15:0] B12 = 16'b0100111111111111; // ECC: 6'b101010
parameter logic [15:0] A12 = 16'b0111000001000000; // ECC: 6'b011110
parameter logic [15:0] B12 = 16'b0111011101010010; // ECC: 6'b111110

parameter logic [15:0] A13 = 16'b0010110001110011; // ECC: 6'b000011
parameter logic [15:0] B13 = 16'b1011111001111111; // ECC: 6'b001011
parameter logic [15:0] A13 = 16'b1001001010111110; // ECC: 6'b000010
parameter logic [15:0] B13 = 16'b1111001011111110; // ECC: 6'b101110

parameter logic [15:0] A14 = 16'b1001000101101100; // ECC: 6'b101010
parameter logic [15:0] B14 = 16'b1001110111101101; // ECC: 6'b111011
parameter logic [15:0] A14 = 16'b1001010011010010; // ECC: 6'b100011
parameter logic [15:0] B14 = 16'b1011110111010011; // ECC: 6'b101111

parameter logic [15:0] A15 = 16'b0011000000001101; // ECC: 6'b100011
parameter logic [15:0] B15 = 16'b1111001011011111; // ECC: 6'b100111
parameter logic [15:0] A15 = 16'b0110001010001101; // ECC: 6'b000111
parameter logic [15:0] B15 = 16'b0110111111001101; // ECC: 6'b011111

parameter logic [15:0] A16 = 16'b1010011000010101; // ECC: 6'b001011
parameter logic [15:0] B16 = 16'b1011011110011101; // ECC: 6'b011111
parameter logic [15:0] A16 = 16'b1011001000101000; // ECC: 6'b010111
parameter logic [15:0] B16 = 16'b1011001011111011; // ECC: 6'b011111

parameter logic [15:0] A17 = 16'b0110000100101110; // ECC: 6'b000100
parameter logic [15:0] B17 = 16'b1110010101111110; // ECC: 6'b011100
parameter logic [15:0] A17 = 16'b0001111001110001; // ECC: 6'b001001
parameter logic [15:0] B17 = 16'b1001111111110101; // ECC: 6'b011011

parameter logic [15:0] A18 = 16'b1100001110110000; // ECC: 6'b001101
parameter logic [15:0] B18 = 16'b1101001110110111; // ECC: 6'b011111
parameter logic [15:0] A18 = 16'b0010110110011011; // ECC: 6'b000100
parameter logic [15:0] B18 = 16'b0011111111011111; // ECC: 6'b010101

parameter logic [15:0] A19 = 16'b1100000110000011; // ECC: 6'b000110
parameter logic [15:0] B19 = 16'b1110010111010111; // ECC: 6'b111110
parameter logic [15:0] A19 = 16'b0100110110001100; // ECC: 6'b101010
parameter logic [15:0] B19 = 16'b1101110110111110; // ECC: 6'b101011


// SEC_CM: TRANSITION.CTR.SPARSE
// The C/D values are used for the encoded LC transition counter.
parameter logic [15:0] C0 = 16'b1111000000100100; // ECC: 6'b001100
parameter logic [15:0] D0 = 16'b1111110000111100; // ECC: 6'b111100
parameter logic [15:0] C0 = 16'b0001010010011110; // ECC: 6'b011100
parameter logic [15:0] D0 = 16'b1011011011011111; // ECC: 6'b111100

parameter logic [15:0] C1 = 16'b0010000110000011; // ECC: 6'b110100
parameter logic [15:0] D1 = 16'b0010001111111011; // ECC: 6'b110101
parameter logic [15:0] C1 = 16'b0101101011000100; // ECC: 6'b111000
parameter logic [15:0] D1 = 16'b1111101011110100; // ECC: 6'b111101

parameter logic [15:0] C2 = 16'b1111100011000100; // ECC: 6'b110000
parameter logic [15:0] D2 = 16'b1111100111101110; // ECC: 6'b110101
parameter logic [15:0] C2 = 16'b0001111100100100; // ECC: 6'b100011
parameter logic [15:0] D2 = 16'b0001111110111111; // ECC: 6'b100111

parameter logic [15:0] C3 = 16'b1010110000011000; // ECC: 6'b110110
parameter logic [15:0] D3 = 16'b1010110110011111; // ECC: 6'b110111
parameter logic [15:0] C3 = 16'b1100111010000101; // ECC: 6'b011000
parameter logic [15:0] D3 = 16'b1100111011101111; // ECC: 6'b011011

parameter logic [15:0] C4 = 16'b0101001101001101; // ECC: 6'b001100
parameter logic [15:0] D4 = 16'b0111111101101111; // ECC: 6'b001110
parameter logic [15:0] C4 = 16'b0100001010011111; // ECC: 6'b011000
parameter logic [15:0] D4 = 16'b0101101110111111; // ECC: 6'b111100

parameter logic [15:0] C5 = 16'b0100010011010010; // ECC: 6'b110000
parameter logic [15:0] D5 = 16'b0100010011111011; // ECC: 6'b111110
parameter logic [15:0] C5 = 16'b1001111000100010; // ECC: 6'b111000
parameter logic [15:0] D5 = 16'b1111111110100010; // ECC: 6'b111110

parameter logic [15:0] C6 = 16'b1100010010100100; // ECC: 6'b101110
parameter logic [15:0] D6 = 16'b1100111011100110; // ECC: 6'b111111
parameter logic [15:0] C6 = 16'b0010011110000110; // ECC: 6'b010000
parameter logic [15:0] D6 = 16'b0111011111000110; // ECC: 6'b011101

parameter logic [15:0] C7 = 16'b0001111001100011; // ECC: 6'b000101
parameter logic [15:0] D7 = 16'b0101111001111011; // ECC: 6'b011111
parameter logic [15:0] C7 = 16'b0010111101000110; // ECC: 6'b000110
parameter logic [15:0] D7 = 16'b1010111111000110; // ECC: 6'b111111

parameter logic [15:0] C8 = 16'b0110010110010000; // ECC: 6'b000000
parameter logic [15:0] D8 = 16'b0111011111010100; // ECC: 6'b010001
parameter logic [15:0] C8 = 16'b0000001011011011; // ECC: 6'b000001
parameter logic [15:0] D8 = 16'b1010101111011011; // ECC: 6'b111011

parameter logic [15:0] C9 = 16'b0010001101100100; // ECC: 6'b010111
parameter logic [15:0] D9 = 16'b1110011101100111; // ECC: 6'b011111
parameter logic [15:0] C9 = 16'b0111000011000110; // ECC: 6'b110001
parameter logic [15:0] D9 = 16'b1111111011001110; // ECC: 6'b110011

parameter logic [15:0] C10 = 16'b0100101100000000; // ECC: 6'b000110
parameter logic [15:0] D10 = 16'b1100101101010011; // ECC: 6'b110111
parameter logic [15:0] C10 = 16'b0100001000010010; // ECC: 6'b110110
parameter logic [15:0] D10 = 16'b0111001010110110; // ECC: 6'b110111

parameter logic [15:0] C11 = 16'b1011101010000001; // ECC: 6'b000100
parameter logic [15:0] D11 = 16'b1111111010101011; // ECC: 6'b010111
parameter logic [15:0] C11 = 16'b0100101111110001; // ECC: 6'b000001
parameter logic [15:0] D11 = 16'b0110101111110011; // ECC: 6'b110111

parameter logic [15:0] C12 = 16'b0101101110101010; // ECC: 6'b010000
parameter logic [15:0] D12 = 16'b0101111110111111; // ECC: 6'b010011
parameter logic [15:0] C12 = 16'b1000100101000001; // ECC: 6'b000001
parameter logic [15:0] D12 = 16'b1011110101001111; // ECC: 6'b001011

parameter logic [15:0] C13 = 16'b0010110001101001; // ECC: 6'b001000
parameter logic [15:0] D13 = 16'b0110111011101001; // ECC: 6'b011110
parameter logic [15:0] C13 = 16'b1000000000010001; // ECC: 6'b011111
parameter logic [15:0] D13 = 16'b1001100010110011; // ECC: 6'b111111

parameter logic [15:0] C14 = 16'b1111001000010011; // ECC: 6'b100001
parameter logic [15:0] D14 = 16'b1111001101110111; // ECC: 6'b101011
parameter logic [15:0] C14 = 16'b0101110000000100; // ECC: 6'b111110
parameter logic [15:0] D14 = 16'b1111111010001101; // ECC: 6'b111110

parameter logic [15:0] C15 = 16'b0001110111110010; // ECC: 6'b100000
parameter logic [15:0] D15 = 16'b0101110111110011; // ECC: 6'b110111
parameter logic [15:0] C15 = 16'b1100001000001001; // ECC: 6'b001011
parameter logic [15:0] D15 = 16'b1110011000011011; // ECC: 6'b111011

parameter logic [15:0] C16 = 16'b1001101101100000; // ECC: 6'b110100
parameter logic [15:0] D16 = 16'b1001111101101111; // ECC: 6'b111100
parameter logic [15:0] C16 = 16'b0101001001101100; // ECC: 6'b001000
parameter logic [15:0] D16 = 16'b0111111001111110; // ECC: 6'b001001

parameter logic [15:0] C17 = 16'b0101111001101000; // ECC: 6'b110000
parameter logic [15:0] D17 = 16'b1111111101101000; // ECC: 6'b111011
parameter logic [15:0] C17 = 16'b0100001001110100; // ECC: 6'b010100
parameter logic [15:0] D17 = 16'b1100101001110111; // ECC: 6'b110110

parameter logic [15:0] C18 = 16'b0101110111000100; // ECC: 6'b010100
parameter logic [15:0] D18 = 16'b0101110111011110; // ECC: 6'b011111
parameter logic [15:0] C18 = 16'b1100000001100111; // ECC: 6'b100000
parameter logic [15:0] D18 = 16'b1100011101110111; // ECC: 6'b100101

parameter logic [15:0] C19 = 16'b0000010000000101; // ECC: 6'b101010
parameter logic [15:0] D19 = 16'b0110010001010101; // ECC: 6'b101111
parameter logic [15:0] C19 = 16'b1010000001001010; // ECC: 6'b101111
parameter logic [15:0] D19 = 16'b1111011101101010; // ECC: 6'b101111

parameter logic [15:0] C20 = 16'b0111011000101000; // ECC: 6'b011001
parameter logic [15:0] D20 = 16'b0111011010111110; // ECC: 6'b011111
parameter logic [15:0] C20 = 16'b1001001001010101; // ECC: 6'b001110
parameter logic [15:0] D20 = 16'b1101111011011101; // ECC: 6'b001111

parameter logic [15:0] C21 = 16'b0110001011101000; // ECC: 6'b100011
parameter logic [15:0] D21 = 16'b0110101111111101; // ECC: 6'b110011
parameter logic [15:0] C21 = 16'b1001010000011011; // ECC: 6'b100000
parameter logic [15:0] D21 = 16'b1001111000111011; // ECC: 6'b110101

parameter logic [15:0] C22 = 16'b1000101110001010; // ECC: 6'b101001
parameter logic [15:0] D22 = 16'b1000111111111011; // ECC: 6'b101101
parameter logic [15:0] C22 = 16'b1011101101100001; // ECC: 6'b000100
parameter logic [15:0] D22 = 16'b1011111101111111; // ECC: 6'b000110

parameter logic [15:0] C23 = 16'b1101000000001101; // ECC: 6'b010001
parameter logic [15:0] D23 = 16'b1111101111001101; // ECC: 6'b010111
parameter logic [15:0] C23 = 16'b1101101000000111; // ECC: 6'b001100
parameter logic [15:0] D23 = 16'b1101111011100111; // ECC: 6'b101110


parameter logic [15:0] ZRO = 16'h0;
Expand Down Expand Up @@ -339,13 +339,13 @@ package lc_ctrl_state_pkg;
128'h0
};
parameter lc_token_t RndCnstRawUnlockToken = {
128'h51E6121C8694C6BC41F36E2175199296
128'hEA2B3F32CBE77554E43C8EA7EBF197C2
};
parameter lc_token_t AllZeroTokenHashed = {
128'h3852305BAECF5FF1D5C1D25F6DB9058D
};
parameter lc_token_t RndCnstRawUnlockTokenHashed = {
128'hC1E437642C17A6A2C744CCF32509B8A5
128'hF8FE11B88C36C8140252F036D23804DB
};

endpackage : lc_ctrl_state_pkg
18 changes: 9 additions & 9 deletions hw/ip/otp_ctrl/data/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ int_flag(
string_flag(
name = "lc_seed",
# Default must match value in hw/ip/lc_ctrl/data/lc_ctrl.hjson.
build_setting_default = "10167336684108184581",
build_setting_default = "40182201019264397688411770949626922549663256047001778394918990008320537410392",
)

string_flag(
name = "otp_seed",
# Default must match value in hw/ip/otp_ctrl/data/otp_ctrl_mmap.hjson.
build_setting_default = "10556718629619452145",
build_setting_default = "36021179872380457113239299468132194022238108125576166239904535336103582949069",
)

string_flag(
Expand Down Expand Up @@ -332,7 +332,7 @@ otp_json(
state = "RAW",
),
],
seed = "01931961561863975174",
seed = "52408960416235844780753299194502148156786072650816676092165912261205302331741",
)

[
Expand All @@ -345,7 +345,7 @@ otp_json(
state = "TEST_UNLOCKED{}".format(i),
),
],
seed = "01931961561863975174",
seed = "52408960416235844780753299194502148156786072650816676092165912261205302331741",
)
for i in range(0, 8)
]
Expand All @@ -360,7 +360,7 @@ otp_json(
state = "TEST_LOCKED{}".format(i),
),
],
seed = "01931961561863975174",
seed = "52408960416235844780753299194502148156786072650816676092165912261205302331741",
)
for i in range(0, 7)
]
Expand All @@ -374,7 +374,7 @@ otp_json(
state = "DEV",
),
],
seed = "94259314771464387",
seed = "85452983286950371191603618368782861611109037138182535346147818831008789508651",
)

otp_json(
Expand All @@ -386,7 +386,7 @@ otp_json(
state = "PROD",
),
],
seed = "14555711126514784208",
seed = "113517944176559405110937879233240229311794601727326023435899657066678782830485",
)

otp_json(
Expand All @@ -398,7 +398,7 @@ otp_json(
state = "PROD_END",
),
],
seed = "14555711126514784208",
seed = "113517944176559405110937879233240229311794601727326023435899657066678782830485",
)

otp_json(
Expand All @@ -410,7 +410,7 @@ otp_json(
state = "RMA",
),
],
seed = "01931961561863975174",
seed = "52408960416235844780753299194502148156786072650816676092165912261205302331741",
)

# Create an overlay for the alert_handler digest.
Expand Down
2 changes: 1 addition & 1 deletion hw/ip/otp_ctrl/data/earlgrey_a0_skus/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package(default_visibility = ["//visibility:public"])
# Dummy partition used in `otp_image_header` targets.
otp_json(
name = "otp_json_baseline",
seed = "94259314771464387",
seed = "85452983286950371191603618368782861611109037138182535346147818831008789508651",
)

# OTP SW Configuration for Test SKU.
Expand Down
Loading

0 comments on commit 2d61350

Please sign in to comment.