cryspr-openssl.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * SRT - Secure, Reliable, Transport
  3. * Copyright (c) 2019 Haivision Systems Inc.
  4. *
  5. * This Source Code Form is subject to the terms of the Mozilla Public
  6. * License, v. 2.0. If a copy of the MPL was not distributed with this
  7. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  8. *
  9. */
  10. /*****************************************************************************
  11. written by
  12. Haivision Systems Inc.
  13. 2019-06-26 (jdube)
  14. OpenSSL Direct AES CRYSPR/4SRT (CRYypto Service PRovider for SRT).
  15. *****************************************************************************/
  16. #ifndef CRYSPR_OPENSSL_H
  17. #define CRYSPR_OPENSSL_H
  18. #include <openssl/evp.h> /* PKCS5_xxx() */
  19. #include <openssl/aes.h> /* AES_xxx() */
  20. #if (OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(OPENSSL_IS_BORINGSSL))
  21. # include <openssl/modes.h> /* CRYPTO_xxx() */
  22. #endif
  23. #include <openssl/rand.h>
  24. #include <openssl/err.h>
  25. #include <openssl/opensslv.h> /* OPENSSL_VERSION_NUMBER */
  26. /* Define CRYSPR_HAS_AESCTR to 1 if this CRYSPR has AESCTR cipher mode
  27. if not set it 0 to use enable CTR cipher mode implementation using ECB cipher mode
  28. and provide the aes_ecb_cipher method.
  29. */
  30. #define CRYSPR_HAS_AESCTR 1
  31. /* Define CRYSPR_HAS_AESKWRAP to 1 if this CRYSPR has AES Key Wrap
  32. if not set to 0 to enable default/fallback crysprFallback_AES_WrapKey/crysprFallback_AES_UnwrapKey methods
  33. and provide the aes_ecb_cipher method .
  34. */
  35. #if (OPENSSL_VERSION_NUMBER < 0x0090808fL) //0.9.8h
  36. #define CRYSPR_HAS_AESKWRAP 0
  37. #else
  38. #define CRYSPR_HAS_AESKWRAP 1
  39. #endif
  40. /* Define CRYSPR_HAS_PBKDF2 to 1 if this CRYSPR has SHA1-HMAC Password-based Key Derivaion Function 2
  41. if not set to 0 to enable not-yet-implemented/fallback crysprFallback.km_pbkdf2 method
  42. and provide the sha1_msg_digest method.
  43. */
  44. #define CRYSPR_HAS_PBKDF2 1 /* Define to 1 if CRYSPR has Password-based Key Derivaion Function 2 */
  45. /*
  46. #define CRYSPR_AESCTX to the CRYSPR specifix AES key context object.
  47. This type reserves room in the CRYPSPR control block for Haicrypt KEK and SEK
  48. It is set from hte keystring through CRYSPR_methods.aes_set_key and passed
  49. to CRYSPR_methods.aes_*.
  50. */
  51. typedef AES_KEY CRYSPR_AESCTX; /* CRYpto Service PRovider AES key context */
  52. struct tag_CRYSPR_methods *crysprOpenSSL(void);
  53. #endif /* CRYSPR_OPENSSL_H */