From bf1dbab139072296360e6ed3610870f8ea4155d7 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Tue, 20 Nov 2018 16:59:38 +0800 Subject: use the original MT19937 code --- source/pdf/pdf-crypt.c | 85 -------------------------------------------------- 1 file changed, 85 deletions(-) diff --git a/source/pdf/pdf-crypt.c b/source/pdf/pdf-crypt.c index 5341bff7..b5a96c1b 100644 --- a/source/pdf/pdf-crypt.c +++ b/source/pdf/pdf-crypt.c @@ -15,65 +15,6 @@ typedef struct static void fcn_40c060(mt19937 *ctx) { - uint32_t eax, ecx, edx; - ecx = 227; - uint32_t *edi_ptr = &ctx->MT[624]; - - do { - edx = edi_ptr[1]; - edi_ptr++; - edx ^= edi_ptr[-1]; - edx &= 0x7fffffff; - edx ^= edi_ptr[-1]; - eax = edx & 1; - if (eax) - eax = 0x9908b0df; - else - eax = 0; - edx >>= 1; - eax ^= edi_ptr[396]; - eax ^= edx; - edi_ptr[-625] = eax; - ecx--; - } while (ecx); - - uint32_t *esi = ctx->MT[851]; - - int edi = 396; - do { - uint32_t ecx = esi[0]; - esi++; - ecx ^= esi[0]; - ecx &= 0x7fffffff; - ecx ^= esi[-1]; - uint32_t eax = ecx & 1; - if (eax) { - eax = 0x9908b0df; - } else { - eax = 0; - } - ecx >>= 1; - eax ^= esi[-852]; - eax ^= ecx; - esi[-625] = eax; - edi--; - } while (edi); - - ecx = ctx->MT[1247] ^ ctx->MT[0]; - ecx &= 0x7fffffff; - ecx ^= ctx->MT[1247]; - eax = ecx & 1; - if (eax) { - eax = 0x9908b0df; - } else { - eax = 0; - } - ecx >>= 1; - eax ^= ctx->MT[396]; - eax ^= ecx; - ctx->MT[623] = eax; - ctx->n = edi; -#if 0 uint32_t *edi = &ctx->MT[624]; uint32_t eax, ecx, edx; @@ -111,35 +52,10 @@ static void fcn_40c060(mt19937 *ctx) ecx >>= 1; ctx->MT[623] = eax ^ ctx->MT[396] ^ ecx; ctx->n = 0; -#endif } static void fcn_40c120(mt19937* ctx) { - uint32_t * eax = &ctx->MT[1]; - uint32_t esi = 624; - uint32_t ecx, edx; - - do { - edx = eax[-1]; - eax++; - edx ^= eax[-1]; - edx &= 0x7fffffff; - edx ^= eax[-2]; - ecx = edx & 1; - if (ecx) { - ecx = 0x9908b0df; - } else { - ecx = 0; - } - edx >>= 1; - ecx ^= eax[395]; - ecx ^= edx; - eax[622] = ecx; - esi--; - } while (esi); - -#if 0 uint32_t *mt = ctx->MT; uint32_t ecx, edx; @@ -158,7 +74,6 @@ static void fcn_40c120(mt19937* ctx) mt[i + 624] = ecx; } -#endif } uint32_t mt19937_next(mt19937 *ctx) -- cgit v1.2.3