On 12/11/2014 11:29 PM, David Z wrote: > Would increasing the amount of secure memory that's allocated be a > reasonable fix?
Right. That would make sense, given the condition: Something like that has been introduced in the Debian build of gnupg 1.4.x for jessie (the forthcoming release). But I am a bit conservative for such a change into stable release of Debian (and gnupg 1.4.x series). Here is another way to fix the issue. Well, yesterday, I wanted to know the specific reason why your configuration kicked the error. The change of s2k (string to key) cipher configuration shouldn't had affected the memory pressure (much) for signature computation. The computation goes like this: A private key (of primary key-pair) is saved in an encrypted format by DEK (Data Encryption Key). DEK is computed by s2k function. When adding a subkey, user will be asked the passphrase to decrypt the saved data into raw private key. Decrypted, the raw private key is used to sign the subkey. Here is the problem I found in the current implementation. We don't need to keep the DEK (Data Encryption Key), once we got the private key. Following is the patch I created to fix the issue. With this patch, it is possible for me successfully adding subkey with: "s2k-cipher-algo S10". I'm going to submit this change to upstream, too. Debian GnuPG-Maintainers: For wheezy, I think that it's worth to apply this change, because it is a regression which was introduced by the security fix. For jessie, I think that this is not required, but it makes sense to apply, because there would be some corner cases which will cause similar errors. diff --git a/g10/keygen.c b/g10/keygen.c index 9020908..5af0043 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -3447,6 +3447,7 @@ generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock ) rc = do_create (algo, nbits, pub_keyblock, sec_keyblock, dek, s2k, &sub_sk, timestamp, expire, 1 ); + xfree( dek ); if (!rc) rc = write_keybinding (pub_keyblock, pub_keyblock, pri_sk, sub_sk, use, timestamp); @@ -3463,7 +3464,6 @@ generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock ) if( rc ) log_error(_("Key generation failed: %s\n"), g10_errstr(rc) ); xfree( passphrase ); - xfree( dek ); xfree( s2k ); /* release the copy of the (now unprotected) secret keys */ if( pri_sk ) -- -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org