Miscellaneous fixes.
[bluesky.git] / bluesky / crypto.c
index 8aeba3a..fff4e0d 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "bluesky.h"
 
+static int DISABLE_CRYPTO = 1;
+
 /* Cryptographic operations.  The rest of the BlueSky code merely calls into
  * the functions in this file, so this is the only point where we interface
  * with an external cryptographic library. */
@@ -28,8 +30,6 @@ void bluesky_crypt_init()
     if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P))
         return;
 
-    g_print("libgcrypt not yet initialized, initializing...\n");
-
     if (!gcry_check_version(GCRYPT_VERSION))
         g_error("libgcrypt version mismatch\n");
 
@@ -46,6 +46,11 @@ void bluesky_crypt_random_bytes(guchar *buf, gint len)
 /* Encrypt a data block. */
 BlueSkyRCStr *bluesky_crypt_encrypt(BlueSkyRCStr *in, const uint8_t *key)
 {
+    if (DISABLE_CRYPTO) {
+        bluesky_string_ref(in);
+        return in;
+    }
+
     gcry_error_t status;
     gcry_cipher_hd_t handle;
 
@@ -86,6 +91,11 @@ BlueSkyRCStr *bluesky_crypt_encrypt(BlueSkyRCStr *in, const uint8_t *key)
 /* Decrypt a data block. */
 BlueSkyRCStr *bluesky_crypt_decrypt(BlueSkyRCStr *in, const uint8_t *key)
 {
+    if (DISABLE_CRYPTO) {
+        bluesky_string_ref(in);
+        return in;
+    }
+
     gcry_error_t status;
     gcry_cipher_hd_t handle;