~ubuntu-branches/ubuntu/lucid/openssl/lucid-proposed

« back to all changes in this revision

Viewing changes to crypto/ecdsa/ecs_ossl.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2009-06-13 18:15:46 UTC
  • mto: (11.1.5 squeeze)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20090613181546-vbfntai3b009dl1u
Tags: upstream-0.9.8k
ImportĀ upstreamĀ versionĀ 0.9.8k

Show diffs side-by-side

added added

removed removed

Lines of Context:
251
251
                ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_EC_LIB);
252
252
                goto err;
253
253
        }
254
 
        if (dgst_len > BN_num_bytes(order))
 
254
        if (8 * dgst_len > BN_num_bits(order))
255
255
        {
 
256
                /* XXX
 
257
                 * 
 
258
                 * Should provide for optional hash truncation:
 
259
                 * Keep the BN_num_bits(order) leftmost bits of dgst
 
260
                 * (see March 2006 FIPS 186-3 draft, which has a few
 
261
                 * confusing errors in this part though)
 
262
                 */
 
263
 
256
264
                ECDSAerr(ECDSA_F_ECDSA_DO_SIGN,
257
265
                        ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
258
266
                goto err;
376
384
                ECDSAerr(ECDSA_F_ECDSA_DO_VERIFY, ERR_R_EC_LIB);
377
385
                goto err;
378
386
        }
 
387
        if (8 * dgst_len > BN_num_bits(order))
 
388
        {
 
389
                /* XXX
 
390
                 * 
 
391
                 * Should provide for optional hash truncation:
 
392
                 * Keep the BN_num_bits(order) leftmost bits of dgst
 
393
                 * (see March 2006 FIPS 186-3 draft, which has a few
 
394
                 * confusing errors in this part though)
 
395
                 */
 
396
 
 
397
                ECDSAerr(ECDSA_F_ECDSA_DO_VERIFY,
 
398
                        ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
 
399
                ret = 0;
 
400
                goto err;
 
401
        }
379
402
 
380
403
        if (BN_is_zero(sig->r)          || BN_is_negative(sig->r) || 
381
404
            BN_ucmp(sig->r, order) >= 0 || BN_is_zero(sig->s)  ||