compat.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* vim: set tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80: */
  2. /*
  3. * Copyright 2016 Red Hat, Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. #pragma once
  18. #include <openssl/hmac.h>
  19. #include <openssl/ec.h>
  20. #include <openssl/ecdsa.h>
  21. #include <openssl/evp.h>
  22. #include <openssl/rsa.h>
  23. #if OPENSSL_VERSION_NUMBER < 0x10100000L
  24. const unsigned char *
  25. EVP_PKEY_get0_hmac(EVP_PKEY *pkey, size_t *len);
  26. void
  27. RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);
  28. void
  29. RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
  30. void
  31. RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
  32. const BIGNUM **iqmp);
  33. RSA *
  34. EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
  35. EC_KEY *
  36. EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey);
  37. int
  38. RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
  39. int
  40. RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
  41. int
  42. RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
  43. EVP_MD_CTX *
  44. EVP_MD_CTX_new(void);
  45. void
  46. EVP_MD_CTX_free(EVP_MD_CTX *ctx);
  47. void
  48. ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
  49. int
  50. ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);
  51. HMAC_CTX *
  52. HMAC_CTX_new(void);
  53. const EVP_MD *
  54. HMAC_CTX_get_md(const HMAC_CTX *ctx);
  55. void
  56. HMAC_CTX_free(HMAC_CTX *ctx);
  57. #endif