2021-10-04 06:50:30 +00:00
[ package ]
name = "pddb"
version = "0.1.0"
authors = [ "bunnie <bunnie@kosagi.com>" ]
edition = "2018"
description = "Plausibly Deniable Database"
2022-06-10 13:36:53 +00:00
# Dependency versions enforced by Cargo.lock.
2021-10-04 06:50:30 +00:00
[ dependencies ]
2024-01-14 16:14:39 +00:00
bitflags = { version = "1" }
2026-01-29 11:12:00 +00:00
xous = "0.9.70"
xous-ipc = "0.10.10"
log-server = { package = "xous-api-log" , version = "0.1.69" }
ticktimer-server = { package = "xous-api-ticktimer" , version = "0.9.70" }
xous-names = { package = "xous-api-names" , version = "0.9.71" }
2026-01-27 16:36:05 +00:00
susres = { path = "../../api/xous-api-susres" , package = "xous-api-susres" , optional = true }
2022-01-10 07:39:55 +00:00
log = "0.4.14"
2024-12-02 10:52:59 +00:00
num-derive = { version = "0.4.2" , default-features = false }
2024-01-14 16:14:39 +00:00
num-traits = { version = "0.2.14" , default-features = false }
2024-09-22 06:19:32 +00:00
rkyv = { version = "0.8.8" , default-features = false , features = [
"std" ,
"alloc" ,
] }
2025-05-04 09:03:00 +00:00
trng = { path = "../trng" , optional = true }
spinor = { path = "../spinor" , optional = true }
2025-09-07 03:50:12 +00:00
aes = { path = "../aes" , default-features = false }
2025-05-04 09:03:00 +00:00
root-keys = { path = "../root-keys" , optional = true }
2025-05-04 10:34:33 +00:00
keystore-api = { path = "../../libs/keystore-api" }
2022-05-29 20:36:33 +00:00
cipher = "0.4.2"
2021-11-06 21:34:07 +00:00
bitfield = "0.13.2"
2024-01-14 16:14:39 +00:00
aes-gcm-siv = { version = "0.11.1" , default-features = false , features = [
"alloc" ,
"aes" ,
] }
2022-08-01 07:44:16 +00:00
# aes-gcm-siv = {git="https://github.com/RustCrypto/AEADs.git", branch="master"}
2025-05-04 09:03:00 +00:00
llio = { path = "../llio" , optional = true }
2025-05-11 04:59:00 +00:00
precursor-hal = { path = "../../libs/precursor-hal" , optional = true }
2024-01-14 16:14:39 +00:00
subtle = { version = "2.4.1" , default-features = false }
2025-05-04 09:03:00 +00:00
tts-frontend = { path = "../tts" , optional = true }
2024-02-07 14:42:38 +00:00
rand_core = "0.6.4"
2021-10-04 06:50:30 +00:00
2021-11-28 12:42:26 +00:00
# passwords
2024-01-31 17:42:18 +00:00
sha2 = { version = "0.10.8" }
2024-02-07 14:42:38 +00:00
digest = "0.10.7"
2024-01-30 20:11:19 +00:00
hkdf = "0.12.4"
2024-02-08 06:02:58 +00:00
zeroize = { version = "1.7.0" , features = [ "zeroize_derive" ] }
zeroize_derive = "1.4.2"
2021-11-28 12:42:26 +00:00
# bcrypt
2022-05-29 20:36:33 +00:00
blowfish = { version = "0.9.1" , features = [ "bcrypt" ] }
2021-11-28 12:42:26 +00:00
2021-12-13 06:24:14 +00:00
# UX (for password entry and notifications)
2025-05-04 09:03:00 +00:00
gam = { path = "../gam" , optional = true }
2025-05-04 17:49:39 +00:00
ux-api = { path = "../../libs/ux-api" }
locales = { path = "../../locales" }
2025-05-04 09:03:00 +00:00
modals = { path = "../modals" , optional = true }
2021-11-28 12:42:26 +00:00
2026-01-29 11:12:00 +00:00
utralib = { version = "0.1.27" , optional = true , default-features = false }
2021-10-04 06:50:30 +00:00
2022-10-23 15:14:57 +00:00
# performance profiling
2024-01-14 16:52:43 +00:00
perflib = { path = "../../libs/perflib" , optional = true }
2022-10-23 15:14:57 +00:00
2025-05-21 02:23:51 +00:00
# Gen-2 dependencies
cleanup pddb for gen2 targets
gate out modals entirely from gen2 pddb
passwords in gen2 are now entirely handled outside of the
respective service crates, cleaning up the APIs
some history - on gen1 (precursor) devices, the thesis was to
reduce the amount of distance a password has to travel from
the point of a user entering it to the point of use. I think this
is academically interesting, but it pulls in a lot of code
into each service to manage the passwords, conflating services
with UI layers.
it was a nice experiment.
in gen2 (and hopefully beyond) targets, we now commit to
the idea that something else is passing in the sensitive key
materials. This means that, in fact, keying material has to
transition between process spaces, which increases the attack
surface to recover this. However, it also makes the crates
more portable and maintainable.
This is mitigated partially by the fact that in gen2 targets
the entirety of the code base runs within a piece of silicon,
so "sniffing" (passive observation of data going to memory)
attacks are a good bit harder.
2025-11-07 19:52:39 +00:00
keystore = { path = "../keystore" , optional = true } # contains all key handlers
xous-swapper = { path = "../xous-swapper" , optional = true } # contains spinor
2025-09-18 13:25:51 +00:00
bao1x-hal-service = { path = "../bao1x-hal-service" , optional = true }
bao1x-emu = { path = "../bao1x-emu" , optional = true , default-features = false }
bao1x-hal = { path = "../../libs/bao1x-hal" , optional = true }
2025-05-21 02:23:51 +00:00
cleanup pddb for gen2 targets
gate out modals entirely from gen2 pddb
passwords in gen2 are now entirely handled outside of the
respective service crates, cleaning up the APIs
some history - on gen1 (precursor) devices, the thesis was to
reduce the amount of distance a password has to travel from
the point of a user entering it to the point of use. I think this
is academically interesting, but it pulls in a lot of code
into each service to manage the passwords, conflating services
with UI layers.
it was a nice experiment.
in gen2 (and hopefully beyond) targets, we now commit to
the idea that something else is passing in the sensitive key
materials. This means that, in fact, keying material has to
transition between process spaces, which increases the attack
surface to recover this. However, it also makes the crates
more portable and maintainable.
This is mitigated partially by the fact that in gen2 targets
the entirety of the code base runs within a piece of silicon,
so "sniffing" (passive observation of data going to memory)
attacks are a good bit harder.
2025-11-07 19:52:39 +00:00
hex = { version = "0.4.3" , default-features = false , features = [
"alloc" ,
] , optional = true }
2021-11-22 08:04:31 +00:00
[ target . 'cfg(any(windows,unix))' . dependencies ]
2023-04-25 14:10:38 +00:00
rand = "0.8.5"
2021-12-25 07:58:27 +00:00
rand_chacha = "0.3.1"
2021-11-22 08:04:31 +00:00
2022-07-31 17:32:19 +00:00
2021-10-04 06:50:30 +00:00
[ features ]
2025-05-04 09:03:00 +00:00
gen1 = [
"susres" ,
"trng" ,
"spinor" ,
"root-keys" ,
2025-05-04 10:34:33 +00:00
"keystore-api/gen1" ,
2025-05-04 09:03:00 +00:00
"llio" ,
"tts-frontend" ,
"gam" ,
"modals" ,
2025-05-11 04:59:00 +00:00
"precursor-hal" ,
2025-05-04 09:03:00 +00:00
]
cleanup pddb for gen2 targets
gate out modals entirely from gen2 pddb
passwords in gen2 are now entirely handled outside of the
respective service crates, cleaning up the APIs
some history - on gen1 (precursor) devices, the thesis was to
reduce the amount of distance a password has to travel from
the point of a user entering it to the point of use. I think this
is academically interesting, but it pulls in a lot of code
into each service to manage the passwords, conflating services
with UI layers.
it was a nice experiment.
in gen2 (and hopefully beyond) targets, we now commit to
the idea that something else is passing in the sensitive key
materials. This means that, in fact, keying material has to
transition between process spaces, which increases the attack
surface to recover this. However, it also makes the crates
more portable and maintainable.
This is mitigated partially by the fact that in gen2 targets
the entirety of the code base runs within a piece of silicon,
so "sniffing" (passive observation of data going to memory)
attacks are a good bit harder.
2025-11-07 19:52:39 +00:00
gen2 = [ "keystore" , "keystore-api/gen2" , "hex" ]
2025-05-04 09:03:00 +00:00
# gen 1 targets
2025-09-07 03:50:12 +00:00
precursor = [ "utralib/precursor" , "sha2/precursor" , "gen1" , "aes/precursor" ]
2025-07-21 09:14:02 +00:00
vexii-test = [ "precursor-hal/vexii-test" , "aes/vexii-test" ]
2025-05-04 09:03:00 +00:00
hosted = [ "utralib/hosted" , "sha2/hosted" , "gen1" ]
2025-09-07 03:50:12 +00:00
renode = [ "utralib/renode" , "sha2/renode" , "gen1" , "aes/renode" ]
2025-05-04 09:03:00 +00:00
# gen 2 targets
2025-05-04 17:49:39 +00:00
board-baosec = [
"gen2" ,
"xous-swapper/board-baosec" ,
2025-09-18 13:25:51 +00:00
"bao1x-hal-service/board-baosec" ,
"bao1x-hal/board-baosec" ,
cleanup pddb for gen2 targets
gate out modals entirely from gen2 pddb
passwords in gen2 are now entirely handled outside of the
respective service crates, cleaning up the APIs
some history - on gen1 (precursor) devices, the thesis was to
reduce the amount of distance a password has to travel from
the point of a user entering it to the point of use. I think this
is academically interesting, but it pulls in a lot of code
into each service to manage the passwords, conflating services
with UI layers.
it was a nice experiment.
in gen2 (and hopefully beyond) targets, we now commit to
the idea that something else is passing in the sensitive key
materials. This means that, in fact, keying material has to
transition between process spaces, which increases the attack
surface to recover this. However, it also makes the crates
more portable and maintainable.
This is mitigated partially by the fact that in gen2 targets
the entirety of the code base runs within a piece of silicon,
so "sniffing" (passive observation of data going to memory)
attacks are a good bit harder.
2025-11-07 19:52:39 +00:00
# modals is needed exclusively to know the type to make a None for
2025-05-04 17:49:39 +00:00
"modals/board-baosec" ,
2025-05-20 06:39:47 +00:00
"keystore/board-baosec" ,
2025-09-18 13:25:51 +00:00
"aes/bao1x" ,
2025-05-04 17:49:39 +00:00
] # USB form factor token
2026-04-05 15:23:11 +00:00
oem-baosec-lite = [ ]
2025-05-04 17:49:39 +00:00
hosted-baosec = [
"gen2" ,
2025-09-18 13:25:51 +00:00
"bao1x-emu" ,
2025-05-04 17:49:39 +00:00
"modals/hosted-baosec" ,
2025-09-18 13:25:51 +00:00
"bao1x-hal/hosted-baosec" ,
2025-05-04 17:49:39 +00:00
] # emulated hardware on x86 platform
board-baosor = [
"gen2" ,
"xous-swapper/board-baosor" ,
2025-09-18 13:25:51 +00:00
"bao1x-hal-service/board-baosor" ,
"bao1x-hal/board-baosor" ,
2025-05-20 06:39:47 +00:00
"keystore/board-baosor" ,
2025-09-18 13:25:51 +00:00
"aes/bao1x" ,
2025-05-04 17:49:39 +00:00
] # Precursor form factor
2025-05-04 09:03:00 +00:00
# board-dabao is not a valid target as it lacks external SPI flash
2026-02-04 07:57:59 +00:00
key-testing = [ "bao1x-hal/key-testing" ]
2025-05-04 09:03:00 +00:00
2025-05-11 06:40:19 +00:00
doc-deps = [ "precursor-hal" ]
2025-05-05 19:15:51 +00:00
2021-11-07 21:41:39 +00:00
# when selected, physical disk addresses are set to 64 bits, otherwise, they are 32 bits.
# 32 bit addressing is recommended for Precursor, as its disk is only 128MiB and it has limited RAM for bookkeeping.
u64_pa = [ ]
2021-11-15 11:05:03 +00:00
# selecting mbbb employs a "make before break" update on the page table. This minimizes risk of corruption of
# the page table when being updated in the case of a power loss, in exchange for more than doubling the time it
# takes to update the page table.
mbbb = [ ]
2021-12-25 17:42:36 +00:00
# selecting deterministic makes the allocation and page replacement algorithms deterministic. normally we don't want
# this but it's helpful for debugging.
deterministic = [ ]
2022-01-01 21:21:05 +00:00
# this flag adds CI tests to the build
ci = [ ]
2022-07-04 09:58:52 +00:00
# hosted mode manual tests
pddbtest = [ ]
# turns on automatic basis tracking. must also be used in conjunction with pddbtest
autobasis = [ ]
2022-03-10 18:37:48 +00:00
# this feature is for text-to-speech support
tts = [ ]
2022-06-30 14:58:36 +00:00
# support migration type 1, from version 00.00.01.01 -> 00.00.02.01, incurs a 42kiB penalty in binary size
v0.0.2.1 initial implementation - still needs migration code
Previous version was v0.0.1.1
New version is v0.0.2.1 (don't ask me why I skipped v0.0.2.0)
The most significant change is that the key derivation for the basis
is now split into two keys. One key is used for the page table ECB
encoding, and a different key is used for the data AES-GCM-SIV encoding.
This is because someone much smarter than me looked at my scheme
and said it is very dangerous to use the same key for two different
types of ciphers. This person is correct, so it had to be rectified.
For the System Basis, the keys are encrypted using the root keys
wrapper API. In this case, we simply create two random keys, one for
the page table, and one for the data region, and wrap them using
the root keys API.
For user secret Basis, the derived keys are sent through HKDF
with two different "info" strings to derive a pair of keys from
a common password.
In case the cryptographer who looked at this is reading along,
note that the basis name is encoded as a fixed-length, 0-padded
record, so, we don't encode the length of the basis in the hash
used to derive the keys. When I explained the scheme I thought
I was using a variable-length basis name to derive the key, but
when I checked the code, it's always 64 bytes long, and bytes
that are not used are 0-padded, so, I think we don't need the
length encoding field.
2022-04-18 07:57:50 +00:00
migration1 = [ ]
# hazardous debug flag decorates any debug paths that might accidentally leak key material
hazardous-debug = [ ]
2022-07-18 19:16:37 +00:00
test-rekey = [ ]
2022-10-07 10:52:57 +00:00
# hardware tests
hwtest = [ ]
2022-07-31 17:32:19 +00:00
# routines to help with performance profiling of the PDDB in hosted mode
pddb-flamegraph = [ "hex" ]
2022-10-23 15:14:57 +00:00
perfcounter = [ "perflib" ]
2022-11-06 10:45:17 +00:00
# introduce a slight delay after UX boxes swap, in case of race conditions. Shouldn't be necessary anymore, but kept around in case there's a new edge case we missed.
ux-swap-delay = [ ]
2022-11-03 13:04:14 +00:00
# make the PDDB very small (4MiB). Note that booting a device with an incompatible `smalldb` setting will break the PDDB image. Use with caution.
smalldb = [ ]
2022-08-01 08:12:38 +00:00
default = [ "mbbb" ]