1. Dec 06, 2020
    • Alexei A. Smekalkine's avatar
      gost_crypt: process full available block in CFB and CNT mode · cf402dd4
      Alexei A. Smekalkine authored
      If at the input of the encryption function in the CFB mode we have
      an integer number of blocks, then in the main loop all blocks will be
      processed, except for the last one due to an incorrect border check.
      The last block will be fully processed as a "partial" remainder, but
      the initialization vector will not be updated. And, thus, the value
      of IV will always be incorrect in this case.
      
      This breaks stateless protocols due to an invalid initialization vector:
      all messages except the first cannot be decrypted. (Naturally, we are
      talking about a case with disabled key meshing, which does not allow
      context recovery due to an erroneous implementation.)
      
      It is worth noting here that the code for processing partial blocks
      (both at the input of the encryption functions and at the output) is
      a historically unnecessary artifact, since we do not set the
      EVP_CIPH_FLAG_CUSTOM_CIPHER flag and, as a result, OpenSSL processes
      partial blocks for us.
      
      This patch corrects the checking of the main loop boundary.
      
      A similar error is present in the code for the CNT mode, but there it
      does not manifest itself in any way, because the restoration of the
      state in this mode is impossible: even after disabling key meshing, we
      still have the state-dependent transformation of the IV.
      
      As an extra result of this fix, the code for processing partial blocks
      can be completely removed now.
      cf402dd4
  2. May 19, 2020
  3. May 10, 2020
  4. Jul 07, 2019
  5. May 18, 2019
  6. Mar 23, 2019
  7. Dec 08, 2018
  8. Nov 25, 2018
  9. Aug 24, 2018
  10. Aug 22, 2018
  11. Aug 21, 2018
  12. Aug 20, 2018
  13. Mar 15, 2018
  14. Aug 28, 2017
  15. Aug 18, 2017
  16. Jul 04, 2017