From: Michael Vrable Date: Sun, 17 Oct 2010 23:18:23 +0000 (-0700) Subject: Delete dead code. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=ebcc59dc78483b9e9ee7aa33705974f386d12383;p=bluesky.git Delete dead code. --- diff --git a/bluesky/crypto.c b/bluesky/crypto.c index f34b8b7..89f6b12 100644 --- a/bluesky/crypto.c +++ b/bluesky/crypto.c @@ -251,87 +251,3 @@ gboolean bluesky_crypt_block_decrypt(gchar *cloud_block, size_t len, return TRUE; } - -#if 0 -/* Encrypt a data block. */ -BlueSkyRCStr *bluesky_crypt_encrypt(BlueSkyRCStr *in, const uint8_t *key) -{ - gcry_error_t status; - gcry_cipher_hd_t handle; - - status = gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CTR, - 0); - if (status) { - g_error("gcrypt error setting up encryption: %s\n", - gcry_strerror(status)); - } - - uint8_t *out = g_malloc0(in->len + CRYPTO_BLOCK_SIZE); - - gcry_cipher_setkey(handle, key, CRYPTO_KEY_SIZE); - if (status) { - g_error("gcrypt error setting key: %s\n", - gcry_strerror(status)); - } - - bluesky_crypt_random_bytes(out, CRYPTO_BLOCK_SIZE); - status = gcry_cipher_setctr(handle, out, CRYPTO_BLOCK_SIZE); - if (status) { - g_error("gcrypt error setting IV: %s\n", - gcry_strerror(status)); - } - - status = gcry_cipher_encrypt(handle, out + CRYPTO_BLOCK_SIZE, in->len, - in->data, in->len); - if (status) { - g_error("gcrypt error encrypting: %s\n", - gcry_strerror(status)); - } - - gcry_cipher_close(handle); - - return bluesky_string_new(out, in->len + CRYPTO_BLOCK_SIZE); -} - -/* Decrypt a data block. */ -BlueSkyRCStr *bluesky_crypt_decrypt(BlueSkyRCStr *in, const uint8_t *key) -{ - gcry_error_t status; - gcry_cipher_hd_t handle; - - g_return_val_if_fail(in->len > CRYPTO_BLOCK_SIZE, NULL); - - status = gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CTR, - 0); - if (status) { - g_error("gcrypt error setting up encryption: %s\n", - gcry_strerror(status)); - } - - uint8_t *out = g_malloc0(in->len - CRYPTO_BLOCK_SIZE); - - gcry_cipher_setkey(handle, key, CRYPTO_KEY_SIZE); - if (status) { - g_error("gcrypt error setting key: %s\n", - gcry_strerror(status)); - } - - status = gcry_cipher_setctr(handle, in->data, CRYPTO_BLOCK_SIZE); - if (status) { - g_error("gcrypt error setting IV: %s\n", - gcry_strerror(status)); - } - - status = gcry_cipher_decrypt(handle, out, in->len - CRYPTO_BLOCK_SIZE, - in->data + CRYPTO_BLOCK_SIZE, - in->len - CRYPTO_BLOCK_SIZE); - if (status) { - g_error("gcrypt error decrypting: %s\n", - gcry_strerror(status)); - } - - gcry_cipher_close(handle); - - return bluesky_string_new(out, in->len - CRYPTO_BLOCK_SIZE); -} -#endif