summaryrefslogtreecommitdiff
path: root/core/fdrm/crypto/fx_crypt.cpp
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.cpp
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.cpp')
-rw-r--r--core/fdrm/crypto/fx_crypt.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/fdrm/crypto/fx_crypt.cpp b/core/fdrm/crypto/fx_crypt.cpp
index f4ead91d33..f5ebdf09d2 100644
--- a/core/fdrm/crypto/fx_crypt.cpp
+++ b/core/fdrm/crypto/fx_crypt.cpp
@@ -143,11 +143,11 @@ void CRYPT_ArcFourSetup(CRYPT_rc4_context* s,
uint32_t length) {
s->x = 0;
s->y = 0;
- for (int i = 0; i < 256; ++i)
+ for (int i = 0; i < kRC4ContextPermutationLength; ++i)
s->m[i] = i;
int j = 0;
- for (int i = 0; i < 256; ++i) {
+ for (int i = 0; i < kRC4ContextPermutationLength; ++i) {
j = (j + s->m[i] + (length ? key[i % length] : 0)) & 0xFF;
std::swap(s->m[i], s->m[j]);
}