1. 14 3月, 2020 1 次提交
    • B
      Code to thread-safety in ChangeCipherState · 44bad9cb
      Benjamin Kaduk 提交于
      The server-side ChangeCipherState processing stores the new cipher
      in the SSL_SESSION object, so that the new state can be used if
      this session gets resumed.  However, writing to the session is only
      thread-safe for initial handshakes, as at other times the session
      object may be in a shared cache and in use by another thread at the
      same time.  Reflect this invariant in the code by only writing to
      s->session->cipher when it is currently NULL (we do not cache sessions
      with no cipher).  The code prior to this change would never actually
      change the (non-NULL) cipher value in a session object, since our
      server enforces that (pre-TLS-1.3) resumptions use the exact same
      cipher as the initial connection, and non-abbreviated renegotiations
      have produced a new session object before we get to this point.
      Regardless, include logic to detect such a condition and abort the
      handshake if it occurs, to avoid any risk of inadvertently using
      the wrong cipher on a connection.
      Reviewed-by: NTomas Mraz <tmraz@fedoraproject.org>
      (Merged from https://github.com/openssl/openssl/pull/10943)
      
      (cherry picked from commit 2e3ec2e1578977fca830a47fd7f521e290540e6d)
      44bad9cb
  2. 21 2月, 2020 1 次提交
  3. 15 2月, 2020 1 次提交
  4. 07 2月, 2020 1 次提交
  5. 15 12月, 2019 1 次提交
  6. 31 7月, 2019 1 次提交
  7. 23 7月, 2019 1 次提交
  8. 08 7月, 2019 1 次提交
  9. 01 7月, 2019 1 次提交
  10. 24 6月, 2019 1 次提交
  11. 03 6月, 2019 1 次提交
    • S
      Add the content type attribute to additional CMS signerinfo. · d63d841f
      Shane Lontis 提交于
      Fixes #8923
      
      Found using the openssl cms -resign option.
      This uses an alternate path to do the signing which was not adding the required signed attribute
      content type. The content type attribute should always exist since it is required is there are
      any signed attributes.
      As the signing time attribute is always added in code, the content type attribute is also required.
      The CMS_si_check_attributes() method adds validity checks for signed and unsigned attributes
      e.g. The message digest attribute is a signed attribute that must exist if any signed attributes
      exist, it cannot be an unsigned attribute and there must only be one instance containing a single
      value.
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/8944)
      
      (cherry picked from commit 19e512a8244a6f527d0194339a8f9fc45468537a)
      d63d841f
  12. 26 2月, 2019 1 次提交
  13. 21 2月, 2019 1 次提交
    • B
      SCA hardening for mod. field inversion in EC_GROUP · 48e82c8e
      Billy Brumley 提交于
      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: NNicola Tuveri <nic.tuv@gmail.com>
      
      (cherry picked from commit e0033efc30b0f00476bba8f0fa5512be5dc8a3f1)
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      Reviewed-by: NNicola Tuveri <nic.tuv@gmail.com>
      (Merged from https://github.com/openssl/openssl/pull/8262)
      48e82c8e
  14. 19 2月, 2019 1 次提交
  15. 10 12月, 2018 1 次提交
  16. 17 10月, 2018 1 次提交
    • D
      DRBG: fix reseeding via RAND_add()/RAND_seed() with large input · dbf0a496
      Dr. Matthias St. Pierre 提交于
      In pull request #4328 the seeding of the DRBG via RAND_add()/RAND_seed()
      was implemented by buffering the data in a random pool where it is
      picked up later by the rand_drbg_get_entropy() callback. This buffer
      was limited to the size of 4096 bytes.
      
      When a larger input was added via RAND_add() or RAND_seed() to the DRBG,
      the reseeding failed, but the error returned by the DRBG was ignored
      by the two calling functions, which both don't return an error code.
      As a consequence, the data provided by the application was effectively
      ignored.
      
      This commit fixes the problem by a more efficient implementation which
      does not copy the data in memory and by raising the buffer the size limit
      to INT32_MAX (2 gigabytes). This is less than the NIST limit of 2^35 bits
      but it was chosen intentionally to avoid platform dependent problems
      like integer sizes and/or signed/unsigned conversion.
      
      Additionally, the DRBG is now less permissive on errors: In addition to
      pushing a message to the openssl error stack, it enters the error state,
      which forces a reinstantiation on next call.
      
      Thanks go to Dr. Falko Strenzke for reporting this issue to the
      openssl-security mailing list. After internal discussion the issue
      has been categorized as not being security relevant, because the DRBG
      reseeds automatically and is fully functional even without additional
      randomness provided by the application.
      
      Fixes #7381
      Reviewed-by: NPaul Dale <paul.dale@oracle.com>
      (Merged from https://github.com/openssl/openssl/pull/7382)
      
      (cherry picked from commit 3064b55134434a0b2850f07eff57120f35bb269a)
      dbf0a496
  17. 07 9月, 2018 3 次提交
  18. 11 8月, 2018 1 次提交
  19. 31 7月, 2018 1 次提交
  20. 20 7月, 2018 1 次提交
  21. 16 7月, 2018 3 次提交
    • N
      EC2M Lopez-Dahab ladder: use it also for ECDSA verify · 01ad66f8
      Nicola Tuveri 提交于
      By default `ec_scalar_mul_ladder` (which uses the Lopez-Dahab ladder
      implementation) is used only for (k * Generator) or (k * VariablePoint).
      ECDSA verification uses (a * Generator + b * VariablePoint): this commit
      forces the use of `ec_scalar_mul_ladder` also for the ECDSA verification
      path, while using the default wNAF implementation for any other case.
      
      With this commit `ec_scalar_mul_ladder` loses the static attribute, and
      is added to ec_lcl.h so EC_METHODs can directly use it.
      
      While working on a new custom EC_POINTs_mul implementation, I realized
      that many checks (e.g. all the points being compatible with the given
      EC_GROUP, creating a temporary BN_CTX if `ctx == NULL`, check for the
      corner case `scalar == NULL && num == 0`) were duplicated again and
      again in every single implementation (and actually some
      implementations lacked some of the tests).
      I thought that it makes way more sense for those checks that are
      independent from the actual implementation and should always be done, to
      be moved in the EC_POINTs_mul wrapper: so this commit also includes
      these changes.
      Reviewed-by: NAndy Polyakov <appro@openssl.org>
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/6690)
      01ad66f8
    • N
      EC2M Lopez-Dahab ladder implementation · f45846f5
      Nicola Tuveri 提交于
      This commit uses the new ladder scaffold to implement a specialized
      ladder step based on differential addition-and-doubling in mixed
      Lopez-Dahab projective coordinates, modified to independently blind the
      operands.
      
      The arithmetic in `ladder_pre`, `ladder_step` and `ladder_post` is
      auto generated with tooling:
      - see, e.g., "Guide to ECC" Alg 3.40 for reference about the
        `ladder_pre` implementation;
      - see https://www.hyperelliptic.org/EFD/g12o/auto-code/shortw/xz/ladder/mladd-2003-s.op3
        for the differential addition-and-doubling formulas implemented in
        `ladder_step`;
      - see, e.g., "Fast Multiplication on Elliptic Curves over GF(2**m)
        without Precomputation" (Lopez and Dahab, CHES 1999) Appendix Alg Mxy
        for the `ladder_post` implementation to recover the `(x,y)` result in
        affine coordinates.
      Co-authored-by: NBilly Brumley <bbrumley@gmail.com>
      Co-authored-by: NSohaib ul Hassan <soh.19.hassan@gmail.com>
      Reviewed-by: NAndy Polyakov <appro@openssl.org>
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/6690)
      f45846f5
    • N
      EC point multiplication: add `ladder` scaffold · 37124360
      Nicola Tuveri 提交于
      for specialized Montgomery ladder implementations
      
      PR #6009 and #6070 replaced the default EC point multiplication path for
      prime and binary curves with a unified Montgomery ladder implementation
      with various timing attack defenses (for the common paths when a secret
      scalar is feed to the point multiplication).
      The newly introduced default implementation directly used
      EC_POINT_add/dbl in the main loop.
      
      The scaffolding introduced by this commit allows EC_METHODs to define a
      specialized `ladder_step` function to improve performances by taking
      advantage of efficient formulas for differential addition-and-doubling
      and different coordinate systems.
      
      - `ladder_pre` is executed before the main loop of the ladder: by
        default it copies the input point P into S, and doubles it into R.
        Specialized implementations could, e.g., use this hook to transition
        to different coordinate systems before copying and doubling;
      - `ladder_step` is the core of the Montgomery ladder loop: by default it
        computes `S := R+S; R := 2R;`, but specific implementations could,
        e.g., implement a more efficient formula for differential
        addition-and-doubling;
      - `ladder_post` is executed after the Montgomery ladder loop: by default
        it's a noop, but specialized implementations could, e.g., use this
        hook to transition back from the coordinate system used for optimizing
        the differential addition-and-doubling or recover the y coordinate of
        the result point.
      
      This commit also renames `ec_mul_consttime` to `ec_scalar_mul_ladder`,
      as it better corresponds to what this function does: nothing can be
      truly said about the constant-timeness of the overall execution of this
      function, given that the underlying operations are not necessarily
      constant-time themselves.
      What this implementation ensures is that the same fixed sequence of
      operations is executed for each scalar multiplication (for a given
      EC_GROUP), with no dependency on the value of the input scalar.
      Co-authored-by: NSohaib ul Hassan <soh.19.hassan@gmail.com>
      Co-authored-by: NBilly Brumley <bbrumley@gmail.com>
      Reviewed-by: NAndy Polyakov <appro@openssl.org>
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/6690)
      37124360
  22. 11 7月, 2018 1 次提交
  23. 27 6月, 2018 2 次提交
  24. 19 6月, 2018 3 次提交
  25. 18 6月, 2018 2 次提交
  26. 08 6月, 2018 1 次提交
  27. 04 6月, 2018 4 次提交
  28. 30 5月, 2018 1 次提交
  29. 25 5月, 2018 1 次提交