diff options
| author | dbullock <dbullock@cinecert.com> | 2019-08-15 11:45:50 -0700 |
|---|---|---|
| committer | dbullock <dbullock@cinecert.com> | 2019-08-15 11:45:50 -0700 |
| commit | 2665fd794542870db0302d49b10f4f8decf495b0 (patch) | |
| tree | af03d1b9eff1112b442f244d5289ddebcaf59efc | |
| parent | 5c74d64d6e8d72b54e4ab34204c1ba06539422f5 (diff) | |
Add more output on HMAC compare failure.rel_2_10_34
- ASDCP::IntegrityPack::TestValues
- dump an error message that includes expected and found
HMAC
| -rwxr-xr-x | src/AS_DCP_MXF.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/AS_DCP_MXF.cpp b/src/AS_DCP_MXF.cpp index e23fb86..d3606fe 100755 --- a/src/AS_DCP_MXF.cpp +++ b/src/AS_DCP_MXF.cpp @@ -36,6 +36,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ACES.h" #include "MPEG.h" #include "Wav.h" +#include "KM_util.h" #include <iostream> #include <iomanip> @@ -688,7 +689,33 @@ ASDCP::IntegrityPack::TestValues(const ASDCP::FrameBuffer& FB, const byte_t* Ass HMAC->Update(FB.RoData(), FB.Size() - HMAC_SIZE); HMAC->Finalize(); - return HMAC->TestHMACValue(p); + Result_t result = RESULT_OK; + result = HMAC->TestHMACValue(p); + + if (KM_FAILURE(result)) + { + Result_t r = RESULT_OK; + char hmac_str[HMAC_SIZE*10]; + char found_str[HMAC_SIZE*10]; + byte_t hmac_buf[HMAC_SIZE]; + + + Kumu::bin2hex(p, HMAC_SIZE, found_str, HMAC_SIZE*10); + + r = HMAC->GetHMACValue(hmac_buf); + if ( KM_SUCCESS( r ) ) + { + Kumu::bin2hex(hmac_buf, HMAC_SIZE, hmac_str, HMAC_SIZE*10); + } + else + { + snprintf(hmac_str, HMAC_SIZE*10, " - read error - "); + } + + DefaultLogSink().Error("IntegrityPack failure: HMAC is %s, expecting %s.\n", found_str, hmac_str); + } + + return result; } // |
