1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-03-27 22:39:59 +01:00

Fixed a regression in 2.0.14

This commit is contained in:
Werner Koch 2010-01-26 16:33:58 +00:00
parent 2437911903
commit 5f5091ed79
3 changed files with 27 additions and 13 deletions

3
NEWS

@ -3,6 +3,9 @@ Noteworthy changes in version 2.0.15 (unreleased)
* New command --passwd for GPG. * New command --passwd for GPG.
* Fixes a regression in 2.0.14 which prevented unprotection of new
or changed gpg-agent passphrases.
Noteworthy changes in version 2.0.14 (2009-12-21) Noteworthy changes in version 2.0.14 (2009-12-21)
------------------------------------------------- -------------------------------------------------

@ -1,3 +1,8 @@
2010-01-26 Werner Koch <wk@g10code.com>
* protect.c (do_encryption): Encode the s2kcount and do not use a
static value of 96.
2009-12-21 Werner Koch <wk@g10code.com> 2009-12-21 Werner Koch <wk@g10code.com>
* command.c (cmd_getinfo): Add sub-command "s2k_count". * command.c (cmd_getinfo): Add sub-command "s2k_count".

@ -360,19 +360,25 @@ do_encryption (const unsigned char *protbegin, size_t protlen,
in canoncical format of course. We use asprintf and %n modifier in canoncical format of course. We use asprintf and %n modifier
and dummy values as placeholders. */ and dummy values as placeholders. */
p = xtryasprintf {
("(9:protected%d:%s((4:sha18:%n_8bytes_2:96)%d:%n%*s)%d:%n%*s)", char countbuf[35];
(int)strlen (modestr), modestr,
&saltpos, snprintf (countbuf, sizeof countbuf, "%lu", get_standard_s2k_count ());
blklen, &ivpos, blklen, "", p = xtryasprintf
enclen, &encpos, enclen, ""); ("(9:protected%d:%s((4:sha18:%n_8bytes_%u:%s)%d:%n%*s)%d:%n%*s)",
if (!p) (int)strlen (modestr), modestr,
{ &saltpos,
gpg_error_t tmperr = out_of_core (); (unsigned int)strlen (countbuf), countbuf,
xfree (iv); blklen, &ivpos, blklen, "",
xfree (outbuf); enclen, &encpos, enclen, "");
return tmperr; if (!p)
} {
gpg_error_t tmperr = out_of_core ();
xfree (iv);
xfree (outbuf);
return tmperr;
}
}
*resultlen = strlen (p); *resultlen = strlen (p);
*result = (unsigned char*)p; *result = (unsigned char*)p;
memcpy (p+saltpos, iv+2*blklen, 8); memcpy (p+saltpos, iv+2*blklen, 8);