compat.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. /* Don't warn about deprecated functions. */
  19. #ifndef OPENSSL_API_COMPAT
  20. /* 0x10101000L == 1.1.1. */
  21. #define OPENSSL_API_COMPAT 0x10101000L
  22. #endif
  23. #include <openssl/bn.h>
  24. #include <openssl/hmac.h>
  25. #include <openssl/ec.h>
  26. #include <openssl/ecdsa.h>
  27. #include <openssl/evp.h>
  28. #include <openssl/rsa.h>
  29. #if OPENSSL_VERSION_NUMBER < 0x10100000L
  30. const unsigned char *
  31. EVP_PKEY_get0_hmac(EVP_PKEY *pkey, size_t *len);
  32. void
  33. RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);
  34. void
  35. RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
  36. void
  37. RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
  38. const BIGNUM **iqmp);
  39. RSA *
  40. EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
  41. EC_KEY *
  42. EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey);
  43. int
  44. RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
  45. int
  46. RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
  47. int
  48. RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
  49. EVP_MD_CTX *
  50. EVP_MD_CTX_new(void);
  51. void
  52. EVP_MD_CTX_free(EVP_MD_CTX *ctx);
  53. void
  54. ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
  55. int
  56. ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);
  57. HMAC_CTX *
  58. HMAC_CTX_new(void);
  59. const EVP_MD *
  60. HMAC_CTX_get_md(const HMAC_CTX *ctx);
  61. void
  62. HMAC_CTX_free(HMAC_CTX *ctx);
  63. #endif