aboutsummaryrefslogtreecommitdiff
path: root/src/trunnel/pwbox.trunnel
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-24 10:51:39 -0400
committerNick Mathewson <nickm@torproject.org>2014-09-25 11:58:14 -0400
commit3b7d0ed08e13d5b806b86818acec00c9352cf1c5 (patch)
treea4ca9a417606f09db1c6b4d62ebefe2331cd5875 /src/trunnel/pwbox.trunnel
parent301114940143b0d950b3a8dd69e2d6ee0bc6244d (diff)
downloadtor-3b7d0ed08e13d5b806b86818acec00c9352cf1c5.tar.gz
tor-3b7d0ed08e13d5b806b86818acec00c9352cf1c5.zip
Use trunnel for crypto_pwbox encoding/decoding.
This reduces the likelihood that I have made any exploitable errors in the encoding/decoding. This commit also imports the trunnel runtime source into Tor.
Diffstat (limited to 'src/trunnel/pwbox.trunnel')
-rw-r--r--src/trunnel/pwbox.trunnel14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/trunnel/pwbox.trunnel b/src/trunnel/pwbox.trunnel
new file mode 100644
index 0000000000..10db74b4e5
--- /dev/null
+++ b/src/trunnel/pwbox.trunnel
@@ -0,0 +1,14 @@
+
+const PWBOX0_CONST0 = 0x544f5242; // TORB
+const PWBOX0_CONST1 = 0x4f583030; // OX00
+
+struct pwbox_encoded {
+ u32 fixedbytes0 IN [PWBOX0_CONST0];
+ u32 fixedbytes1 IN [PWBOX0_CONST1];
+ u8 header_len;
+ u8 skey_header[header_len];
+ u8 iv[16];
+ u8 data[..-32];
+ u8 hmac[32];
+};
+