X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=test%2Fecdsatest.c;h=ef3f54ca4e7dc64091e17679e21bd0c5643e611c;hb=bbb4ceb86eb6ea0300f744443c36fb6e980fff9d;hp=8b1e566ae85ff307e0829e01f8eddd16a59361e9;hpb=b66411f6cda6970c01283ddde6d8063c57b3b7d9;p=openssl.git diff --git a/test/ecdsatest.c b/test/ecdsatest.c index 8b1e566ae8..ef3f54ca4e 100644 --- a/test/ecdsatest.c +++ b/test/ecdsatest.c @@ -1,5 +1,6 @@ /* * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -7,33 +8,14 @@ * https://www.openssl.org/source/license.html */ -/* ==================================================================== - * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. - * - * Portions of the attached software ("Contribution") are developed by - * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. - * - * The Contribution is licensed pursuant to the OpenSSL open source - * license provided above. - * - * The elliptic curve binary polynomial software is originally written by - * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. - * - */ - #include #include #include #include /* To see if OPENSSL_NO_EC is defined */ +# include "testutil.h" -#ifdef OPENSSL_NO_EC -int main(int argc, char *argv[]) -{ - puts("Elliptic curves are disabled."); - return 0; -} -#else +#ifndef OPENSSL_NO_EC # include # include @@ -45,11 +27,9 @@ int main(int argc, char *argv[]) # endif # include # include -# include "testutil.h" -# include "test_main.h" -static const char rnd_seed[] = "string to make the random number generator " - "think it has entropy"; +static const char rnd_seed[] = + "string to make the random number generator think it has randomness"; /* functions to change the RAND_METHOD */ @@ -168,8 +148,8 @@ static int x9_62_test_internal(int nid, const char *r_in, const char *s_in) if (!TEST_true(BN_dec2bn(&r, r_in)) || !TEST_true(BN_dec2bn(&s, s_in))) goto x962_int_err; ECDSA_SIG_get0(signature, &sig_r, &sig_s); - if (!TEST_int_eq(BN_cmp(sig_r, r), 0) - || !TEST_int_eq(BN_cmp(sig_s, s), 0)) + if (!TEST_BN_eq(sig_r, r) + || !TEST_BN_eq(sig_s, s)) goto x962_int_err; /* verify the signature */ @@ -414,12 +394,16 @@ static int test_builtin(void) return ret; } +#endif void register_tests(void) { +#ifdef OPENSSL_NO_EC + TEST_note("Elliptic curves are disabled."); +#else /* initialize the prng */ RAND_seed(rnd_seed, sizeof(rnd_seed)); ADD_TEST(x9_62_tests); ADD_TEST(test_builtin); -} #endif +}