From: Michael Vrable Date: Fri, 4 Sep 2009 22:34:59 +0000 (-0700) Subject: Allow crypto to be disabled (for local testing). X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=d597213735df20ef18381970c46e71dd0679972a;p=bluesky.git Allow crypto to be disabled (for local testing). --- diff --git a/bluesky/crypto.c b/bluesky/crypto.c index 8aeba3a..df0af66 100644 --- a/bluesky/crypto.c +++ b/bluesky/crypto.c @@ -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. */ @@ -46,6 +48,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 +93,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;