X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fcrypto.c;h=df0af666b0eef3c5a25d872fd0fee81b5a8df59c;hb=0a6dbd76f58caad61a494a64e9bd421de61f6aa6;hp=defe1b334d12c9b8832c7248295fb70e0a4c7bc1;hpb=9047d936bd8bbf6acc6799e559c2766d4c487263;p=bluesky.git diff --git a/bluesky/crypto.c b/bluesky/crypto.c index defe1b3..df0af66 100644 --- a/bluesky/crypto.c +++ b/bluesky/crypto.c @@ -15,13 +15,12 @@ #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. */ -#define CRYPTO_BLOCK_SIZE 16 /* 128-bit AES */ -#define CRYPTO_KEY_SIZE 16 - GCRY_THREAD_OPTION_PTHREAD_IMPL; void bluesky_crypt_init() @@ -49,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; @@ -89,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;