From: Aki Tuomi Date: Mon, 10 Feb 2020 08:14:59 +0000 (+0200) Subject: lib-dcrypt: Add dcrypt_is_initialized X-Git-Tag: 2.3.11.2~594 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=872101814cbb2fa0164852988dbc6a87c2d48311;p=thirdparty%2Fdovecot%2Fcore.git lib-dcrypt: Add dcrypt_is_initialized Allows testing whether it is possible to call dcrypt functions. --- diff --git a/src/lib-dcrypt/dcrypt.c b/src/lib-dcrypt/dcrypt.c index a79c889c15..9916754eae 100644 --- a/src/lib-dcrypt/dcrypt.c +++ b/src/lib-dcrypt/dcrypt.c @@ -63,6 +63,11 @@ void dcrypt_set_vfs(struct dcrypt_vfs *vfs) dcrypt_vfs = vfs; } +bool dcrypt_is_initialized(void) +{ + return dcrypt_vfs != NULL; +} + bool dcrypt_ctx_sym_create(const char *algorithm, enum dcrypt_sym_mode mode, struct dcrypt_context_symmetric **ctx_r, const char **error_r) diff --git a/src/lib-dcrypt/dcrypt.h b/src/lib-dcrypt/dcrypt.h index 0f976ebf94..0e8a9aa6e8 100644 --- a/src/lib-dcrypt/dcrypt.h +++ b/src/lib-dcrypt/dcrypt.h @@ -95,6 +95,11 @@ ARRAY_DEFINE_TYPE(dcrypt_raw_key, struct dcrypt_raw_key); bool dcrypt_initialize(const char *backend, const struct dcrypt_settings *set, const char **error_r); +/** + * Returns TRUE if dcrypt has been initialized. + */ +bool dcrypt_is_initialized(void); + /** * deinitialize dcrypt. *