aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2017-10-17 15:09:56 -0400
committerDavid Bremner <david@tethera.net>2017-10-20 07:58:20 -0300
commita18bbf7f155369f251b0513788eade23be3555d5 (patch)
treeee52bbde803913e42ead01ffcd5d0e6337ddab99 /lib
parent197d67959bf459fc0f1f63a202d162a569535bf3 (diff)
crypto: make shared crypto code behave library-like
If we're going to reuse the crypto code across both the library and the client, then it needs to report error states properly and not write to stderr.
Diffstat (limited to 'lib')
-rw-r--r--lib/database.cc6
-rw-r--r--lib/notmuch.h17
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/database.cc b/lib/database.cc
index 35c66939..02444e09 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -413,6 +413,12 @@ notmuch_status_to_string (notmuch_status_t status)
return "Operation requires a database upgrade";
case NOTMUCH_STATUS_PATH_ERROR:
return "Path supplied is illegal for this function";
+ case NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL:
+ return "Crypto protocol missing, malformed, or unintelligible";
+ case NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION:
+ return "Crypto engine initialization failure";
+ case NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL:
+ return "Unknown crypto protocol";
default:
case NOTMUCH_STATUS_LAST_STATUS:
return "Unknown error status value";
diff --git a/lib/notmuch.h b/lib/notmuch.h
index e8e0cc12..669e01b1 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -192,6 +192,23 @@ typedef enum _notmuch_status {
*/
NOTMUCH_STATUS_ILLEGAL_ARGUMENT,
/**
+ * A MIME object claimed to have cryptographic protection which
+ * notmuch tried to handle, but the protocol was not specified in
+ * an intelligible way.
+ */
+ NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL,
+ /**
+ * Notmuch attempted to do crypto processing, but could not
+ * initialize the engine needed to do so.
+ */
+ NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION,
+ /**
+ * A MIME object claimed to have cryptographic protection, and
+ * notmuch attempted to process it, but the specific protocol was
+ * something that notmuch doesn't know how to handle.
+ */
+ NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL,
+ /**
* Not an actual status value. Just a way to find out how many
* valid status values there are.
*/