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/fdrm/crypto/fx_crypt.h" | 7 #include "core/fdrm/crypto/fx_crypt.h" |
8 | 8 |
9 #ifdef __cplusplus | 9 #ifdef __cplusplus |
10 extern "C" { | 10 extern "C" { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 PUT_UINT32(ctx->state[3], digest, 12); | 238 PUT_UINT32(ctx->state[3], digest, 12); |
239 } | 239 } |
240 void CRYPT_MD5Generate(const uint8_t* input, | 240 void CRYPT_MD5Generate(const uint8_t* input, |
241 uint32_t length, | 241 uint32_t length, |
242 uint8_t digest[16]) { | 242 uint8_t digest[16]) { |
243 md5_context ctx; | 243 md5_context ctx; |
244 CRYPT_MD5Start(&ctx); | 244 CRYPT_MD5Start(&ctx); |
245 CRYPT_MD5Update(&ctx, input, length); | 245 CRYPT_MD5Update(&ctx, input, length); |
246 CRYPT_MD5Finish(&ctx, digest); | 246 CRYPT_MD5Finish(&ctx, digest); |
247 } | 247 } |
248 static FX_BOOL (*g_PubKeyDecryptor)(const uint8_t* pData, | 248 static bool (*g_PubKeyDecryptor)(const uint8_t* pData, |
249 uint32_t size, | 249 uint32_t size, |
250 uint8_t* data_buf, | 250 uint8_t* data_buf, |
251 uint32_t& data_len) = nullptr; | 251 uint32_t& data_len) = nullptr; |
252 void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(const uint8_t* pData, | 252 void CRYPT_SetPubKeyDecryptor(bool (*func)(const uint8_t* pData, |
253 uint32_t size, | 253 uint32_t size, |
254 uint8_t* data_buf, | 254 uint8_t* data_buf, |
255 uint32_t& data_len)) { | 255 uint32_t& data_len)) { |
256 g_PubKeyDecryptor = func; | 256 g_PubKeyDecryptor = func; |
257 } | 257 } |
258 #ifdef __cplusplus | 258 #ifdef __cplusplus |
259 }; | 259 }; |
260 #endif | 260 #endif |
OLD | NEW |