iUse param.key directly, no need to keep a copy - dedup - deduplicating backup program Err bitreich.org 70 hgit clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ URL:git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ bitreich.org 70 1Log /scm/dedup/log.gph bitreich.org 70 1Files /scm/dedup/files.gph bitreich.org 70 1Refs /scm/dedup/refs.gph bitreich.org 70 1Tags /scm/dedup/tag bitreich.org 70 1README /scm/dedup/file/README.gph bitreich.org 70 1LICENSE /scm/dedup/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit 7102fc953fa622740207fbe9bce945d33aa9105e /scm/dedup/commit/7102fc953fa622740207fbe9bce945d33aa9105e.gph bitreich.org 70 1parent 86e037e9f1ee5d564daa67fae8f4cc6fd8bc19d6 /scm/dedup/commit/86e037e9f1ee5d564daa67fae8f4cc6fd8bc19d6.gph bitreich.org 70 hAuthor: sin URL:mailto:sin@2f30.org bitreich.org 70 iDate: Fri, 17 May 2019 14:38:43 +0300 Err bitreich.org 70 i Err bitreich.org 70 iUse param.key directly, no need to keep a copy Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M bencrypt.c | 7 ++----- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 2 insertions(+), 5 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/bencrypt.c b/bencrypt.c /scm/dedup/file/bencrypt.c.gph bitreich.org 70 i@@ -51,7 +51,6 @@ static struct bops bops = { Err bitreich.org 70 i /* Encryption layer context */ Err bitreich.org 70 i struct ectx { Err bitreich.org 70 i int type; /* encryption algorithm type for new blocks */ Err bitreich.org 70 i- unsigned char key[KEYSIZE]; /* secret key */ Err bitreich.org 70 i }; Err bitreich.org 70 i Err bitreich.org 70 i /* Encryption descriptor */ Err bitreich.org 70 i@@ -128,7 +127,6 @@ becreat(struct bctx *bctx, char *path, int mode) Err bitreich.org 70 i } Err bitreich.org 70 i ectx = bctx->ectx; Err bitreich.org 70 i ectx->type = type; Err bitreich.org 70 i- memcpy(ectx->key, param.key, KEYSIZE); Err bitreich.org 70 i Err bitreich.org 70 i if (bstorageops()->creat(bctx, path, mode) < 0) { Err bitreich.org 70 i free(ectx); Err bitreich.org 70 i@@ -166,7 +164,6 @@ beopen(struct bctx *bctx, char *path, int flags, int mode) Err bitreich.org 70 i } Err bitreich.org 70 i ectx = bctx->ectx; Err bitreich.org 70 i ectx->type = type; Err bitreich.org 70 i- memcpy(ectx->key, param.key, KEYSIZE); Err bitreich.org 70 i Err bitreich.org 70 i if (bstorageops()->open(bctx, path, flags, mode) < 0) { Err bitreich.org 70 i free(ectx); Err bitreich.org 70 i@@ -227,7 +224,7 @@ beput(struct bctx *bctx, void *buf, size_t n, unsigned char *md) Err bitreich.org 70 i case EDCHACHATYPE: Err bitreich.org 70 i crypto_aead_xchacha20poly1305_ietf_encrypt(&ebuf[EDSIZE], &elen, Err bitreich.org 70 i buf, n, ebuf, EDSIZE, NULL, Err bitreich.org 70 i- ed.nonce, ectx->key); Err bitreich.org 70 i+ ed.nonce, param.key); Err bitreich.org 70 i assert(elen == en); Err bitreich.org 70 i break; Err bitreich.org 70 i } Err bitreich.org 70 i@@ -290,7 +287,7 @@ beget(struct bctx *bctx, unsigned char *md, void *buf, size_t *n) Err bitreich.org 70 i NULL, Err bitreich.org 70 i &ebuf[EDSIZE], ed.size, Err bitreich.org 70 i ebuf, EDSIZE, Err bitreich.org 70 i- ed.nonce, ectx->key) < 0) { Err bitreich.org 70 i+ ed.nonce, param.key) < 0) { Err bitreich.org 70 i free(ebuf); Err bitreich.org 70 i seterr("authentication failed"); Err bitreich.org 70 i return -1; Err bitreich.org 70 .