Skip to content

Commit

Permalink
Remove cfg 1.0 (#1702)
Browse files Browse the repository at this point in the history
This change removes the configuration for 1.0 hardware.
  • Loading branch information
ArthurHeymans authored Oct 16, 2024
1 parent 393b3b6 commit 5b8dc85
Show file tree
Hide file tree
Showing 64 changed files with 30 additions and 23,192 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-test-verilator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ jobs:
- name: Check that generated register code matches caliptra-rtl submodule
run: |
cargo run --locked -p caliptra_registers_generator -- --check hw/latest/rtl registers/bin/extra-rdl hw/latest/registers/src
cargo run --locked -p caliptra_registers_generator -- --check hw/1.0/rtl registers/bin/extra-rdl hw/1.0/registers/src
- name: Check that generated X.509 templates match default templates
run: |
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/fpga.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,6 @@ jobs:
TEST_BIN=/tmp/caliptra-test-binaries
VARS="CPTRA_UIO_NUM=4 CALIPTRA_PREBUILT_FW_DIR=/tmp/caliptra-test-firmware CALIPTRA_IMAGE_NO_GIT_REVISION=1"
if [[ "${{ inputs.workflow_call }}" && "${{ inputs.hw-version }}" != "latest" ]]; then
VARS+=" FIPS_TEST_HW_EXP_VERSION=1_0_0"
VARS+=" FIPS_TEST_ROM_EXP_VERSION=1_0_1"
fi
if [ "${{ inputs.rom-logging }}" == "true" ] || [ -z "${{ inputs.rom-logging }}" ]; then
VARS+=" CPTRA_ROM_TYPE=ROM_WITH_UART"
elif [ "${{ inputs.rom-logging }}" == false ]; then
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/fw-test-emu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ jobs:
exit 1
fi
if [[ ${{ inputs.extra-features }} == *"hw-1.0"* ]]; then
export FIPS_TEST_HW_EXP_VERSION=1_0_0
export FIPS_TEST_ROM_EXP_VERSION=1_0_1
fi
# Workaround https://github.com/nextest-rs/nextest/issues/267
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
Expand Down
97 changes: 0 additions & 97 deletions .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
while git tag | grep ${TAG_BASE}${INDEX}; do
((INDEX+=1))
done
git submodule update --remote hw/1.0/rtl
git submodule update --remote hw/latest/rtl
CHECK_RELEASE_SYNC=$(git status --porcelain | head -1)
MOST_RECENT_RELEASE=None
Expand All @@ -57,54 +56,6 @@ jobs:
echo "release_ref=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "Current ref $(git rev-parse HEAD) will receive tag ${TAG_BASE}${INDEX} after tests"
fpga-1_0-full-suite-etrng-log:
name: FPGA Suite (1.0, etrng, log)
needs: find-latest-release
if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/fpga.yml
with:
artifact-suffix: -fpga-realtime-hw-1.0-etrng-log
extra-features: slow_tests
hw-version: "1.0"
rom-logging: true
fpga-itrng: false

fpga-1_0-full-suite-etrng-nolog:
name: FPGA Suite (1.0, etrng, nolog)
needs: find-latest-release
if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/fpga.yml
with:
artifact-suffix: -fpga-realtime-hw-1.0-etrng-nolog
extra-features: slow_tests
hw-version: "1.0"
rom-logging: false
fpga-itrng: false

fpga-1_0-full-suite-itrng-log:
name: FPGA Suite (1.0, itrng, log)
needs: find-latest-release
if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/fpga.yml
with:
artifact-suffix: -fpga-realtime-hw-1.0-itrng-log
extra-features: slow_tests,itrng
hw-version: "1.0"
rom-logging: true
fpga-itrng: true

fpga-1_0-full-suite-itrng-nolog:
name: FPGA Suite (1.0, itrng, nolog)
needs: find-latest-release
if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/fpga.yml
with:
artifact-suffix: -fpga-realtime-hw-1.0-itrng-nolog
extra-features: slow_tests,itrng
hw-version: "1.0"
rom-logging: false
fpga-itrng: true

fpga-latest-full-suite-etrng-log:
name: FPGA Suite (hw-latest, etrng, log)
needs: find-latest-release
Expand Down Expand Up @@ -193,54 +144,10 @@ jobs:
extra-features: slow_tests,itrng
rom-logging: false

sw-emulator-hw-1_0-full-suite-etrng-log:
name: sw-emulator Suite (etrng, log)
needs: find-latest-release
if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/fw-test-emu.yml
with:
artifact-suffix: -sw-emulator-hw-1.0-etrng-log
extra-features: hw-1.0,slow_tests
rom-logging: true

sw-emulator-hw-1_0-full-suite-etrng-nolog:
name: sw-emulator Suite (etrng, nolog)
needs: find-latest-release
if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/fw-test-emu.yml
with:
artifact-suffix: -sw-emulator-hw-1.0-etrng-nolog
extra-features: hw-1.0,slow_tests
rom-logging: false

sw-emulator-hw-1_0-full-suite-itrng-log:
name: sw-emulator Suite (itrng, log)
needs: find-latest-release
if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/fw-test-emu.yml
with:
artifact-suffix: -sw-emulator-hw-1.0-itrng-log
extra-features: hw-1.0,slow_tests,itrng
rom-logging: true

sw-emulator-hw-1_0-full-suite-itrng-nolog:
name: sw-emulator Suite (itrng, nolog)
needs: find-latest-release
if: needs.find-latest-release.outputs.create_release
uses: ./.github/workflows/fw-test-emu.yml
with:
artifact-suffix: -sw-emulator-hw-1.0-itrng-nolog
extra-features: hw-1.0,slow_tests,itrng
rom-logging: false

create-release:
name: Create New Release
needs:
- find-latest-release
- fpga-1_0-full-suite-etrng-log
- fpga-1_0-full-suite-etrng-nolog
- fpga-1_0-full-suite-itrng-log
- fpga-1_0-full-suite-itrng-nolog
- fpga-latest-full-suite-etrng-log
- fpga-latest-full-suite-etrng-nolog
- fpga-latest-full-suite-itrng-log
Expand All @@ -249,10 +156,6 @@ jobs:
- sw-emulator-hw-latest-full-suite-etrng-nolog
- sw-emulator-hw-latest-full-suite-itrng-log
- sw-emulator-hw-latest-full-suite-itrng-nolog
- sw-emulator-hw-1_0-full-suite-etrng-log
- sw-emulator-hw-1_0-full-suite-etrng-nolog
- sw-emulator-hw-1_0-full-suite-itrng-log
- sw-emulator-hw-1_0-full-suite-itrng-nolog

runs-on: ubuntu-22.04

Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v3

- name: Pull dpe submodule
run: |
git submodule update --init dpe
# - name: Pull dpe submodule
# run: |
# git submodule update --init dpe

- name: Check that the ROM hash matches the frozen one
run: ./ci.sh check_frozen_images

- uses: actions/upload-artifact@v4
if: always()
with:
name: caliptra-rom.elf
path: target/riscv32imc-unknown-none-elf/firmware/caliptra-rom
# - name: Check that the ROM hash matches the frozen one
# run: ./ci.sh check_frozen_images

# - uses: actions/upload-artifact@v4
# if: always()
# with:
# name: caliptra-rom.elf
# path: target/riscv32imc-unknown-none-elf/firmware/caliptra-rom
6 changes: 2 additions & 4 deletions .github/workflows/rtl-repo-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ jobs:
echo "RTL-REPO-SYNC: release_ref=$(git rev-parse HEAD)"
# Submodules need to be initialized here rather than actions/checkout
# so that git can find the main_1.0 branch when updating the
# hw/1.0/rtl submodule below. Otherwise, it hides the non-main
# branches.
# so that git can find the non main branches. Otherwise, it hides the
# non-main branches.
git submodule update --init
git submodule update --remote hw/latest/rtl
git submodule update --remote hw/1.0/rtl
./registers/update.sh
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
path = hw/latest/rtl
url = https://github.com/chipsalliance/caliptra-rtl
branch = main
[submodule "hw/1.0/rtl"]
path = hw/1.0/rtl
url = https://github.com/chipsalliance/caliptra-rtl
branch = patch_v1.0
[submodule "dpe"]
path = dpe
url = https://github.com/chipsalliance/caliptra-dpe.git
Expand Down
8 changes: 0 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ members = [
"drivers/test-fw",
"drivers/test-fw/scripts/vector_gen",
"fmc",
"hw/1.0/registers",
"hw/latest/registers",
"hw/verilated",
"hw-model",
Expand Down Expand Up @@ -126,7 +125,6 @@ caliptra-image-verify = { path = "image/verify", default-features = false }
caliptra-kat = { path = "kat" }
caliptra-lms-types = { path = "lms-types" }
caliptra-registers = { path = "registers" }
caliptra-registers-1_0 = { path = "hw/1.0/registers" }
caliptra-registers-latest = { path = "hw/latest/registers" }
caliptra-runtime = { path = "runtime", default-features = false }
caliptra-systemrdl = { path = "systemrdl" }
Expand Down
3 changes: 1 addition & 2 deletions builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ zerocopy.workspace = true
[features]
default = ["openssl"]
slow_tests = []
"hw-1.0" = []
openssl = ["caliptra-image-crypto/openssl"]
rustcrypto = ["caliptra-image-crypto/rustcrypto"]

[[bin]]
name = "image"
path = "bin/image_gen.rs"
path = "bin/image_gen.rs"
27 changes: 1 addition & 26 deletions builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,6 @@ pub fn build_firmware_elfs_uncached<'a>(
.arg("target.'cfg(all())'.rustflags = [\"-Dwarnings\"]");
}

if cfg!(feature = "hw-1.0") {
if !features_csv.is_empty() {
features_csv.push(',');
}
features_csv.push_str("hw-1.0");
}

cmd.arg("build")
.arg("--quiet")
.arg("--locked")
Expand Down Expand Up @@ -366,25 +359,7 @@ pub fn build_firmware_elf(id: &FwId<'static>) -> io::Result<Arc<Vec<u8>>> {
/// a particular hardware version. DO NOT USE this for ROM-only tests.
pub fn rom_for_fw_integration_tests() -> io::Result<Cow<'static, [u8]>> {
let rom_from_env = firmware::rom_from_env();
if cfg!(feature = "hw-1.0") {
if rom_from_env == &firmware::ROM {
Ok(
include_bytes!("../../hw/1.0/caliptra-rom-1.0.1-9342687.bin")
.as_slice()
.into(),
)
} else if rom_from_env == &firmware::ROM_WITH_UART {
Ok(
include_bytes!("../../hw/1.0/caliptra-rom-with-log-1.0.1-9342687.bin")
.as_slice()
.into(),
)
} else {
Err(other_err(format!("Unexpected ROM fwid {rom_from_env:?}")))
}
} else {
Ok(build_firmware_rom(rom_from_env)?.into())
}
Ok(build_firmware_rom(rom_from_env)?.into())
}

pub fn build_firmware_rom(id: &FwId<'static>) -> io::Result<Vec<u8>> {
Expand Down
3 changes: 0 additions & 3 deletions cfi/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,3 @@ default = ["cfi", "cfi-counter", "cfi-test"]
cfi = []
cfi-counter = []
cfi-test = []
"hw-1.0" = ["caliptra-registers/hw-1.0"]


1 change: 0 additions & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ std = []
rom = []
fmc = []
runtime = []
"hw-1.0" = ["caliptra-drivers/hw-1.0", "caliptra-registers/hw-1.0"]
1 change: 0 additions & 1 deletion cpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ edition = "2021"
# --profile=firmware \
# --features riscv
riscv = []
"hw-1.0" = ["caliptra-drivers/hw-1.0", "caliptra-registers/hw-1.0"]

[lib]
test = false
Expand Down
1 change: 0 additions & 1 deletion drivers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ fpga_realtime = ["caliptra-hw-model/fpga_realtime"]
itrng = ["caliptra-hw-model/itrng"]
verilator = ["caliptra-hw-model/verilator"]
no-cfi = []
"hw-1.0" = ["caliptra-builder/hw-1.0", "caliptra-registers/hw-1.0"]
fips-test-hooks = []

[dev-dependencies]
Expand Down
13 changes: 3 additions & 10 deletions drivers/src/hmac384.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,9 @@ impl Hmac384 {
let hmac = self.hmac.regs_mut();

let rand_data = trng.generate()?;
cfg_if::cfg_if! {
if #[cfg(feature="hw-1.0")] {
use crate::Array4x5;
let iv: [u32; 5] = rand_data.0[..5].try_into().unwrap();
KvAccess::copy_from_arr(&Array4x5::from(iv), hmac.lfsr_seed())?;
} else {
let iv: [u32; 12] = rand_data.0[..12].try_into().unwrap();
KvAccess::copy_from_arr(&Array4x12::from(iv), hmac.lfsr_seed())?;
}
}
let iv: [u32; 12] = rand_data.0[..12].try_into().unwrap();
KvAccess::copy_from_arr(&Array4x12::from(iv), hmac.lfsr_seed())?;

Ok(())
}

Expand Down
28 changes: 0 additions & 28 deletions drivers/src/lms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ impl Lms {
}

// This operation is accelerated in hardware by RTL1.1 and later.
#[cfg(not(feature = "hw-1.0"))]
fn hash_chain<const N: usize>(
&self,
sha256_driver: &mut impl Sha256Alg,
Expand Down Expand Up @@ -342,33 +341,6 @@ impl Lms {
Ok(*tmp)
}

#[cfg(feature = "hw-1.0")]
fn hash_chain<const N: usize>(
&self,
sha256_driver: &mut impl Sha256Alg,
wnt_prefix: &mut [u8; Self::WNT_PREFIX_SIZE],
coeff: u8,
params: &LmotsParameter,
tmp: &mut HashValue<N>,
) -> CaliptraResult<HashValue<N>> {
let iteration_count = ((1u16 << params.w) - 1) as u8;

for j in coeff..iteration_count {
let mut digest = Array4x8::default();
let mut hasher = sha256_driver.digest_init()?;
wnt_prefix[Self::ITER_COUNTER_OFFSET] = j;
let mut i = Self::TMP_OFFSET;
for val in tmp.0.iter().take(N) {
wnt_prefix[i..i + 4].clone_from_slice(&val.to_be_bytes());
i += 4;
}
hasher.update(&wnt_prefix[0..Self::TMP_OFFSET + N * 4])?;
hasher.finalize(&mut digest)?;
*tmp = HashValue::<N>::from(digest);
}
Ok(*tmp)
}

pub fn candidate_ots_signature<const N: usize, const P: usize>(
&self,
sha256_driver: &mut impl Sha256Alg,
Expand Down
Loading

0 comments on commit 5b8dc85

Please sign in to comment.