X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;ds=sidebyside;f=bluesky%2Fbluesky.h;h=a4dfbbe511ea34b84f73a3a89d31337f69cd8403;hb=52a6a600573a0483ea1aa99ec018e649299ea151;hp=4dab23464efafd23f0e16d13939bc93628121ae2;hpb=74f45d45ca481cdd9e9c502ee9de591970dbf1de;p=bluesky.git diff --git a/bluesky/bluesky.h b/bluesky/bluesky.h index 4dab234..a4dfbbe 100644 --- a/bluesky/bluesky.h +++ b/bluesky/bluesky.h @@ -85,22 +85,6 @@ void bluesky_string_unref(BlueSkyRCStr *string); BlueSkyRCStr *bluesky_string_dup(BlueSkyRCStr *string); void bluesky_string_resize(BlueSkyRCStr *string, gsize len); -/* Cryptographic operations. */ -#define CRYPTO_BLOCK_SIZE 16 /* 128-bit AES */ -#define CRYPTO_KEY_SIZE 16 -#define CRYPTO_HASH_SIZE 32 /* SHA-256 */ - -struct BlueSkyCryptKeys { - uint8_t encryption_key[CRYPTO_KEY_SIZE]; - uint8_t authentication_key[CRYPTO_HASH_SIZE]; -}; - -void bluesky_crypt_init(); -void bluesky_crypt_hash_key(const char *keystr, uint8_t *out); -void bluesky_crypt_random_bytes(guchar *buf, gint len); -BlueSkyRCStr *bluesky_crypt_encrypt(BlueSkyRCStr *in, const uint8_t *key); -BlueSkyRCStr *bluesky_crypt_decrypt(BlueSkyRCStr *in, const uint8_t *key); - /* Storage interface. This presents a key-value store abstraction, and can * have multiple implementations: in-memory, on-disk, in-cloud. */ struct _BlueSkyStore; @@ -140,6 +124,8 @@ typedef enum { /* Filesystem state. Each filesystem which is exported is represented by a * single bluesky_fs structure in memory. */ +struct BlueSkyCryptKeys; + typedef struct { GMutex *lock; @@ -151,6 +137,10 @@ typedef struct { BlueSkyLog *log; BlueSkyCloudLogState *log_state; + /* Filesystem crypto keys */ + char *master_key; + struct BlueSkyCryptKeys *keys; + /* Accounting for memory used for caches. Space is measured in blocks, not * bytes. Updates to these variables must be made atomically. */ gint cache_dirty; @@ -313,7 +303,8 @@ typedef struct { BlueSkyRCStr *dirty; /* if DIRTY: raw data in memory */ } BlueSkyBlock; -BlueSkyFS *bluesky_init_fs(gchar *name, BlueSkyStore *store); +BlueSkyFS *bluesky_init_fs(gchar *name, BlueSkyStore *store, + const gchar *master_key); gboolean bluesky_inode_is_ready(BlueSkyInode *inode);