From ad3cd2aeff15bd31aa38544063075d910ac63823 Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 16 Dec 2016 11:16:19 -0800 Subject: Better tests for password protected documents. - Add unit tests for sha256 implementation. - Remove void* types from API in favor of correct actual types. Review-Url: https://codereview.chromium.org/2577223002 --- xfa/fxfa/DEPS | 1 + xfa/fxfa/app/xfa_checksum.cpp | 2 +- xfa/fxfa/xfa_checksum.h | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/DEPS b/xfa/fxfa/DEPS index 3170149ce2..93a9acbc13 100644 --- a/xfa/fxfa/DEPS +++ b/xfa/fxfa/DEPS @@ -1,4 +1,5 @@ include_rules = [ + '+core/fdrm/crypto', '+core/fxcodec', '+fxjs', ] diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp index 61cbe97fb3..641ec7880e 100644 --- a/xfa/fxfa/app/xfa_checksum.cpp +++ b/xfa/fxfa/app/xfa_checksum.cpp @@ -219,7 +219,7 @@ CXFA_ChecksumContext::~CXFA_ChecksumContext() { void CXFA_ChecksumContext::StartChecksum() { FinishChecksum(); - m_pByteContext = FX_Alloc(uint8_t, 128); + m_pByteContext = FX_Alloc(CRYPT_sha1_context, 1); CRYPT_SHA1Start(m_pByteContext); m_bsChecksum.clear(); m_pSAXReader = new CFX_SAXReader; diff --git a/xfa/fxfa/xfa_checksum.h b/xfa/fxfa/xfa_checksum.h index 32862c94c3..45c3db59c9 100644 --- a/xfa/fxfa/xfa_checksum.h +++ b/xfa/fxfa/xfa_checksum.h @@ -7,6 +7,7 @@ #ifndef XFA_FXFA_XFA_CHECKSUM_H_ #define XFA_FXFA_XFA_CHECKSUM_H_ +#include "core/fdrm/crypto/fx_crypt.h" #include "xfa/fde/xml/cfx_saxreader.h" #include "xfa/fxfa/fxfa.h" @@ -70,7 +71,7 @@ class CXFA_ChecksumContext { protected: CFX_SAXReader* m_pSAXReader; - uint8_t* m_pByteContext; + CRYPT_sha1_context* m_pByteContext; CFX_ByteString m_bsChecksum; }; -- cgit v1.2.3