Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp

Issue 1870043003: Remove CFX_ByteString::Load() and operator= for CFX_ByteTextBuf (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | core/fxcodec/codec/fx_codec_png.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h" 7 #include "core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h"
8 8
9 #include <time.h> 9 #include <time.h>
10 10
11 #include "core/fdrm/crypto/include/fx_crypt.h" 11 #include "core/fdrm/crypto/include/fx_crypt.h"
12 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h"
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h"
14 #include "core/fpdfapi/fpdf_parser/ipdf_security_handler.h" 14 #include "core/fpdfapi/fpdf_parser/ipdf_security_handler.h"
15 15
16 IPDF_CryptoHandler::~IPDF_CryptoHandler() {} 16 IPDF_CryptoHandler::~IPDF_CryptoHandler() {}
17 17
18 void IPDF_CryptoHandler::Decrypt(uint32_t objnum, 18 void IPDF_CryptoHandler::Decrypt(uint32_t objnum,
19 uint32_t gennum, 19 uint32_t gennum,
20 CFX_ByteString& str) { 20 CFX_ByteString& str) {
21 CFX_BinaryBuf dest_buf; 21 CFX_BinaryBuf dest_buf;
22 void* context = DecryptStart(objnum, gennum); 22 void* context = DecryptStart(objnum, gennum);
23 DecryptStream(context, (const uint8_t*)str, str.GetLength(), dest_buf); 23 DecryptStream(context, str.raw_str(), str.GetLength(), dest_buf);
24 DecryptFinish(context, dest_buf); 24 DecryptFinish(context, dest_buf);
25 str = dest_buf; 25 str = CFX_ByteString(dest_buf.GetBuffer(), dest_buf.GetSize());
26 } 26 }
27 27
28 void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, 28 void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt,
29 uint32_t objnum, 29 uint32_t objnum,
30 uint32_t gennum, 30 uint32_t gennum,
31 const uint8_t* src_buf, 31 const uint8_t* src_buf,
32 uint32_t src_size, 32 uint32_t src_size,
33 uint8_t* dest_buf, 33 uint8_t* dest_buf,
34 uint32_t& dest_size) { 34 uint32_t& dest_size) {
35 if (m_Cipher == FXCIPHER_NONE) { 35 if (m_Cipher == FXCIPHER_NONE) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 return TRUE; 333 return TRUE;
334 } 334 }
335 CPDF_StandardCryptoHandler::CPDF_StandardCryptoHandler() { 335 CPDF_StandardCryptoHandler::CPDF_StandardCryptoHandler() {
336 m_pAESContext = NULL; 336 m_pAESContext = NULL;
337 m_Cipher = FXCIPHER_NONE; 337 m_Cipher = FXCIPHER_NONE;
338 m_KeyLen = 0; 338 m_KeyLen = 0;
339 } 339 }
340 CPDF_StandardCryptoHandler::~CPDF_StandardCryptoHandler() { 340 CPDF_StandardCryptoHandler::~CPDF_StandardCryptoHandler() {
341 FX_Free(m_pAESContext); 341 FX_Free(m_pAESContext);
342 } 342 }
OLDNEW
« no previous file with comments | « no previous file | core/fxcodec/codec/fx_codec_png.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698