Commit graph

1712 commits

Author SHA1 Message Date
http://joey.kitenet.net/
ef6d265af4 Added a comment 2011-04-19 20:13:10 +00:00
Joey Hess
030c7a056b update 2011-04-19 16:03:27 -04:00
Joey Hess
5985acdfad bup: Avoid memory leak when transferring encrypted data.
This was a most surprising leak. It occurred in the process that is forked
off to feed data to gpg. That process was passed a lazy ByteString of
input, and ghc seemed to not GC the ByteString as it was lazily read
and consumed, so memory slowly leaked as the file was read and passed
through gpg to bup.

To fix it, I simply changed the feeder to take an IO action that returns
the lazy bytestring, and fed the result directly to hPut.

AFAICS, this should change nothing WRT buffering. But somehow it makes
ghc's GC do the right thing. Probably I triggered some weakness in ghc's
GC (version 6.12.1).

(Note that S3 still has this leak, and others too. Fixing it will involve
another dance with the type system.)

Update: One theory I have is that this has something to do with
the forking of the feeder process. Perhaps, when the ByteString
is produced before the fork, ghc decides it need to hold a pointer
to the start of it, for some reason -- maybe it doesn't realize that
it is only used in the forked process.
2011-04-19 15:27:03 -04:00
Joey Hess
b1274b6378 refactor 2011-04-19 14:50:09 -04:00
Joey Hess
a441e08da1 Fix stalls in S3 when transferring encrypted data.
Stalls were caused by code that did approximatly:

content' <- liftIO $ withEncryptedContent cipher content return
store content'

The return evaluated without actually reading content from S3,
and so the cleanup code began waiting on gpg to exit before
gpg could send all its data.

Fixing it involved moving the `store` type action into the IO monad:

liftIO $ withEncryptedContent cipher content store

Which was a bit of a pain to do, thank you type system, but
avoids the problem as now the whole content is consumed, and
stored, before cleanup.
2011-04-19 14:45:19 -04:00
Joey Hess
1687fecd33 bug 2011-04-19 13:45:32 -04:00
Joey Hess
4cbd71b057 enable gpg batch mode when GPG_AGENT_INFO is set 2011-04-19 13:40:02 -04:00
https://www.google.com/accounts/o8/id?id=AItOawl9sYlePmv1xK-VvjBdN-5doOa_Xw-jH4U
684ad74710 Added a comment 2011-04-17 23:46:38 +00:00
Joey Hess
6c238922f0 Merge remote-tracking branch 'branchable/master' 2011-04-17 18:18:55 -04:00
Joey Hess
86f7feb278 initremote: show gpg keys 2011-04-17 18:18:27 -04:00
praet
0c856a9925 2011-04-17 20:29:34 +00:00
praet
f5845ce97b 2011-04-17 20:26:56 +00:00
praet
1d94323318 2011-04-17 20:22:24 +00:00
Joey Hess
a91a51fc03 Add missing build dep on dataenc. 2011-04-17 14:41:24 -04:00
Joey Hess
7aa668f4b4 Don't run gpg in batch mode, so it can prompt for passphrase when there is no agent. 2011-04-17 14:30:22 -04:00
Joey Hess
d9690a9b5d cleanup 2011-04-17 13:11:38 -04:00
Joey Hess
e8a94d914b Merge remote-tracking branch 'branchable/master' 2011-04-17 12:45:13 -04:00
Joey Hess
8e53d0032e add news item for git-annex 0.20110417 2011-04-17 12:44:29 -04:00
Joey Hess
36f048979f releasing version 0.20110417 2011-04-17 12:43:36 -04:00
Joey Hess
dd207994bc reword again
On second thought, "unlocking" is confusable with git-annex unlock.
2011-04-17 12:36:12 -04:00
https://www.google.com/accounts/o8/id?id=AItOawl9sYlePmv1xK-VvjBdN-5doOa_Xw-jH4U
db348896c3 2011-04-17 16:02:22 +00:00
Joey Hess
416c5e38e7 link 2011-04-17 11:45:34 -04:00
Joey Hess
dcbe94b3a5 layout 2011-04-17 11:44:32 -04:00
Joey Hess
e2a3b69195 Merge remote-tracking branch 'branchable/master' 2011-04-17 11:42:31 -04:00
Joey Hess
d93e2f52c3 update 2011-04-17 11:41:52 -04:00
Joey Hess
808040d72a update to mention encryption 2011-04-17 11:38:28 -04:00
Joey Hess
f486768b16 tweak wording 2011-04-17 11:31:56 -04:00
Joey Hess
83423211a2 design wrapup 2011-04-17 11:27:24 -04:00
Joey Hess
80981600a0 looked up HMAC block size details 2011-04-17 11:13:54 -04:00
Joey Hess
eafb519592 hmacSha1 wants the secret key as first parameter
I was offline last night and going by function signatures, and unable to
tell which was which. Note sure it matters to HMAC which comes first;
better safe than sorry.
2011-04-17 11:09:33 -04:00
Joey Hess
3d2a0f68b5 note 2011-04-17 11:08:11 -04:00
Joey Hess
67cced26dc S3 crypto support
Untested, I will need to dust off my S3 keys, and plug the modem back in
that was unplugged last night due to very low battery bank power. But it
compiles, so it's probably perfect. :)
2011-04-17 11:01:34 -04:00
Joey Hess
4d136e1ef5 use different parts of cipher for hmac and gpg
Per bugs/S3_bucket_uses_the_same_key_for_encryption_and_hashing

It may be paranoid to worry about the cipher being recovered
from hmac keys, but yes.. let's be paranoid.
2011-04-17 01:36:22 -04:00
Joey Hess
50cfcdf54b make encrypted remotes have slightly higher costs 2011-04-17 01:13:21 -04:00
Joey Hess
89fab6c7b8 refactor 2011-04-17 00:57:29 -04:00
Joey Hess
9606409b9d bup encryption support 100% working 2011-04-17 00:57:11 -04:00
Joey Hess
b6b04642c8 rename 2011-04-17 00:40:23 -04:00
Joey Hess
d996637fd6 fix stall while storing encrypted data in bup
Forking a new process rather than relying on a thread to feed gpg.
The feeder thread was stalling, probably when the main thread got
to the point it was wait()ing on the gpg to exit.
2011-04-17 00:34:38 -04:00
Joey Hess
11da36e48f build dep update 2011-04-16 23:05:26 -04:00
Joey Hess
d828988415 proper encrypted keys
For HMAC, using the Data.Digest.Pure.SHA library. I have been avoiding
this library for checksumming generally, since it's (probably) not
as fast as external utilities, but it's fine to use it for HMAC.
2011-04-16 23:02:09 -04:00
Joey Hess
480cc353c4 incomplete and buggy encryption support for bup
Some kind of laziness issue that I don't want to debug right now,
and decryption is not implemented.
2011-04-16 23:01:29 -04:00
Joey Hess
991efddfa1 refactor 2011-04-16 21:41:14 -04:00
Joey Hess
98e3817466 don't let users change encryption type once remote is initted 2011-04-16 19:45:59 -04:00
Joey Hess
d2e74efdb2 document encryption 2011-04-16 19:35:02 -04:00
Joey Hess
1247bfeaa7 gpg recommended 2011-04-16 19:13:05 -04:00
Joey Hess
4f9fafa023 full encryption support for directory special remotes 2011-04-16 19:12:50 -04:00
Joey Hess
9fe7e6be70 add cipher field to AnnexState 2011-04-16 16:41:46 -04:00
Joey Hess
5efd413270 add encryption support to directory special remotes 2011-04-16 16:29:28 -04:00
Joey Hess
669851454c crypto library almost complete
Piping data through gpg with symmetric cipher is working.
Only Key encryption is not done.
2011-04-16 16:26:47 -04:00
Joey Hess
7fdf20f577 encryption key management working
Encrypted remotes don't yet encrypt data, but git annex initremote can
be used to generate a cipher and add additional gpg keys that can use it.
2011-04-16 13:25:27 -04:00