]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dcrypt: Add dcrypt_is_initialized
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 10 Feb 2020 08:14:59 +0000 (10:14 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 20 Feb 2020 11:19:56 +0000 (11:19 +0000)
Allows testing whether it is possible to call dcrypt functions.

src/lib-dcrypt/dcrypt.c
src/lib-dcrypt/dcrypt.h

index a79c889c15a7c94faff244a4fe67f63423469770..9916754eaeb52596570a808188c3c43cbbd73f1c 100644 (file)
@@ -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)
index 0f976ebf9462166dca4fba92eefa75c8fb057e06..0e8a9aa6e81ae0228c913904c21319bc6619a01f 100644 (file)
@@ -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.
  *