aboutsummaryrefslogtreecommitdiff
path: root/crypto.c
AgeCommit message (Collapse)Author
2017-10-20crypto: move into libnotmuch_utilDaniel Kahn Gillmor
This prepares us for using the crypto object in both libnotmuch and the client.
2017-10-12crypto: _notmuch_crypto_cleanup should return voidDaniel Kahn Gillmor
There's no chance that _notmuch_crypto_cleanup() will ever return anything other than 0, and no one ever checks its return value anyway. So make it return void instead of int.
2017-10-12crypto: drop pretense of notmuch_crypto_context_tDaniel Kahn Gillmor
notmuch_crypto_context_t was introduced (i think) as some sort of abstraction layer to make notmuch somewhat independent of GMime. But it isn't even useful for GMime 3.0 or later -- we can drop the pretense that it's some sort of abstraction in this case, and just call it what it is, GMimeCryptoContext, which is useful for building against older versions of GMime. This also renames _notmuch_crypto_get_context() to _notmuch_crypto_get_gmime_context().
2017-10-12crypto: rename notmuch_crypto_t to _notmuch_crypto_tDaniel Kahn Gillmor
The notmuch_crypto_t struct isn't used externally, and we have no plans to explicitly export it. Prefix its name (and associated functions) with _ to make that intent clear.
2017-10-09cli: convert notmuch_bool_t to stdboolJani Nikula
C99 stdbool turned 18 this year. There really is no reason to use our own, except in the library interface for backward compatibility. Convert the cli and test binaries to stdbool.
2017-07-15crypto: Avoid explicit handling of GMimeCryptoContext in gmime 3David Bremner
gmime 3.0 knows how to select the correct GMimeCryptoContext automatically, so a bunch of the code in notmuch can be dropped in that case. The #ifdef removal of the crypto stuff is better than #define aliasing in gmime-extra.h for this stuff. When built against gmime 3.0: * it reduces compiled code, and * it avoids initializing unused gpgme contexts (based on a patch from dkg)
2016-06-05Use https instead of http where possibleDaniel Kahn Gillmor
Many of the external links found in the notmuch source can be resolved using https instead of http. This changeset addresses as many as i could find, without touching the e-mail corpus or expected outputs found in tests.
2016-01-29cli: crypto: S/MIME verification supportJani Nikula
notmuch-show --verify will now also process S/MIME multiparts if encountered. Requires gmime-2.6 and gpgsm. Based on work by Jameson Graef Rollins <jrollins@finestructure.net>.
2015-12-30cli: let the user know which protocol is unknown or unsupportedJani Nikula
The current error message is not helpful.
2015-12-30crypto: make crypto ctx initialization an arrayJani Nikula
Make it trivial to add handlers for new protocols without duplicating code. No functional changes.
2015-12-30crypto: refactor context creation to facilitate further workJani Nikula
Let the context creation functions decide how to handle multiple calls and cache the crypto context. No functional changes.
2015-08-26cli/lib: remove support for GMime 2.4David Bremner
It's becoming a maintenance burden to do anything things with the crypto glue code twice, once for 2.4 and once for 2.6. I don't have any 2.4 version available to test on my development machine anymore, so the 2.4 specific code paths are likely not very well tested.
2015-03-09CLI: set up infrastructure to make path to gpg configurable.David Bremner
GMIME takes a path to gpg, but we hardcode that path. In this commit we set up argument passing and option storage to allow this path to specified in the top level notmuch command.
2013-07-20crypto: return NULL cryptoctx if protocol string is empty.Jameson Graef Rollins
Badly formed messages that don't specify a protocol in signed/encrypted parts, end up with a protocol of NULL. strcasecmp in notmuch_crypto_get_context then segfaults when trying to check it against known protocols. If the protocol is NULL, just return an empty context immediately (with appropriate message.)
2013-04-01cli: crypto: abstract gpg context creation for clarityJani Nikula
The code filled with #ifdef GMIME_ATLEAST_26 is difficult to read. Abstract gpg context creation into a function, with separate implementations for GMime 2.4 and 2.6, to clarify the code. There should be no functional changes.
2013-03-02cli: crypto: tell gmime to use gpg-agentJani Nikula
For decryption, we expect there to be a functioning gpg-agent, and we want gpg to talk to it for any needed credentials. There's a gmime function to declare that: g_mime_gpg_context_set_use_agent() [1], [2]. Start using it. I had gpg-agent running, but gpg "use-agent" configuration option disabled. This resulted in an error message from 'notmuch show': Failed to decrypt part: Canceled. and json had this: "encstatus" : [ { "status" : "bad" } ] One could argue the "use-agent" option should be enabled, but I'd like to use the agent only as a last resort. I think that's irrelevant though. There's a gmime function to declare what we expect, so we should use it. Conveniently it also fixes the problem in a user friendly way. [1] http://git.gnome.org/browse/gmime/commit/?id=ed985397843a9da3745a8b5de3d1d652acd24724 [2] https://bugzilla.gnome.org/show_bug.cgi?id=651826
2012-06-10cli: new crypto structure to store crypto contexts and parameters, and functions to support itJameson Graef Rollins
This new structure, notmuch_crypto_t, keeps all relevant crypto contexts and parameters together, and will make it easier to pass the stuff around and clean it up. The name of the crypto context inside this new struct will change, to reflect that it is actually a GPG context, which is a sub type of Crypto context. There are other types of Crypto contexts (Pkcs7 in particular, which we hope to support) so we want to be clear. The new crypto.c contains functions to return the proper context from the struct for a given protocol (and initialize it if needed), and to cleanup a struct by releasing the crypto contexts.