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 "../fxcrt/fx_basic.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 void CRYPT_ArcFourCryptBlock(FX_LPBYTE data, FX_DWORD size, FX_LPCBYTE key, FX_DWORD keylen);
17 void CRYPT_ArcFourSetup(FX_LPVOID context, FX_LPCBYTE key, FX_DWORD length);
18 void CRYPT_ArcFourCrypt(FX_LPVOID context, FX_LPBYTE data, FX_DWORD size);
19 void CRYPT_AESSetKey(FX_LPVOID context, FX_DWORD blocklen, FX_LPCBYTE key, FX_DWORD keylen, FX_BOOL bEncrypt);
20 void CRYPT_AESSetIV(FX_LPVOID context, FX_LPCBYTE iv);
21 void CRYPT_AESDecrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD size);
22 void CRYPT_AESEncrypt(FX_LPVOID context, FX_LPBYTE dest, FX_LPCBYTE src, FX_DWORD size);
23 void CRYPT_MD5Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[16]);
24 void CRYPT_MD5Start(FX_LPVOID context);
25 void CRYPT_MD5Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size);
26 void CRYPT_MD5Finish(FX_LPVOID context, FX_BYTE digest[16]);
27 void CRYPT_SHA1Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[20]);
28 void CRYPT_SHA1Start(FX_LPVOID context);
29 void CRYPT_SHA1Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size);
30 void CRYPT_SHA1Finish(FX_LPVOID context, FX_BYTE digest[20]);
31 void CRYPT_SHA256Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[32]);
32 void CRYPT_SHA256Start(FX_LPVOID context);
33 void CRYPT_SHA256Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size);
34 void CRYPT_SHA256Finish(FX_LPVOID context, FX_BYTE digest[32]);
35 void CRYPT_SHA384Start(FX_LPVOID context);
36 void CRYPT_SHA384Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size);
37 void CRYPT_SHA384Finish(FX_LPVOID context, FX_BYTE digest[48]);
38 void CRYPT_SHA384Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[48]);
39 void CRYPT_SHA512Start(FX_LPVOID context);
40 void CRYPT_SHA512Update(FX_LPVOID context, FX_LPCBYTE data, FX_DWORD size);
41 void CRYPT_SHA512Finish(FX_LPVOID context, FX_BYTE digest[64]);
42 void CRYPT_SHA512Generate(FX_LPCBYTE data, FX_DWORD size, FX_BYTE digest[64]);
43 void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(FX_LPCBYTE pData, FX_DWORD size, FX_LPBYTE data_buf, FX_DWORD& data_len));
44 
45 #ifdef __cplusplus
46 };
47 #endif
48 
49 #endif  // CORE_INCLUDE_FDRM_FX_CRYPT_H_
50