Browse Source

Test |ECDSA_SIG_to_bytes| using the P-521 order size, not 512-bits.

There was a test for 512 bit orders but not one for 521-bit orders.
Test 521-bit orders instead.

Change-Id: I61a76d02637ca55d8ae21834085311dd84fd870f
Reviewed-on: https://boringssl-review.googlesource.com/7011
Reviewed-by: David Benjamin <davidben@google.com>
kris/onging/CECPQ3_patch15
Brian Smith 8 years ago
committed by David Benjamin
parent
commit
168297e870
1 changed files with 9 additions and 5 deletions
  1. +9
    -5
      crypto/ecdsa/ecdsa_test.cc

+ 9
- 5
crypto/ecdsa/ecdsa_test.cc View File

@@ -340,15 +340,19 @@ static bool TestECDSA_SIG_max_len(size_t order_len) {
return true; return true;
} }


static size_t BitsToBytes(size_t bits) {
return (bits / 8) + (7 + (bits % 8)) / 8;
}

int main(void) { int main(void) {
CRYPTO_library_init(); CRYPTO_library_init();


if (!TestBuiltin(stdout) || if (!TestBuiltin(stdout) ||
!TestECDSA_SIG_max_len(224/8) ||
!TestECDSA_SIG_max_len(256/8) ||
!TestECDSA_SIG_max_len(384/8) ||
!TestECDSA_SIG_max_len(512/8) ||
!TestECDSA_SIG_max_len(10000)) {
!TestECDSA_SIG_max_len(BitsToBytes(224)) ||
!TestECDSA_SIG_max_len(BitsToBytes(256)) ||
!TestECDSA_SIG_max_len(BitsToBytes(384)) ||
!TestECDSA_SIG_max_len(BitsToBytes(521)) ||
!TestECDSA_SIG_max_len(BitsToBytes(10000))) {
printf("\nECDSA test failed\n"); printf("\nECDSA test failed\n");
ERR_print_errors_fp(stdout); ERR_print_errors_fp(stdout);
return 1; return 1;


Loading…
Cancel
Save