summaryrefslogtreecommitdiff
path: root/src/common/crypto_pwbox.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-08-28 17:59:06 -0400
committerNick Mathewson <nickm@torproject.org>2014-09-25 11:58:13 -0400
commit8184839a47ed1c7b42993d69d54e757a43bfda9c (patch)
tree4b7db0b9b8fd240e1015568a98963f2096eeb963 /src/common/crypto_pwbox.h
parente84e1c97458a7b0f449b6689caa0b3da2853f471 (diff)
downloadtor-8184839a47ed1c7b42993d69d54e757a43bfda9c.tar.gz
tor-8184839a47ed1c7b42993d69d54e757a43bfda9c.zip
Rudimentary-but-sufficient passphrase-encrypted box code.
See crypto_pwbox.c for a description of the file format. There are tests for successful operation, but it still needs error-case tests.
Diffstat (limited to 'src/common/crypto_pwbox.h')
-rw-r--r--src/common/crypto_pwbox.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/common/crypto_pwbox.h b/src/common/crypto_pwbox.h
new file mode 100644
index 0000000000..aadd477078
--- /dev/null
+++ b/src/common/crypto_pwbox.h
@@ -0,0 +1,20 @@
+#ifndef CRYPTO_PWBOX_H_INCLUDED_
+#define CRYPTO_PWBOX_H_INCLUDED_
+
+#include "torint.h"
+
+#define UNPWBOX_OKAY 0
+#define UNPWBOX_BAD_SECRET -1
+#define UNPWBOX_CORRUPTED -2
+
+int crypto_pwbox(uint8_t **out, size_t *outlen_out,
+ const uint8_t *inp, size_t input_len,
+ const char *secret, size_t secret_len,
+ unsigned s2k_flags);
+
+int crypto_unpwbox(uint8_t **out, size_t *outlen_out,
+ const uint8_t *inp, size_t input_len,
+ const char *secret, size_t secret_len);
+
+#endif
+