[opentitanlib] Move num_de from otp to util
The num_de module that is used for deserializing certain numeric types
from HJSON files belongs in util. Move it there so it can also be used
in the signer.
Signed-off-by: Jon Flatley <jflat@google.com>
diff --git a/sw/host/opentitanlib/BUILD b/sw/host/opentitanlib/BUILD
index a8f9b08..1bc6469 100644
--- a/sw/host/opentitanlib/BUILD
+++ b/sw/host/opentitanlib/BUILD
@@ -32,7 +32,6 @@
"src/lib.rs",
"src/otp/lc_state.rs",
"src/otp/mod.rs",
- "src/otp/num_de.rs",
"src/otp/otp.rs",
"src/otp/otp_img.rs",
"src/otp/otp_mmap.rs",
@@ -67,6 +66,7 @@
"src/util/file.rs",
"src/util/image.rs",
"src/util/mod.rs",
+ "src/util/num_de.rs",
"src/util/parse_int.rs",
"src/util/present.rs",
"src/util/usb.rs",
diff --git a/sw/host/opentitanlib/src/otp/mod.rs b/sw/host/opentitanlib/src/otp/mod.rs
index 08570d1..54b5aa8 100644
--- a/sw/host/opentitanlib/src/otp/mod.rs
+++ b/sw/host/opentitanlib/src/otp/mod.rs
@@ -8,8 +8,6 @@
pub mod otp_mmap;
pub mod vmem_serialize;
-mod num_de;
-
#[cfg(test)]
mod tests {
use super::*;
diff --git a/sw/host/opentitanlib/src/otp/otp_img.rs b/sw/host/opentitanlib/src/otp/otp_img.rs
index fe05775..40ea6bf 100644
--- a/sw/host/opentitanlib/src/otp/otp_img.rs
+++ b/sw/host/opentitanlib/src/otp/otp_img.rs
@@ -6,7 +6,7 @@
use std::path::Path;
-use crate::otp::num_de::{DecEncoded, DeferredValue};
+use crate::util::num_de::{DecEncoded, DeferredValue};
use anyhow::Result;
use rand::rngs::StdRng;
use rand::SeedableRng;
diff --git a/sw/host/opentitanlib/src/otp/otp_mmap.rs b/sw/host/opentitanlib/src/otp/otp_mmap.rs
index 1b9e68b..adba6fb 100644
--- a/sw/host/opentitanlib/src/otp/otp_mmap.rs
+++ b/sw/host/opentitanlib/src/otp/otp_mmap.rs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
-use crate::otp::num_de::{self, DeferredValue};
+use crate::util::num_de::{self, DeferredValue};
use crate::otp::otp_img::OtpImg;
use crate::otp::vmem_serialize::*;
diff --git a/sw/host/opentitanlib/src/util/mod.rs b/sw/host/opentitanlib/src/util/mod.rs
index e60485b..b4ce99a 100644
--- a/sw/host/opentitanlib/src/util/mod.rs
+++ b/sw/host/opentitanlib/src/util/mod.rs
@@ -6,6 +6,7 @@
pub mod bitfield;
pub mod file;
pub mod image;
+pub mod num_de;
pub mod parse_int;
pub mod present;
pub mod usb;
diff --git a/sw/host/opentitanlib/src/otp/num_de.rs b/sw/host/opentitanlib/src/util/num_de.rs
similarity index 100%
rename from sw/host/opentitanlib/src/otp/num_de.rs
rename to sw/host/opentitanlib/src/util/num_de.rs