Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
fx_crypt.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
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_FDRM_FX_CRYPT_H_
8#define CORE_FDRM_FX_CRYPT_H_
9
10#include <stdint.h>
11
12#include "third_party/base/containers/span.h"
13
15 static constexpr int32_t kPermutationLength = 256;
16
17 int32_t x;
18 int32_t y;
20};
21
23 static constexpr int kMaxNb = 8;
24 static constexpr int kMaxNr = 14;
25 static constexpr int kSchedSize = (kMaxNr + 1) * kMaxNb;
26
27 int Nb;
28 int Nr;
29 unsigned int keysched[kSchedSize];
30 unsigned int invkeysched[kSchedSize];
31 unsigned int iv[kMaxNb];
32};
33
35 uint32_t total[2];
36 uint32_t state[4];
37 uint8_t buffer[64];
38};
39
41 uint64_t total_bytes;
42 uint32_t blkused; // Constrained to [0, 64).
43 uint32_t h[5];
44 uint8_t block[64];
45};
46
48 uint64_t total_bytes;
49 uint64_t state[8];
50 uint8_t buffer[128];
51};
52
53void CRYPT_ArcFourCryptBlock(pdfium::span<uint8_t> data,
54 pdfium::span<const uint8_t> key);
56 pdfium::span<const uint8_t> key);
57void CRYPT_ArcFourCrypt(CRYPT_rc4_context* context, pdfium::span<uint8_t> data);
58
60 const uint8_t* key,
61 uint32_t keylen);
62void CRYPT_AESSetIV(CRYPT_aes_context* context, const uint8_t* iv);
64 uint8_t* dest,
65 const uint8_t* src,
66 uint32_t size);
68 uint8_t* dest,
69 const uint8_t* src,
70 uint32_t size);
71
74 pdfium::span<const uint8_t> data);
75void CRYPT_MD5Finish(CRYPT_md5_context* context, uint8_t digest[16]);
76void CRYPT_MD5Generate(pdfium::span<const uint8_t> data, uint8_t digest[16]);
77
80 const uint8_t* data,
81 uint32_t size);
82void CRYPT_SHA1Finish(CRYPT_sha1_context* context, uint8_t digest[20]);
83void CRYPT_SHA1Generate(const uint8_t* data, uint32_t size, uint8_t digest[20]);
84
87 const uint8_t* data,
88 uint32_t size);
89void CRYPT_SHA256Finish(CRYPT_sha2_context* context, uint8_t digest[32]);
90void CRYPT_SHA256Generate(const uint8_t* data,
91 uint32_t size,
92 uint8_t digest[32]);
93
96 const uint8_t* data,
97 uint32_t size);
98void CRYPT_SHA384Finish(CRYPT_sha2_context* context, uint8_t digest[48]);
99void CRYPT_SHA384Generate(const uint8_t* data,
100 uint32_t size,
101 uint8_t digest[48]);
102
105 const uint8_t* data,
106 uint32_t size);
107void CRYPT_SHA512Finish(CRYPT_sha2_context* context, uint8_t digest[64]);
108void CRYPT_SHA512Generate(const uint8_t* data,
109 uint32_t size,
110 uint8_t digest[64]);
111
112#endif // CORE_FDRM_FX_CRYPT_H_
void CRYPT_MD5Finish(CRYPT_md5_context *context, uint8_t digest[16])
Definition fx_crypt.cpp:214
#define P(a, b, c, d, k, s, t)
#define GET_UINT32(n, b, i)
Definition fx_crypt.cpp:13
#define S(x, n)
void CRYPT_ArcFourCryptBlock(pdfium::span< uint8_t > data, pdfium::span< const uint8_t > key)
Definition fx_crypt.cpp:169
void CRYPT_ArcFourSetup(CRYPT_rc4_context *context, pdfium::span< const uint8_t > key)
Definition fx_crypt.cpp:143
void CRYPT_MD5Update(CRYPT_md5_context *context, pdfium::span< const uint8_t > data)
Definition fx_crypt.cpp:187
#define PUT_UINT32(n, b, i)
Definition fx_crypt.cpp:20
void CRYPT_ArcFourCrypt(CRYPT_rc4_context *context, pdfium::span< uint8_t > data)
Definition fx_crypt.cpp:158
CRYPT_md5_context CRYPT_MD5Start()
Definition fx_crypt.cpp:176
void CRYPT_MD5Generate(pdfium::span< const uint8_t > data, uint8_t digest[16])
Definition fx_crypt.cpp:228
void CRYPT_SHA1Finish(CRYPT_sha1_context *context, uint8_t digest[20])
void CRYPT_SHA384Finish(CRYPT_sha2_context *context, uint8_t digest[48])
void CRYPT_SHA512Update(CRYPT_sha2_context *context, const uint8_t *data, uint32_t size)
void CRYPT_SHA1Generate(const uint8_t *data, uint32_t size, uint8_t digest[20])
void CRYPT_SHA256Generate(const uint8_t *data, uint32_t size, uint8_t digest[32])
void CRYPT_SHA384Start(CRYPT_sha2_context *context)
void CRYPT_SHA512Generate(const uint8_t *data, uint32_t size, uint8_t digest[64])
void CRYPT_SHA512Finish(CRYPT_sha2_context *context, uint8_t digest[64])
void CRYPT_SHA256Update(CRYPT_sha2_context *context, const uint8_t *data, uint32_t size)
void CRYPT_SHA1Update(CRYPT_sha1_context *context, const uint8_t *data, uint32_t size)
void CRYPT_SHA384Update(CRYPT_sha2_context *context, const uint8_t *data, uint32_t size)
void CRYPT_SHA512Start(CRYPT_sha2_context *context)
void CRYPT_SHA256Finish(CRYPT_sha2_context *context, uint8_t digest[32])
void CRYPT_SHA256Start(CRYPT_sha2_context *context)
void CRYPT_SHA1Start(CRYPT_sha1_context *context)
void CRYPT_SHA384Generate(const uint8_t *data, uint32_t size, uint8_t digest[48])
void CRYPT_AESSetIV(CRYPT_aes_context *context, const uint8_t *iv)
void CRYPT_AESEncrypt(CRYPT_aes_context *context, uint8_t *dest, const uint8_t *src, uint32_t size)
void CRYPT_AESSetKey(CRYPT_aes_context *context, const uint8_t *key, uint32_t keylen)
void CRYPT_AESDecrypt(CRYPT_aes_context *context, uint8_t *dest, const uint8_t *src, uint32_t size)
unsigned int iv[kMaxNb]
Definition fx_crypt.h:31
unsigned int keysched[kSchedSize]
Definition fx_crypt.h:29
static constexpr int kMaxNr
Definition fx_crypt.h:24
unsigned int invkeysched[kSchedSize]
Definition fx_crypt.h:30
static constexpr int kSchedSize
Definition fx_crypt.h:25
static constexpr int kMaxNb
Definition fx_crypt.h:23
uint8_t buffer[64]
Definition fx_crypt.h:37
uint32_t state[4]
Definition fx_crypt.h:36
uint32_t total[2]
Definition fx_crypt.h:35
static constexpr int32_t kPermutationLength
Definition fx_crypt.h:15
int32_t m[kPermutationLength]
Definition fx_crypt.h:19
uint64_t total_bytes
Definition fx_crypt.h:41
uint8_t block[64]
Definition fx_crypt.h:44
uint32_t h[5]
Definition fx_crypt.h:43
uint32_t blkused
Definition fx_crypt.h:42
uint64_t state[8]
Definition fx_crypt.h:49
uint64_t total_bytes
Definition fx_crypt.h:48
uint8_t buffer[128]
Definition fx_crypt.h:50