cryspr-gnutls.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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-27 (jdube)
  14. GnuTLS/Nettle CRYSPR/4SRT (CRYypto Service PRovider for SRT)
  15. *****************************************************************************/
  16. #ifndef CRYSPR_GNUTLS_H
  17. #define CRYSPR_GNUTLS_H
  18. #include <gnutls/gnutls.h>
  19. #include <gnutls/crypto.h> //gnutls_rnd()
  20. #include <nettle/aes.h> //has AES cipher
  21. #include <nettle/ctr.h> //has CTR cipher mode
  22. #include <nettle/pbkdf2.h> //has Password-based Key Derivation Function 2
  23. //#include <nettle/sha1.h> //No need for sha1 since we have pbkdf2
  24. /* Define CRYSPR_HAS_AESCTR to 1 if this CRYSPR has AESCTR cipher mode
  25. if not set it 0 to use enable CTR cipher mode implementation using ECB cipher mode
  26. and provide the aes_ecb_cipher method.
  27. */
  28. #define CRYSPR_HAS_AESCTR 1
  29. /* Define CRYSPR_HAS_AESKWRAP to 1 if this CRYSPR has AES Key Wrap
  30. if not set to 0 to enable default/fallback crysprFallback_AES_WrapKey/crysprFallback_AES_UnwrapKey methods
  31. and provide the aes_ecb_cipher method .
  32. */
  33. #define CRYSPR_HAS_AESKWRAP 0
  34. /* Define CRYSPR_HAS_PBKDF2 to 1 if this CRYSPR has SHA1-HMAC Password-based Key Derivaion Function 2
  35. if not set to 0 to enable not-yet-implemented/fallback crysprFallback.km_pbkdf2 method
  36. and provide the sha1_msg_digest method.
  37. */
  38. #define CRYSPR_HAS_PBKDF2 1
  39. /*
  40. #define CRYSPR_AESCTX to the CRYSPR specifix AES key context object.
  41. This type reserves room in the CRYPSPR control block for Haicrypt KEK and SEK
  42. It is set from hte keystring through CRYSPR_methods.aes_set_key and passed
  43. to CRYSPR_methods.aes_XXX.
  44. */
  45. typedef struct aes_ctx CRYSPR_AESCTX; /* CRYpto Service PRovider AES key context */
  46. struct tag_CRYSPR_methods *crysprGnuTLS(void);
  47. #endif /* CRYSPR_GNUTLS_H */