1. 07 Sep, 2019 1 commit
    • Billy Brumley's avatar
      [crypto/ec] for ECC parameters with NULL or zero cofactor, compute it · 30c22fa8
      Billy Brumley authored
      
      
      The cofactor argument to EC_GROUP_set_generator is optional, and SCA
      mitigations for ECC currently use it. So the library currently falls
      back to very old SCA-vulnerable code if the cofactor is not present.
      
      This PR allows EC_GROUP_set_generator to compute the cofactor for all
      curves of cryptographic interest. Steering scalar multiplication to more
      SCA-robust code.
      
      This issue affects persisted private keys in explicit parameter form,
      where the (optional) cofactor field is zero or absent.
      
      It also affects curves not built-in to the library, but constructed
      programatically with explicit parameters, then calling
      EC_GROUP_set_generator with a nonsensical value (NULL, zero).
      
      The very old scalar multiplication code is known to be vulnerable to
      local uarch attacks, outside of the OpenSSL threat model. New results
      suggest the code path is also vulnerable to traditional wall clock
      timing attacks.
      
      CVE-2019-1547
      
      Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
      Reviewed-by: default avatarTomas Mraz <tmraz@fedoraproject.org>
      Reviewed-by: default avatarNicola Tuveri <nic.tuv@gmail.com>
      (Merged from https://github.com/openssl/openssl/pull/9781)
      30c22fa8
  2. 06 Sep, 2019 10 commits
  3. 05 Sep, 2019 3 commits
  4. 04 Sep, 2019 4 commits
  5. 30 Aug, 2019 1 commit
  6. 29 Aug, 2019 2 commits
  7. 27 Aug, 2019 1 commit
  8. 24 Aug, 2019 1 commit
  9. 23 Aug, 2019 1 commit
    • Richard Levitte's avatar
      test/evp_test.c: distinguish parsing errors from processing errors · 738da3d0
      Richard Levitte authored
      
      
      Parsing functions are at liberty to return:
      
      1:  when parsing on processing of the parsed value succeeded
      0:  when the parsed keyword is unknown
      -1: when the parsed value processing failed
      
      Some parsing functions didn't do this quite right, they returned 0
      when they should have returned -1, causing a message like this:
      
          Line 123: unknown keyword PeerKey
      
      When this message (which is displayed when the parsing function
      returns -1) would have been more appropriate:
      
          Line 123: error processing keyword PeerKey = ffdhe2048-2-pub
      
      Reviewed-by: default avatarTomas Mraz <tmraz@fedoraproject.org>
      (Merged from https://github.com/openssl/openssl/pull/9682)
      
      (cherry picked from commit f42c225d7f9a0bce0bf46103343402d3f0ad742f)
      738da3d0
  10. 22 Aug, 2019 1 commit
    • Richard Levitte's avatar
      openssl dgst, openssl enc: check for end of input · 8be96f23
      Richard Levitte authored
      
      
      The input reading loop in 'openssl dgst' and 'openssl enc' doesn't
      check for end of input, and because of the way BIO works, it thereby
      won't detect that the end is reached before the read is an error.
      With the FILE BIO, an error occurs when trying to read past EOF, which
      is fairly much ok, except when the command is used interactively, at
      least on Unix.  The result in that case is that the user has to press
      Ctrl-D twice for the command to terminate.
      
      The issue is further complicated because both these commands use
      filter BIOs on top of the FILE BIO, so a naïve attempt to check
      BIO_eof() doesn't quite solve it, since that only checks the state of
      the source/sink BIO, and the filter BIO may have some buffered data
      that still needs to be read.  Fortunately, there's BIO_pending() that
      checks exactly that, if any filter BIO has pending data that needs to
      be processed.
      
      We end up having to check both BIO_pending() and BIO_eof().
      
      Thanks to Zsigmond Lőrinczy for the initial effort and inspiration.
      
      Fixes #9355
      
      Reviewed-by: default avatarTomas Mraz <tmraz@fedoraproject.org>
      (Merged from https://github.com/openssl/openssl/pull/9668)
      
      (cherry picked from commit 8ed7bbb411d2a9e0edef928958ad955e0be3d6dd)
      8be96f23
  11. 20 Aug, 2019 2 commits
    • Johannes's avatar
      Correct documented return value for BIO_get_mem_data() · 378d53ec
      Johannes authored
      
      
      CLA: trivial
      
      Reviewed-by: default avatarPaul Dale <paul.dale@oracle.com>
      Reviewed-by: default avatarTomas Mraz <tmraz@fedoraproject.org>
      (Merged from https://github.com/openssl/openssl/pull/9643)
      
      (cherry picked from commit 797a5b7af9d9bbfbcbff4607c10ad5c5595ac785)
      378d53ec
    • Pauli's avatar
      Start up DEVRANDOM entropy improvement for older Linux devices. · 3ff98f55
      Pauli authored
      
      
      Improve handling of low entropy at start up from /dev/urandom by waiting for
      a read(2) call on /dev/random to succeed.  Once one such call has succeeded,
      a shared memory segment is created and persisted as an indicator to other
      processes that /dev/urandom is properly seeded.
      
      This does not fully prevent against attacks weakening the entropy source.
      An attacker who has control of the machine early in its boot sequence
      could create the shared memory segment preventing detection of low entropy
      conditions.  However, this is no worse than the current situation.
      
      An attacker would also be capable of removing the shared memory segment
      and causing seeding to reoccur resulting in a denial of service attack.
      This is partially mitigated by keeping the shared memory alive for the
      duration of the process's existence.  Thus, an attacker would not only need
      to have called call shmctl(2) with the IPC_RMID command but the system
      must subsequently enter a state where no instances of libcrypto exist in
      any process.  Even one long running process will prevent this attack.
      
      The System V shared memory calls used here go back at least as far as
      Linux kernel 2.0.  Linux kernels 4.8 and later, don't have a reliable way
      to detect that /dev/urandom has been properly seeded, so a failure is raised
      for this case (i.e. the getentropy(2) call has already failed).
      
      Reviewed-by: default avatarBernd Edlinger <bernd.edlinger@hotmail.de>
      (Merged from https://github.com/openssl/openssl/pull/9595)
      
      [manual merge]
      3ff98f55
  12. 19 Aug, 2019 4 commits
  13. 18 Aug, 2019 3 commits
  14. 17 Aug, 2019 1 commit
  15. 15 Aug, 2019 3 commits
  16. 14 Aug, 2019 2 commits
    • Matt Caswell's avatar
      Extend tests of SSL_check_chain() · 57a3af94
      Matt Caswell authored
      
      
      Actually supply a chain and then test:
      1) A successful check of both the ee and chain certs
      2) A failure to check the ee cert
      3) A failure to check a chain cert
      
      Reviewed-by: default avatarTomas Mraz <tmraz@fedoraproject.org>
      (Merged from https://github.com/openssl/openssl/pull/9443)
      57a3af94
    • Matt Caswell's avatar
      Fix SSL_check_chain() · 604ba265
      Matt Caswell authored
      
      
      The function SSL_check_chain() can be used by applications to check that
      a cert and chain is compatible with the negotiated parameters. This could
      be useful (for example) from the certificate callback. Unfortunately this
      function was applying TLSv1.2 sig algs rules and did not work correctly if
      TLSv1.3 was negotiated.
      
      We refactor tls_choose_sigalg to split it up and create a new function
      find_sig_alg which can (optionally) take a certificate and key as
      parameters and find an appropriate sig alg if one exists. If the cert and
      key are not supplied then we try to find a cert and key from the ones we
      have available that matches the shared sig algs.
      
      Reviewed-by: default avatarTomas Mraz <tmraz@fedoraproject.org>
      (Merged from https://github.com/openssl/openssl/pull/9443)
      604ba265