Remove always-false argument from CPDF_CryptoHandler::CryptStream()

Then fold CPDF_CryptoHandler::DecryptStream() into it.

Change-Id: I79389e8e2705639b2dde204b1be3af956888ab6b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/92197
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index 51ddea6..93f7b89 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -142,10 +142,9 @@
   return pContext;
 }
 
-bool CPDF_CryptoHandler::CryptStream(void* context,
-                                     pdfium::span<const uint8_t> source,
-                                     CFX_BinaryBuf& dest_buf,
-                                     bool bEncrypt) {
+bool CPDF_CryptoHandler::DecryptStream(void* context,
+                                       pdfium::span<const uint8_t> source,
+                                       CFX_BinaryBuf& dest_buf) {
   if (!context)
     return false;
 
@@ -161,10 +160,6 @@
     return true;
   }
   AESCryptContext* pContext = static_cast<AESCryptContext*>(context);
-  if (pContext->m_bIV && bEncrypt) {
-    dest_buf.AppendBlock(pContext->m_Block, 16);
-    pContext->m_bIV = false;
-  }
   uint32_t src_off = 0;
   uint32_t src_left = source.size();
   while (true) {
@@ -178,19 +173,14 @@
     src_left -= copy_size;
     pContext->m_BlockOffset += copy_size;
     if (pContext->m_BlockOffset == 16) {
-      if (!bEncrypt && pContext->m_bIV) {
+      if (pContext->m_bIV) {
         CRYPT_AESSetIV(&pContext->m_Context, pContext->m_Block);
         pContext->m_bIV = false;
         pContext->m_BlockOffset = 0;
       } else if (src_off < source.size()) {
         uint8_t block_buf[16];
-        if (bEncrypt) {
-          CRYPT_AESEncrypt(&pContext->m_Context, block_buf, pContext->m_Block,
-                           16);
-        } else {
-          CRYPT_AESDecrypt(&pContext->m_Context, block_buf, pContext->m_Block,
-                           16);
-        }
+        CRYPT_AESDecrypt(&pContext->m_Context, block_buf, pContext->m_Block,
+                         16);
         dest_buf.AppendBlock(block_buf, 16);
         pContext->m_BlockOffset = 0;
       }
@@ -337,12 +327,6 @@
   return true;
 }
 
-bool CPDF_CryptoHandler::DecryptStream(void* context,
-                                       pdfium::span<const uint8_t> source,
-                                       CFX_BinaryBuf& dest_buf) {
-  return CryptStream(context, source, dest_buf, false);
-}
-
 bool CPDF_CryptoHandler::DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) {
   return CryptFinish(context, dest_buf, false);
 }
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.h b/core/fpdfapi/parser/cpdf_crypto_handler.h
index 277f990..59e2e7f 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.h
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.h
@@ -62,10 +62,6 @@
                   pdfium::span<const uint8_t> source,
                   uint8_t* dest_buf,
                   size_t& dest_size) const;
-  bool CryptStream(void* context,
-                   pdfium::span<const uint8_t> source,
-                   CFX_BinaryBuf& dest_buf,
-                   bool bEncrypt);
   bool CryptFinish(void* context, CFX_BinaryBuf& dest_buf, bool bEncrypt);
 
   const size_t m_KeyLen;