2005-04-23 05:57:36 +08:00
|
|
|
/*
|
2016-05-18 03:38:09 +08:00
|
|
|
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2002-02-14 02:21:51 +08:00
|
|
|
*
|
2016-05-18 03:38:09 +08:00
|
|
|
* Licensed under the OpenSSL license (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
|
2002-02-14 02:21:51 +08:00
|
|
|
*/
|
2002-07-26 16:41:04 +08:00
|
|
|
|
2015-10-28 03:11:00 +08:00
|
|
|
#include <openssl/ec.h>
|
|
|
|
#include "ec_lcl.h"
|
2015-10-28 03:18:59 +08:00
|
|
|
#include <openssl/err.h>
|
2002-02-14 02:21:51 +08:00
|
|
|
|
2014-12-28 10:48:40 +08:00
|
|
|
/*-
|
|
|
|
* returns
|
2002-02-14 02:21:51 +08:00
|
|
|
* 1: correct signature
|
|
|
|
* 0: incorrect signature
|
|
|
|
* -1: error
|
|
|
|
*/
|
2015-01-22 11:40:55 +08:00
|
|
|
int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
|
|
|
|
const ECDSA_SIG *sig, EC_KEY *eckey)
|
|
|
|
{
|
2015-12-09 21:10:36 +08:00
|
|
|
if (eckey->meth->verify_sig != NULL)
|
2015-10-28 03:11:00 +08:00
|
|
|
return eckey->meth->verify_sig(dgst, dgst_len, sig, eckey);
|
2015-10-28 03:18:59 +08:00
|
|
|
ECerr(EC_F_ECDSA_DO_VERIFY, EC_R_OPERATION_NOT_SUPPORTED);
|
2015-10-28 03:11:00 +08:00
|
|
|
return 0;
|
2015-01-22 11:40:55 +08:00
|
|
|
}
|
2002-02-14 02:21:51 +08:00
|
|
|
|
2014-12-28 10:48:40 +08:00
|
|
|
/*-
|
|
|
|
* returns
|
2002-02-14 02:21:51 +08:00
|
|
|
* 1: correct signature
|
|
|
|
* 0: incorrect signature
|
|
|
|
* -1: error
|
|
|
|
*/
|
2002-08-07 18:49:54 +08:00
|
|
|
int ECDSA_verify(int type, const unsigned char *dgst, int dgst_len,
|
2015-01-22 11:40:55 +08:00
|
|
|
const unsigned char *sigbuf, int sig_len, EC_KEY *eckey)
|
|
|
|
{
|
2015-12-09 21:10:36 +08:00
|
|
|
if (eckey->meth->verify != NULL)
|
2015-10-29 00:57:51 +08:00
|
|
|
return eckey->meth->verify(type, dgst, dgst_len, sigbuf, sig_len,
|
|
|
|
eckey);
|
|
|
|
ECerr(EC_F_ECDSA_VERIFY, EC_R_OPERATION_NOT_SUPPORTED);
|
|
|
|
return 0;
|
2015-01-22 11:40:55 +08:00
|
|
|
}
|