From d597213735df20ef18381970c46e71dd0679972a Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Fri, 4 Sep 2009 15:34:59 -0700 Subject: [PATCH] Allow crypto to be disabled (for local testing). --- bluesky/crypto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; -- 2.20.1