* Copyright 2002-2018 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
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
# ifndef OPENSSL_NO_ENGINE
# include <openssl/engine.h>
# endif
+# include <openssl/sha.h>
# include <openssl/err.h>
# include <openssl/rand.h>
/* Use ECDSA_sign_setup to avoid use of ECDSA nonces */
if (!TEST_true(ECDSA_sign_setup(key, NULL, &kinv, &rp)))
goto x962_int_err;
- if (!TEST_ptr(signature =
+ if (!TEST_ptr(signature =
ECDSA_do_sign_ex(digest, SHA_DIGEST_LENGTH, kinv, rp, key)))
goto x962_int_err;
/* verify the signature */
if (!TEST_int_eq(ECDSA_do_verify(digest, SHA_DIGEST_LENGTH,
- signature, key), 1))
+ signature, key), 1))
goto x962_int_err;
ret = 1;
EC_KEY *eckey = NULL, *wrong_eckey = NULL;
EC_GROUP *group;
ECDSA_SIG *ecdsa_sig = NULL, *modified_sig = NULL;
- unsigned char digest[SHA512_DIGEST_LENGTH],
- wrong_digest[SHA512_DIGEST_LENGTH];
+ unsigned char digest[SHA512_DIGEST_LENGTH];
+ unsigned char wrong_digest[SHA512_DIGEST_LENGTH];
unsigned char *signature = NULL;
const unsigned char *sig_ptr;
unsigned char *sig_ptr2;
/* create signature */
sig_len = ECDSA_size(eckey);
if (!TEST_ptr(signature = OPENSSL_malloc(sig_len))
- || !TEST_true(ECDSA_sign(0, digest, SHA512_DIGEST_LENGTH,
- signature, &sig_len, eckey)))
+ || !TEST_true(ECDSA_sign(0, digest, SHA512_DIGEST_LENGTH,
+ signature, &sig_len, eckey)))
goto builtin_err;
/* verify signature */
goto builtin_err;
if (!TEST_ptr(modified_r = BN_bin2bn(raw_buf, bn_len, NULL))
|| !TEST_ptr(modified_s = BN_bin2bn(raw_buf + bn_len,
- bn_len, NULL))
+ bn_len, NULL))
|| !TEST_true(ECDSA_SIG_set0(modified_sig,
modified_r, modified_s))) {
BN_free(modified_r);
raw_buf[offset] ^= dirt;
if (!TEST_ptr(unmodified_r = BN_bin2bn(raw_buf, bn_len, NULL))
|| !TEST_ptr(unmodified_s = BN_bin2bn(raw_buf + bn_len,
- bn_len, NULL))
+ bn_len, NULL))
|| !TEST_true(ECDSA_SIG_set0(modified_sig, unmodified_r,
unmodified_s))) {
BN_free(unmodified_r);