1. 04 12月, 2017 2 次提交
    • M
      Replace some usage of SSLerr with SSLfatal() · 4752c5de
      Matt Caswell 提交于
      This is an initial step towards using SSLfatal() everywhere. Initially in
      this commit and in subsequent commits we focus on the state machine code.
      Reviewed-by: NRichard Levitte <levitte@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/4778)
      4752c5de
    • M
      Provide an SSLfatal() macro · 1f359471
      Matt Caswell 提交于
      Typically if a fatal error occurs three things need to happen:
      
      - Put an error on the error queue
      - Send an alert
      - Put the state machine into the error state
      
      Although all 3 of these things need to be done every time we hit a fatal
      error the responsibilities for doing this are distributed throughout the
      code. The place where the error goes on the queue, where the alert gets
      sent and where the state machine goes into the error state are almost
      invariably different. It has been a common pattern to pass alert codes up
      and down the stack to get the alert information from the point in the code
      where the error is detected to the point in the code where the alert gets
      sent.
      
      This commit provides an SSLfatal() macro (backed by an ossl_statem_fatal
      function) that does all 3 of the above error tasks. This is largely a drop
      in replacement for SSLerr, but takes a couple of extra parameters (the SSL
      object, and an alert code).
      Reviewed-by: NRichard Levitte <levitte@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/4778)
      1f359471
  2. 30 11月, 2017 2 次提交
  3. 28 11月, 2017 1 次提交
  4. 22 11月, 2017 2 次提交
  5. 13 11月, 2017 2 次提交
  6. 12 11月, 2017 1 次提交
  7. 08 11月, 2017 1 次提交
  8. 07 11月, 2017 1 次提交
  9. 06 11月, 2017 1 次提交
  10. 30 10月, 2017 3 次提交
    • B
      Provide SSL_CTX.stats.sess_accept for switched ctxs · 3be08e30
      Benjamin Kaduk 提交于
      We currently increment the SSL_CTX stats.sess_accept field in
      tls_setup_handshake(), which is invoked from the state machine well
      before ClientHello processing would have had a chance to switch
      the SSL_CTX attached to the SSL object due to a provided SNI value.
      However, stats.sess_accept_good is incremented in tls_finish_handshake(),
      and uses the s->ctx.stats field (i.e., the new SSL_CTX that was switched
      to as a result of SNI processing).  This leads to the confusing
      (nonsensical) situation where stats.sess_accept_good is larger than
      stats.sess_accept, as the "sess_accept" value was counted on the
      s->session_ctx.
      
      In order to provide some more useful numbers, increment
      s->ctx.stats.sess_accept after SNI processing if the SNI processing
      changed s->ctx to differ from s->session_ctx.  To preserve the
      property that any given accept is counted only once, make the
      corresponding decrement to s->session_ctx.stats.sess_accept when
      doing so.
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      Reviewed-by: NPaul Dale <paul.dale@oracle.com>
      (Merged from https://github.com/openssl/openssl/pull/4549)
      3be08e30
    • B
      Normalize on session_ctx for stats where possible · 0e6161bc
      Benjamin Kaduk 提交于
      For client SSL objects and before any callbacks have had a chance
      to be called, we can write the stats accesses using the session_ctx,
      which makes sense given that these values are all prefixed with
      "sess_".
      
      For servers after a client_hello or servername callback has been
      called, retain the existing behavior of modifying the statistics
      for the current (non-session) context.  This has some value,
      in that it allows the statistics to be viewed on a per-vhost level.
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      Reviewed-by: NPaul Dale <paul.dale@oracle.com>
      (Merged from https://github.com/openssl/openssl/pull/4549)
      0e6161bc
    • B
      Use atomics for SSL_CTX statistics · 1fcb4e4d
      Benjamin Kaduk 提交于
      It is expected that SSL_CTX objects are shared across threads,
      and as such we are responsible for ensuring coherent data accesses.
      Aligned integer accesses ought to be atomic already on all supported
      architectures, but we can be formally correct.
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      Reviewed-by: NPaul Dale <paul.dale@oracle.com>
      (Merged from https://github.com/openssl/openssl/pull/4549)
      1fcb4e4d
  11. 27 10月, 2017 1 次提交
  12. 25 10月, 2017 1 次提交
  13. 21 10月, 2017 1 次提交
    • K
      Various clean-ups · b2555168
      KaoruToda 提交于
      Add a check for NULL return in t1_lib.c.
          Since return type of ssl_cert_lookup_by_idx is pointer and unify coding
          style, I changed from zero to NULL in ssl_cert.c.
      
      Remove unnecessary space for ++.
      
      Fix incorrect condition
          Expression is always false because 'else if' condition matches previous
          condition.  SInce the next line of 'else if' condition has substituted
          TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2, the 'else if'
          condition should compare with NID_X9_62_characteristic_two_field.
      Reviewed-by: NAndy Polyakov <appro@openssl.org>
      Reviewed-by: NRich Salz <rsalz@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/4562)
      b2555168
  14. 18 10月, 2017 3 次提交
    • K
      Remove parentheses of return. · 26a7d938
      KaoruToda 提交于
      Since return is inconsistent, I removed unnecessary parentheses and
      unified them.
      Reviewed-by: NRich Salz <rsalz@openssl.org>
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/4541)
      26a7d938
    • B
      Add missing RAND_DRBG locking · 2139145b
      Benjamin Kaduk 提交于
      The drbg's lock must be held across calls to RAND_DRBG_generate()
      to prevent simultaneous modification of internal state.
      
      This was observed in practice with simultaneous SSL_new() calls attempting
      to seed the (separate) per-SSL RAND_DRBG instances from the global
      rand_drbg instance; this eventually led to simultaneous calls to
      ctr_BCC_update() attempting to increment drbg->bltmp_pos for their
      respective partial final block, violating the invariant that bltmp_pos < 16.
      The AES operations performed in ctr_BCC_blocks() makes the race window
      quite easy to trigger.  A value of bltmp_pos greater than 16 induces
      catastrophic failure in ctr_BCC_final(), with subtraction overflowing
      and leading to an attempt to memset() to zero a very large range,
      which eventually reaches an unmapped page and segfaults.
      
      Provide the needed locking in get_entropy_from_parent(), as well as
      fixing a similar issue in RAND_priv_bytes().  There is also an
      unlocked call to RAND_DRBG_generate() in ssl_randbytes(), but the
      requisite serialization is already guaranteed by the requirements on
      the application's usage of SSL objects, and no further locking is
      needed for correct behavior.  In that case, leave a comment noting
      the apparent discrepancy and the reason for its safety (at present).
      Reviewed-by: NPaul Dale <paul.dale@oracle.com>
      Reviewed-by: NKurt Roeckx <kurt@roeckx.be>
      Reviewed-by: NRich Salz <rsalz@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/4328)
      2139145b
    • D
      Fix reseeding issues of the public RAND_DRBG · c16de9d8
      Dr. Matthias St. Pierre 提交于
      Reseeding is handled very differently by the classic RAND_METHOD API
      and the new RAND_DRBG api. These differences led to some problems when
      the new RAND_DRBG was made the default OpenSSL RNG. In particular,
      RAND_add() did not work as expected anymore. These issues are discussed
      on the thread '[openssl-dev] Plea for a new public OpenSSL RNG API'
      and in Pull Request #4328. This commit fixes the mentioned issues,
      introducing the following changes:
      
      - Replace the fixed size RAND_BYTES_BUFFER by a new RAND_POOL API which
        facilitates collecting entropy by the get_entropy() callback.
      - Don't use RAND_poll()/RAND_add() for collecting entropy from the
        get_entropy() callback anymore. Instead, replace RAND_poll() by
        RAND_POOL_acquire_entropy().
      - Add a new function rand_drbg_restart() which tries to get the DRBG
        in an instantiated state by all means, regardless of the current
        state (uninstantiated, error, ...) the DRBG is in. If the caller
        provides entropy or additional input, it will be used for reseeding.
      - Restore the original documented behaviour of RAND_add() and RAND_poll()
        (namely to reseed the DRBG immediately) by a new implementation based
        on rand_drbg_restart().
      - Add automatic error recovery from temporary failures of the entropy
        source to RAND_DRBG_generate() using the rand_drbg_restart() function.
      Reviewed-by: NPaul Dale <paul.dale@oracle.com>
      Reviewed-by: NKurt Roeckx <kurt@roeckx.be>
      Reviewed-by: NRich Salz <rsalz@openssl.org>
      Reviewed-by: NBen Kaduk <kaduk@mit.edu>
      (Merged from https://github.com/openssl/openssl/pull/4328)
      c16de9d8
  15. 16 10月, 2017 3 次提交
  16. 12 10月, 2017 1 次提交
  17. 11 10月, 2017 2 次提交
  18. 10 10月, 2017 1 次提交
  19. 09 10月, 2017 1 次提交
  20. 07 10月, 2017 1 次提交
  21. 06 10月, 2017 2 次提交
  22. 04 10月, 2017 2 次提交
  23. 29 9月, 2017 1 次提交
  24. 28 9月, 2017 2 次提交
  25. 26 9月, 2017 2 次提交