OLD | NEW |
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_crypto_handler.h" | 7 #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" |
8 | 8 |
9 #include <time.h> | 9 #include <time.h> |
10 | 10 |
11 #include "core/fdrm/crypto/fx_crypt.h" | 11 #include "core/fdrm/crypto/fx_crypt.h" |
| 12 #include "core/fpdfapi/fpdf_parser/cpdf_parser.h" |
12 #include "core/fpdfapi/fpdf_parser/cpdf_security_handler.h" | 13 #include "core/fpdfapi/fpdf_parser/cpdf_security_handler.h" |
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" | 14 #include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" |
14 #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" | |
15 | 15 |
16 void CPDF_CryptoHandler::CryptBlock(FX_BOOL bEncrypt, | 16 void CPDF_CryptoHandler::CryptBlock(FX_BOOL bEncrypt, |
17 uint32_t objnum, | 17 uint32_t objnum, |
18 uint32_t gennum, | 18 uint32_t gennum, |
19 const uint8_t* src_buf, | 19 const uint8_t* src_buf, |
20 uint32_t src_size, | 20 uint32_t src_size, |
21 uint8_t* dest_buf, | 21 uint8_t* dest_buf, |
22 uint32_t& dest_size) { | 22 uint32_t& dest_size) { |
23 if (m_Cipher == FXCIPHER_NONE) { | 23 if (m_Cipher == FXCIPHER_NONE) { |
24 FXSYS_memcpy(dest_buf, src_buf, src_size); | 24 FXSYS_memcpy(dest_buf, src_buf, src_size); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 void CPDF_CryptoHandler::PopulateKey(uint32_t objnum, | 333 void CPDF_CryptoHandler::PopulateKey(uint32_t objnum, |
334 uint32_t gennum, | 334 uint32_t gennum, |
335 uint8_t* key) { | 335 uint8_t* key) { |
336 FXSYS_memcpy(key, m_EncryptKey, m_KeyLen); | 336 FXSYS_memcpy(key, m_EncryptKey, m_KeyLen); |
337 key[m_KeyLen + 0] = (uint8_t)objnum; | 337 key[m_KeyLen + 0] = (uint8_t)objnum; |
338 key[m_KeyLen + 1] = (uint8_t)(objnum >> 8); | 338 key[m_KeyLen + 1] = (uint8_t)(objnum >> 8); |
339 key[m_KeyLen + 2] = (uint8_t)(objnum >> 16); | 339 key[m_KeyLen + 2] = (uint8_t)(objnum >> 16); |
340 key[m_KeyLen + 3] = (uint8_t)gennum; | 340 key[m_KeyLen + 3] = (uint8_t)gennum; |
341 key[m_KeyLen + 4] = (uint8_t)(gennum >> 8); | 341 key[m_KeyLen + 4] = (uint8_t)(gennum >> 8); |
342 } | 342 } |
OLD | NEW |