Skip to content
  1. Feb 26, 2019
  2. Feb 25, 2019
    • Richard Levitte's avatar
      Rearrange the inclusion of curve448/curve448_lcl.h · f408e2a3
      Richard Levitte authored
      
      
      The real cause for this change is that test/ec_internal_test.c
      includes ec_lcl.h, and including curve448/curve448_lcl.h from there
      doesn't work so well with compilers who always do inclusions relative
      to the C file being compiled.
      
      Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/8334)
      f408e2a3
    • Matt Caswell's avatar
      Ensure bn_cmp_words can handle the case where n == 0 · df2cb82a
      Matt Caswell authored
      
      
      Thanks to David Benjamin who reported this, performed the analysis and
      suggested the patch. I have incorporated some of his analysis in the
      comments below.
      
      This issue can cause an out-of-bounds read. It is believed that this was
      not reachable until the recent "fixed top" changes. Analysis has so far
      only identified one code path that can encounter this - although it is
      possible that others may be found. The one code path only impacts 1.0.2 in
      certain builds. The fuzzer found a path in RSA where iqmp is too large. If
      the input is all zeros, the RSA CRT logic will multiply a padded zero by
      iqmp. Two mitigating factors:
      
      - Private keys which trip this are invalid (iqmp is not reduced mod p).
      Only systems which take untrusted private keys care.
      - In OpenSSL 1.1.x, there is a check which rejects the oversize iqmp,
      so the bug is only reproducible in 1.0.2 so far.
      
      Fortunately, the bug appears to be relatively harmless. The consequences of
      bn_cmp_word's misbehavior are:
      
      - OpenSSL may crash if the buffers are page-aligned and the previous page is
      non-existent.
      - OpenSSL will incorrectly treat two BN_ULONG buffers as not equal when they
      are equal.
      - Side channel concerns.
      
      The first is indeed a concern and is a DoS bug. The second is fine in this
      context. bn_cmp_word and bn_cmp_part_words are used to compute abs(a0 - a1)
      in Karatsuba. If a0 = a1, it does not matter whether we use a0 - a1 or
      a1 - a0. The third would be worth thinking about, but it is overshadowed
      by the entire Karatsuba implementation not being constant time.
      
      Due to the difficulty of tripping this and the low impact no CVE is felt
      necessary for this issue.
      
      Reviewed-by: default avatarPaul Dale <paul.dale@oracle.com>
      Reviewed-by: default avatarViktor Dukhovni <viktor@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/8326)
      
      (cherry picked from commit 576129cd72ae054d246221f111aabf42b9c6d76d)
      df2cb82a
  3. Feb 20, 2019
    • Nicola Tuveri's avatar
      Clear BN_FLG_CONSTTIME on BN_CTX_get() · e2e69dce
      Nicola Tuveri authored
      
      
      (cherry picked from commit c8147d37ccaaf28c430d3fb45a14af36597e48b8)
      
      Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/8253)
      e2e69dce
    • Billy Brumley's avatar
      SCA hardening for mod. field inversion in EC_GROUP · 48e82c8e
      Billy Brumley authored
      
      
      This commit adds a dedicated function in `EC_METHOD` to access a modular
      field inversion implementation suitable for the specifics of the
      implemented curve, featuring SCA countermeasures.
      
      The new pointer is defined as:
      `int (*field_inv)(const EC_GROUP*, BIGNUM *r, const BIGNUM *a, BN_CTX*)`
      and computes the multiplicative inverse of `a` in the underlying field,
      storing the result in `r`.
      
      Three implementations are included, each including specific SCA
      countermeasures:
        - `ec_GFp_simple_field_inv()`, featuring SCA hardening through
          blinding.
        - `ec_GFp_mont_field_inv()`, featuring SCA hardening through Fermat's
          Little Theorem (FLT) inversion.
        - `ec_GF2m_simple_field_inv()`, that uses `BN_GF2m_mod_inv()` which
          already features SCA hardening through blinding.
      
      From a security point of view, this also helps addressing a leakage
      previously affecting conversions from projective to affine coordinates.
      
      This commit also adds a new error reason code (i.e.,
      `EC_R_CANNOT_INVERT`) to improve consistency between the three
      implementations as all of them could fail for the same reason but
      through different code paths resulting in inconsistent error stack
      states.
      
      Co-authored-by: default avatarNicola Tuveri <nic.tuv@gmail.com>
      
      (cherry picked from commit e0033efc30b0f00476bba8f0fa5512be5dc8a3f1)
      
      Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
      Reviewed-by: default avatarNicola Tuveri <nic.tuv@gmail.com>
      (Merged from https://github.com/openssl/openssl/pull/8262)
      48e82c8e
  4. Feb 19, 2019
  5. Feb 18, 2019
  6. Feb 17, 2019
    • David Benjamin's avatar
      Check for unpaired .cfi_remember_state · 2e826078
      David Benjamin authored
      
      
      Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
      GH: #8109
      (cherry picked from commit e0963310)
      2e826078
    • David Benjamin's avatar
      Fix some CFI issues in x86_64 assembly · 2086edb7
      David Benjamin authored
      
      
      The add/double shortcut in ecp_nistz256-x86_64.pl left one instruction
      point that did not unwind, and the "slow" path in AES_cbc_encrypt was
      not annotated correctly. For the latter, add
      .cfi_{remember,restore}_state support to perlasm.
      
      Next, fill in a bunch of functions that are missing no-op .cfi_startproc
      and .cfi_endproc blocks. libunwind cannot unwind those stack frames
      otherwise.
      
      Finally, work around a bug in libunwind by not encoding rflags. (rflags
      isn't a callee-saved register, so there's not much need to annotate it
      anyway.)
      
      These were found as part of ABI testing work in BoringSSL.
      
      Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
      GH: #8109
      (cherry picked from commit c0e8e500)
      2086edb7
  7. Feb 13, 2019
  8. Feb 11, 2019
  9. Feb 10, 2019
  10. Feb 08, 2019
    • Todd Short's avatar
      Fix d2i_PublicKey() for EC keys · 3dbec21b
      Todd Short authored
      
      
      o2i_ECPublicKey() requires an EC_KEY structure filled with an EC_GROUP.
      
      o2i_ECPublicKey() is called by d2i_PublicKey(). In order to fulfill the
      o2i_ECPublicKey()'s requirement, d2i_PublicKey() needs to be called with
      an EVP_PKEY with an EC_KEY containing an EC_GROUP.
      
      However, the call to EVP_PKEY_set_type() frees any existing key structure
      inside the EVP_PKEY, thus freeing the EC_KEY with the EC_GROUP that
      o2i_ECPublicKey() needs.
      
      This means you can't d2i_PublicKey() for an EC key...
      
      The fix is to check to see if the type is already set appropriately, and
      if so, not call EVP_PKEY_set_type().
      
      Reviewed-by: default avatarPaul Yang <yang.yang@baishancloud.com>
      Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/8168)
      
      (cherry picked from commit 2aa2beb0)
      3dbec21b
  11. Feb 05, 2019
  12. Jan 31, 2019
  13. Jan 29, 2019
  14. Jan 27, 2019
  15. Jan 24, 2019
  16. Jan 21, 2019
  17. Jan 16, 2019
  18. Jan 15, 2019
  19. Jan 07, 2019
  20. Jan 04, 2019
  21. Jan 03, 2019
  22. Dec 31, 2018
  23. Dec 23, 2018
  24. Dec 22, 2018