summaryrefslogtreecommitdiff
path: root/core/fdrm/crypto/fx_crypt.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-05-02 18:24:51 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-03 01:47:28 +0000
commitcadb4711bdc9cb99113aad2acdbc47711f065626 (patch)
treedb46f48b48012cab4c88053f6d480b8ade4bad18 /core/fdrm/crypto/fx_crypt.h
parentd7188f7f91a98906743c48f6aa92ad041d4b51b2 (diff)
downloadpdfium-cadb4711bdc9cb99113aad2acdbc47711f065626.tar.xz
Add a unit test for CRYPT_ArcFourSetup().
BUG=chromium:686128 Change-Id: Iad3ebbfd304dc145af2e694818864c4d25ccf99a Reviewed-on: https://pdfium-review.googlesource.com/4793 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fdrm/crypto/fx_crypt.h')
-rw-r--r--core/fdrm/crypto/fx_crypt.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/core/fdrm/crypto/fx_crypt.h b/core/fdrm/crypto/fx_crypt.h
index cfbe119ddb..2b127948f0 100644
--- a/core/fdrm/crypto/fx_crypt.h
+++ b/core/fdrm/crypto/fx_crypt.h
@@ -9,37 +9,38 @@
#include "core/fxcrt/fx_system.h"
-typedef struct {
+constexpr int32_t kRC4ContextPermutationLength = 256;
+struct CRYPT_rc4_context {
int32_t x;
int32_t y;
- int32_t m[256];
-} CRYPT_rc4_context;
+ int32_t m[kRC4ContextPermutationLength];
+};
-typedef struct {
+struct CRYPT_md5_context {
uint32_t total[2];
uint32_t state[4];
uint8_t buffer[64];
-} CRYPT_md5_context;
+};
-typedef struct {
+struct CRYPT_sha1_context {
unsigned int h[5];
unsigned char block[64];
int blkused;
unsigned int lenhi;
unsigned int lenlo;
-} CRYPT_sha1_context;
+};
-typedef struct {
+struct CRYPT_sha256_context {
uint32_t total[2];
uint32_t state[8];
uint8_t buffer[64];
-} CRYPT_sha256_context;
+};
-typedef struct {
+struct CRYPT_sha384_context {
uint64_t total[2];
uint64_t state[8];
uint8_t buffer[128];
-} CRYPT_sha384_context;
+};
void CRYPT_ArcFourCryptBlock(uint8_t* data,
uint32_t size,