1. 24 4月, 2018 1 次提交
  2. 02 2月, 2018 1 次提交
    • D
      Make BN_num_bits_word constant-time. · 972c87df
      David Benjamin 提交于
      (This patch was written by Andy Polyakov. I only wrote the commit
      message. Mistakes in the analysis are my fault.)
      
      BN_num_bits, by way of BN_num_bits_word, currently leaks the
      most-significant word of its argument via branching and memory access
      pattern.
      
      BN_num_bits is called on RSA prime factors in various places. These have
      public bit lengths, but all bits beyond the high bit are secret. This
      fully resolves those cases.
      
      There are a few places where BN_num_bits is called on an input where the
      bit length is also secret. This does *not* fully resolve those cases as
      we still only look at the top word. Today, that is guaranteed to be
      non-zero, but only because of the long-standing bn_correct_top timing
      leak. Once that is fixed, a constant-time BN_num_bits on such inputs
      must count bits on each word.
      
      Instead, those cases should not call BN_num_bits at all. In particular,
      BN_mod_exp_mont_consttime uses the exponent bit width to pick windows,
      but it should be using the maximum bit width. The next patch will fix
      this.
      
      Thanks to Dinghao Wu, Danfeng Zhang, Shuai Wang, Pei Wang, and Xiao Liu
      for reporting this issue.
      Reviewed-by: NPaul Dale <paul.dale@oracle.com>
      Reviewed-by: NRich Salz <rsalz@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/5154)
      972c87df
  3. 19 1月, 2018 1 次提交
  4. 16 1月, 2018 1 次提交
    • M
      Revert BN_copy() flag copy semantics change · 7d461736
      Matt Caswell 提交于
      Commit 9f944291 changed the semantics of BN_copy() to additionally
      copy the BN_FLG_CONSTTIME flag if it is set. This turns out to be
      ill advised as it has unintended consequences. For example calling
      BN_mod_inverse_no_branch() can sometimes return a result with the flag
      set and sometimes not as a result. This can lead to later failures if we
      go down code branches that do not support constant time, but check for
      the presence of the flag.
      
      The original commit was made due to an issue in BN_MOD_CTX_set(). The
      original PR fixed the problem in that function, but it was changed in
      review to fix it in BN_copy() instead. The solution seems to be to revert
      the BN_copy() change and go back to the originally proposed way.
      Reviewed-by: NPaul Dale <paul.dale@oracle.com>
      (Merged from https://github.com/openssl/openssl/pull/5080)
      7d461736
  5. 23 10月, 2017 1 次提交
  6. 18 10月, 2017 1 次提交
  7. 12 10月, 2017 1 次提交
  8. 09 10月, 2017 1 次提交
  9. 27 9月, 2017 1 次提交
  10. 04 3月, 2017 1 次提交
  11. 01 3月, 2017 1 次提交
  12. 06 9月, 2016 1 次提交
  13. 02 8月, 2016 1 次提交
  14. 30 6月, 2016 1 次提交
  15. 11 6月, 2016 1 次提交
  16. 22 5月, 2016 1 次提交
  17. 18 5月, 2016 1 次提交
  18. 03 5月, 2016 1 次提交
  19. 08 4月, 2016 1 次提交
  20. 18 3月, 2016 1 次提交
  21. 06 2月, 2016 1 次提交
  22. 03 2月, 2016 1 次提交
    • D
      New BN functions. · 85a4807f
      Dr. Stephen Henson 提交于
      Add new function BN_bn2binpad() which checks the length of the output
      buffer and pads the result with zeroes if necessary.
      
      New functions BN_bn2lebinpad() and BN_lebin2bn() which use little endian
      format.
      Reviewed-by: NRich Salz <rsalz@openssl.org>
      85a4807f
  23. 29 1月, 2016 1 次提交
  24. 27 1月, 2016 1 次提交
    • R
      Remove /* foo.c */ comments · 34980760
      Rich Salz 提交于
      This was done by the following
              find . -name '*.[ch]' | /tmp/pl
      where /tmp/pl is the following three-line script:
              print unless $. == 1 && m@/\* .*\.[ch] \*/@;
              close ARGV if eof; # Close file to reset $.
      
      And then some hand-editing of other files.
      Reviewed-by: NViktor Dukhovni <viktor@openssl.org>
      34980760
  25. 09 1月, 2016 1 次提交
  26. 08 1月, 2016 1 次提交
  27. 01 12月, 2015 1 次提交
  28. 26 11月, 2015 1 次提交
    • M
      Tighten up BN_with_flags usage and avoid a reachable assert · fd7d2520
      Matt Caswell 提交于
      The function rsa_ossl_mod_exp uses the function BN_with_flags to create a
      temporary copy (local_r1) of a BIGNUM (r1) with modified flags. This
      temporary copy shares some state with the original r1. If the state of r1
      gets updated then local_r1's state will be stale. This was occurring in the
      function so that when local_r1 was freed a call to bn_check_top was made
      which failed an assert due to the stale state. To resolve this we must free
      local_r1 immediately after we have finished using it and not wait until the
      end of the function.
      
      This problem prompted a review of all BN_with_flag usage within the
      codebase. All other usage appears to be correct, although often not
      obviously so. This commit refactors things to make it much clearer for
      these other uses.
      Reviewed-by: NEmilia Käsper <emilia@openssl.org>
      fd7d2520
  29. 10 11月, 2015 1 次提交
  30. 04 9月, 2015 1 次提交
  31. 28 8月, 2015 1 次提交
  32. 26 8月, 2015 1 次提交
  33. 11 8月, 2015 1 次提交
  34. 23 7月, 2015 1 次提交
  35. 24 6月, 2015 1 次提交
  36. 14 5月, 2015 1 次提交
  37. 06 5月, 2015 1 次提交
  38. 05 5月, 2015 1 次提交
    • R
      Use safer sizeof variant in malloc · b4faea50
      Rich Salz 提交于
      For a local variable:
              TYPE *p;
      Allocations like this are "risky":
              p = OPENSSL_malloc(sizeof(TYPE));
      if the type of p changes, and the malloc call isn't updated, you
      could get memory corruption.  Instead do this:
              p = OPENSSL_malloc(sizeof(*p));
      Also fixed a few memset() calls that I noticed while doing this.
      Reviewed-by: NRichard Levitte <levitte@openssl.org>
      b4faea50
  39. 01 5月, 2015 2 次提交