1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_INCLUDE_FDRM_FX_CRYPT_H_ 8 #define CORE_INCLUDE_FDRM_FX_CRYPT_H_ 9 10 #include "core/include/fxcrt/fx_system.h" 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 void CRYPT_ArcFourCryptBlock(uint8_t* data, 17 FX_DWORD size, 18 const uint8_t* key, 19 FX_DWORD keylen); 20 void CRYPT_ArcFourSetup(void* context, const uint8_t* key, FX_DWORD length); 21 void CRYPT_ArcFourCrypt(void* context, uint8_t* data, FX_DWORD size); 22 void CRYPT_AESSetKey(void* context, 23 FX_DWORD blocklen, 24 const uint8_t* key, 25 FX_DWORD keylen, 26 FX_BOOL bEncrypt); 27 void CRYPT_AESSetIV(void* context, const uint8_t* iv); 28 void CRYPT_AESDecrypt(void* context, 29 uint8_t* dest, 30 const uint8_t* src, 31 FX_DWORD size); 32 void CRYPT_AESEncrypt(void* context, 33 uint8_t* dest, 34 const uint8_t* src, 35 FX_DWORD size); 36 void CRYPT_MD5Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[16]); 37 void CRYPT_MD5Start(void* context); 38 void CRYPT_MD5Update(void* context, const uint8_t* data, FX_DWORD size); 39 void CRYPT_MD5Finish(void* context, uint8_t digest[16]); 40 void CRYPT_SHA1Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[20]); 41 void CRYPT_SHA1Start(void* context); 42 void CRYPT_SHA1Update(void* context, const uint8_t* data, FX_DWORD size); 43 void CRYPT_SHA1Finish(void* context, uint8_t digest[20]); 44 void CRYPT_SHA256Generate(const uint8_t* data, 45 FX_DWORD size, 46 uint8_t digest[32]); 47 void CRYPT_SHA256Start(void* context); 48 void CRYPT_SHA256Update(void* context, const uint8_t* data, FX_DWORD size); 49 void CRYPT_SHA256Finish(void* context, uint8_t digest[32]); 50 void CRYPT_SHA384Start(void* context); 51 void CRYPT_SHA384Update(void* context, const uint8_t* data, FX_DWORD size); 52 void CRYPT_SHA384Finish(void* context, uint8_t digest[48]); 53 void CRYPT_SHA384Generate(const uint8_t* data, 54 FX_DWORD size, 55 uint8_t digest[48]); 56 void CRYPT_SHA512Start(void* context); 57 void CRYPT_SHA512Update(void* context, const uint8_t* data, FX_DWORD size); 58 void CRYPT_SHA512Finish(void* context, uint8_t digest[64]); 59 void CRYPT_SHA512Generate(const uint8_t* data, 60 FX_DWORD size, 61 uint8_t digest[64]); 62 void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(const uint8_t* pData, 63 FX_DWORD size, 64 uint8_t* data_buf, 65 FX_DWORD& data_len)); 66 67 #ifdef __cplusplus 68 }; 69 #endif 70 71 #endif // CORE_INCLUDE_FDRM_FX_CRYPT_H_ 72