From ceaf7bc52712cb60708ed5eb5c62c5e463dd8e89 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 24 Jan 2021 04:15:26 +0100 Subject: Tidying. --- src/crypto_context.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/crypto_context.h') diff --git a/src/crypto_context.h b/src/crypto_context.h index 263121bf..6020ea88 100644 --- a/src/crypto_context.h +++ b/src/crypto_context.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2018 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of libdcp. @@ -31,9 +31,16 @@ files in the program, then also delete it here. */ + +/** @file src/crypto_context.h + * @class CryptoContext class + */ + + #ifndef LIBDCP_CRYPTO_CONTEXT_H #define LIBDCP_CRYPTO_CONTEXT_H + #include "key.h" #include "types.h" #include "exceptions.h" @@ -41,22 +48,24 @@ #include #include + namespace dcp { + template class CryptoContext { public: CryptoContext (boost::optional key, Standard standard) - : _context (0) - , _hmac (0) + : _context (nullptr) + , _hmac (nullptr) { if (!key) { return; } - _context = new T; - if (ASDCP_FAILURE (_context->InitKey (key->value ()))) { + _context = new T (); + if (ASDCP_FAILURE (_context->InitKey(key->value()))) { throw MiscError ("could not set up crypto context"); } @@ -76,7 +85,7 @@ public: type = ASDCP::LS_MXF_SMPTE; } - if (ASDCP_FAILURE (_hmac->InitKey (key->value(), type))) { + if (ASDCP_FAILURE (_hmac->InitKey(key->value(), type))) { throw MiscError ("could not set up HMAC context"); } } @@ -100,9 +109,12 @@ private: ASDCP::HMACContext* _hmac; }; + typedef CryptoContext EncryptionContext; typedef CryptoContext DecryptionContext; + } + #endif -- cgit v1.2.3