ecdsa_vrf.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. * ECDSA low level APIs are deprecated for public use, but still ok for
  11. * internal use.
  12. */
  13. #include "internal/deprecated.h"
  14. #include <openssl/ec.h>
  15. #include "ec_local.h"
  16. #include <openssl/err.h>
  17. /*-
  18. * returns
  19. * 1: correct signature
  20. * 0: incorrect signature
  21. * -1: error
  22. */
  23. int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
  24. const ECDSA_SIG *sig, EC_KEY *eckey)
  25. {
  26. if (eckey->meth->verify_sig != NULL)
  27. return eckey->meth->verify_sig(dgst, dgst_len, sig, eckey);
  28. ERR_raise(ERR_LIB_EC, EC_R_OPERATION_NOT_SUPPORTED);
  29. return -1;
  30. }
  31. /*-
  32. * returns
  33. * 1: correct signature
  34. * 0: incorrect signature
  35. * -1: error
  36. */
  37. int ECDSA_verify(int type, const unsigned char *dgst, int dgst_len,
  38. const unsigned char *sigbuf, int sig_len, EC_KEY *eckey)
  39. {
  40. if (eckey->meth->verify != NULL)
  41. return eckey->meth->verify(type, dgst, dgst_len, sigbuf, sig_len,
  42. eckey);
  43. ERR_raise(ERR_LIB_EC, EC_R_OPERATION_NOT_SUPPORTED);
  44. return -1;
  45. }