| 1 |
/* |
| 2 |
* Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved. |
| 3 |
* |
| 4 |
* Licensed under the Apache License 2.0 (the "License"). You may not use |
| 5 |
* this file except in compliance with the License. You can obtain a copy |
| 6 |
* in the file LICENSE in the source distribution or at |
| 7 |
* https://www.openssl.org/source/license.html |
| 8 |
*/ |
| 9 |
|
| 10 |
/* |
| 11 |
* ECDSA low level APIs are deprecated for public use, but still ok for |
| 12 |
* internal use. |
| 13 |
*/ |
| 14 |
#include "internal/deprecated.h" |
| 15 |
|
| 16 |
#include <openssl/ec.h> |
| 17 |
#include "ec_local.h" |
| 18 |
#include <openssl/err.h> |
| 19 |
|
| 20 |
/*- |
| 21 |
* returns |
| 22 |
* 1: correct signature |
| 23 |
* 0: incorrect signature |
| 24 |
* -1: error |
| 25 |
*/ |
| 26 |
int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, |
| 27 |
const ECDSA_SIG *sig, EC_KEY *eckey) |
| 28 |
{ |
| 29 |
if (eckey->meth->verify_sig != NULL) |
| 30 |
return eckey->meth->verify_sig(dgst, dgst_len, sig, eckey); |
| 31 |
ERR_raise(ERR_LIB_EC, EC_R_OPERATION_NOT_SUPPORTED); |
| 32 |
return -1; |
| 33 |
} |
| 34 |
|
| 35 |
/*- |
| 36 |
* returns |
| 37 |
* 1: correct signature |
| 38 |
* 0: incorrect signature |
| 39 |
* -1: error |
| 40 |
*/ |
| 41 |
int ECDSA_verify(int type, const unsigned char *dgst, int dgst_len, |
| 42 |
const unsigned char *sigbuf, int sig_len, EC_KEY *eckey) |
| 43 |
{ |
| 44 |
if (eckey->meth->verify != NULL) |
| 45 |
return eckey->meth->verify(type, dgst, dgst_len, sigbuf, sig_len, |
| 46 |
eckey); |
| 47 |
ERR_raise(ERR_LIB_EC, EC_R_OPERATION_NOT_SUPPORTED); |
| 48 |
return -1; |
| 49 |
} |