~ubuntu-branches/ubuntu/jaunty/nss/jaunty-proposed

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/pk11wrap/pk11sdr.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack, Fabien Tassin, Alexander Sack
  • Date: 2009-01-11 15:06:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090111150617-iz4lw05qgy2odorl
Tags: 3.12.2~rc1-0ubuntu1
* New upstream snapshot: 3.12.2 RC1

[ Fabien Tassin <fta@ubuntu.com> ]
* Remove patch applied upstream:
  - drop debian/patches/80_security_tools.patch
  - update debian/patches/series
* Update diverged patches:
  - update debian/patches/38_kbsd.patch
  - update debian/patches/38_mips64_build.patch
* Add new symbols to symbols file
  - update debian/libnss3-1d.symbols

[ Alexander Sack <asac@ubuntu.com> ]
* disable soname patch to become binary compatible with upstream
  - update debian/patches/series
* flip links: libnss3.so <- libnss3.so.1d (before: libnss3.so ->
  libnss3.so.1d); same link flipping was done for all other previously
  soname patched libs: libnssutil3.so, libsmime3.so.1d, libssl3.so.1d
  - update debian/libnss3-1d.links
  - update debian/libnss3-1d.symbols
* properly transition links in preinst and postrm; also cover abort-
  cases in the other maintainer scripts
  - add debian/libnss3-1d.postinst
  - add debian/libnss3-1d.postrm
  - add debian/libnss3-1d.preinst
  - add debian/libnss3-1d.prerm
* remove hack from debian/rules that debian uses to recreate
  libsoftokn3.so with a versioned SONAME
  - update debian/rules
* install the unversioned .so binaries
  - update debian/rules
* only install the 4 main libraries into /usr/lib; all the others
  go to pkglibdir
  - update debian/rules
* higher bar for libnspr4 Build-Depend to >= 4.7.3~, which is
  the version where the soname droppage is going to happen
  - update debian/control
* explitily pass libraries to be used for dpkg-gensymbols run of
  dh_makeshlibs
  - update debian/rules
* fix lintian complain about no-shlibs-control-file
  - update debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
 
137
137
  PORT_Memcpy(result->data, data->data, result->len);
138
138
 
 
139
  if (padLength < 2) {
 
140
    return SECWouldBlock;
 
141
  }
 
142
 
139
143
loser:
140
144
  return rv;
141
145
}
310
314
  CK_MECHANISM_TYPE type;
311
315
  SDRResult sdrResult;
312
316
  SECItem *params = 0;
 
317
  SECItem possibleResult = { 0, NULL, 0 };
313
318
  PLArenaPool *arena = 0;
314
319
 
315
 
 
316
320
  arena = PORT_NewArena(SEC_ASN1_DEFAULT_ARENA_SIZE);
317
321
  if (!arena) { rv = SECFailure; goto loser; }
318
322
 
341
345
        rv = pk11Decrypt(slot, arena, type, key, params, 
342
346
                        &sdrResult.data, result);
343
347
  }
 
348
 
 
349
  /*
 
350
   * if the pad value was too small (1 or 2), then it's statistically
 
351
   * 'likely' that (1 in 256) that we may not have the correct key.
 
352
   * Check the other keys for a better match. If we find none, use
 
353
   * this result.
 
354
   */
 
355
  if (rv == SECWouldBlock) {
 
356
        possibleResult = *result;
 
357
  }
 
358
 
344
359
  /*
345
360
   * handle the case where your key indicies may have been broken
346
361
   */
355
370
                             &sdrResult.data, result);
356
371
            if (rv == SECSuccess) {
357
372
                break;
 
373
            } 
 
374
            /* found a close match. If it's our first remember it */
 
375
            if (rv == SECWouldBlock) {
 
376
                if (possibleResult.data) {
 
377
                    /* this is unlikely but possible. If we hit this condition,
 
378
                     * we have no way of knowing which possibility to prefer.
 
379
                     * in this case we just match the key the application
 
380
                     * thought was the right one */
 
381
                    SECITEM_ZfreeItem(result, PR_FALSE);
 
382
                } else {
 
383
                    possibleResult = *result;
 
384
                }
358
385
            }
359
386
        }
360
387
 
365
392
        }
366
393
  }
367
394
 
368
 
 
 
395
  /* we didn't find a better key, use the one with a small pad value */
 
396
  if ((rv != SECSuccess) && (possibleResult.data)) {
 
397
        *result = possibleResult;
 
398
        possibleResult.data = NULL;
 
399
        rv = SECSuccess;
 
400
  }
369
401
 
370
402
loser:
371
 
  /* SECITEM_ZfreeItem(&paddedResult, PR_FALSE); */
372
403
  if (arena) PORT_FreeArena(arena, PR_TRUE);
373
404
  if (key) PK11_FreeSymKey(key);
374
405
  if (params) SECITEM_ZfreeItem(params, PR_TRUE);
375
406
  if (slot) PK11_FreeSlot(slot);
 
407
  if (possibleResult.data) SECITEM_ZfreeItem(&possibleResult, PR_FALSE);
376
408
 
377
409
  return rv;
378
410
}