2005-04-22 21:57:36 +00:00
|
|
|
/*
|
2020-04-23 13:55:52 +01:00
|
|
|
* Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
|
2002-02-13 18:21:51 +00:00
|
|
|
*
|
2018-12-06 13:38:06 +01:00
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-17 15:38:09 -04:00
|
|
|
* 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-13 18:21:51 +00:00
|
|
|
*/
|
2002-07-26 08:41:04 +00:00
|
|
|
|
2020-01-28 15:14:18 +10:00
|
|
|
/*
|
|
|
|
* ECDSA low level APIs are deprecated for public use, but still ok for
|
|
|
|
* internal use.
|
|
|
|
*/
|
|
|
|
#include "internal/deprecated.h"
|
|
|
|
|
2015-10-27 19:11:00 +00:00
|
|
|
#include <openssl/ec.h>
|
2019-09-28 00:45:40 +02:00
|
|
|
#include "ec_local.h"
|
2015-10-27 19:18:59 +00:00
|
|
|
#include <openssl/err.h>
|
2002-02-13 18:21:51 +00:00
|
|
|
|
2014-12-28 12:48:40 +10:00
|
|
|
/*-
|
|
|
|
* returns
|
2002-02-13 18:21:51 +00:00
|
|
|
* 1: correct signature
|
|
|
|
* 0: incorrect signature
|
|
|
|
* -1: error
|
|
|
|
*/
|
2015-01-22 03:40:55 +00:00
|
|
|
int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
|
|
|
|
const ECDSA_SIG *sig, EC_KEY *eckey)
|
|
|
|
{
|
2015-12-09 13:10:36 +00:00
|
|
|
if (eckey->meth->verify_sig != NULL)
|
2015-10-27 19:11:00 +00:00
|
|
|
return eckey->meth->verify_sig(dgst, dgst_len, sig, eckey);
|
2020-11-04 12:23:19 +01:00
|
|
|
ERR_raise(ERR_LIB_EC, EC_R_OPERATION_NOT_SUPPORTED);
|
2019-12-23 20:19:24 -08:00
|
|
|
return -1;
|
2015-01-22 03:40:55 +00:00
|
|
|
}
|
2002-02-13 18:21:51 +00:00
|
|
|
|
2014-12-28 12:48:40 +10:00
|
|
|
/*-
|
|
|
|
* returns
|
2002-02-13 18:21:51 +00:00
|
|
|
* 1: correct signature
|
|
|
|
* 0: incorrect signature
|
|
|
|
* -1: error
|
|
|
|
*/
|
2002-08-07 10:49:54 +00:00
|
|
|
int ECDSA_verify(int type, const unsigned char *dgst, int dgst_len,
|
2015-01-22 03:40:55 +00:00
|
|
|
const unsigned char *sigbuf, int sig_len, EC_KEY *eckey)
|
|
|
|
{
|
2015-12-09 13:10:36 +00:00
|
|
|
if (eckey->meth->verify != NULL)
|
2015-10-28 16:57:51 +00:00
|
|
|
return eckey->meth->verify(type, dgst, dgst_len, sigbuf, sig_len,
|
|
|
|
eckey);
|
2020-11-04 12:23:19 +01:00
|
|
|
ERR_raise(ERR_LIB_EC, EC_R_OPERATION_NOT_SUPPORTED);
|
2019-12-23 20:19:24 -08:00
|
|
|
return -1;
|
2015-01-22 03:40:55 +00:00
|
|
|
}
|