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