~ubuntu-branches/ubuntu/raring/gnupg2/raring-proposed

« back to all changes in this revision

Viewing changes to agent/protect.c

  • Committer: Bazaar Package Importer
  • Author(s): Martijn van Brummelen
  • Date: 2010-05-07 06:23:55 UTC
  • Revision ID: james.westby@ubuntu.com-20100507062355-nn68cuqzgba94e9k
Tags: 2.0.14-1.1
* Non-maintainer upload.
* Added encode-s2k.patch(Encode the s2kcount and do not use a
  static value of 96.(thanks to Werner Koch) (closes: #567926).

Show diffs side-by-side

added added

removed removed

Lines of Context:
360
360
       
361
361
     in canoncical format of course.  We use asprintf and %n modifier
362
362
     and dummy values as placeholders.  */
363
 
  p = xtryasprintf
364
 
    ("(9:protected%d:%s((4:sha18:%n_8bytes_2:96)%d:%n%*s)%d:%n%*s)",
365
 
     (int)strlen (modestr), modestr,
366
 
     &saltpos, 
367
 
     blklen, &ivpos, blklen, "",
368
 
     enclen, &encpos, enclen, "");
369
 
  if (!p)
370
 
    {
371
 
      gpg_error_t tmperr = out_of_core ();
372
 
      xfree (iv);
373
 
      xfree (outbuf);
374
 
      return tmperr;
375
 
    }
 
363
 {
 
364
    char countbuf[35];
 
365
 
 
366
    snprintf (countbuf, sizeof countbuf, "%lu", get_standard_s2k_count ());
 
367
    p = xtryasprintf
 
368
      ("(9:protected%d:%s((4:sha18:%n_8bytes_%u:%s)%d:%n%*s)%d:%n%*s)",
 
369
       (int)strlen (modestr), modestr,
 
370
       &saltpos,
 
371
       (unsigned int)strlen (countbuf), countbuf,
 
372
       blklen, &ivpos, blklen, "",
 
373
       enclen, &encpos, enclen, "");
 
374
    if (!p)
 
375
      {
 
376
        gpg_error_t tmperr = out_of_core ();
 
377
        xfree (iv);
 
378
        xfree (outbuf);
 
379
        return tmperr;
 
380
      }
 
381
  }
376
382
  *resultlen = strlen (p);
377
383
  *result = (unsigned char*)p;
378
384
  memcpy (p+saltpos, iv+2*blklen, 8);