diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-08-17 20:28:24 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-08-17 21:49:09 +0200 |
| commit | 56a6b3277b7acb7fcfac97ef9667467d764ea490 (patch) | |
| tree | a695d68bb0f1205a0008a3c22b9f6ee3df7e3be0 /src/crypto_context.h | |
| parent | 3e07c602fdbce92a2562980ebefb39a8df95eefe (diff) | |
Make use of HMAC optional.ignore-hmac
Diffstat (limited to 'src/crypto_context.h')
| -rw-r--r-- | src/crypto_context.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/crypto_context.h b/src/crypto_context.h index b01efce4..e8ed5857 100644 --- a/src/crypto_context.h +++ b/src/crypto_context.h @@ -47,7 +47,7 @@ template <class T> class CryptoContext { public: - CryptoContext (boost::optional<Key> key, Standard standard) + CryptoContext (boost::optional<Key> key, Standard standard, bool use_hmac) : _context (0) , _hmac (0) { @@ -67,8 +67,6 @@ public: throw MiscError ("could not set up CBC initialization vector"); } - _hmac = new ASDCP::HMACContext; - ASDCP::LabelSet_t type; if (standard == INTEROP) { type = ASDCP::LS_MXF_INTEROP; @@ -76,8 +74,11 @@ public: type = ASDCP::LS_MXF_SMPTE; } - if (ASDCP_FAILURE (_hmac->InitKey (key->value(), type))) { - throw MiscError ("could not set up HMAC context"); + if (use_hmac) { + _hmac = new ASDCP::HMACContext; + if (ASDCP_FAILURE(_hmac->InitKey(key->value(), type))) { + throw MiscError ("could not set up HMAC context"); + } } } |
