1. 19 Jul, 2017 2 commits
    • Matt Caswell's avatar
      Fix undefined behaviour in e_aes_cbc_hmac_sha256.c and e_aes_cbc_hmac_sha1.c · 335d0a46
      Matt Caswell authored
      
      
      In TLS mode of operation the padding value "pad" is obtained along with the
      maximum possible padding value "maxpad". If pad > maxpad then the data is
      invalid. However we must continue anyway because this is constant time code.
      
      We calculate the payload length like this:
      
          inp_len = len - (SHA_DIGEST_LENGTH + pad + 1);
      
      However if pad is invalid then inp_len ends up -ve (actually large +ve
      because it is a size_t).
      
      Later we do this:
      
          /* verify HMAC */
          out += inp_len;
          len -= inp_len;
      
      This ends up with "out" pointing before the buffer which is undefined
      behaviour. Next we calculate "p" like this:
      
          unsigned char *p =
              out + len - 1 - maxpad - SHA256_DIGEST_LENGTH;
      
      Because of the "out + len" term the -ve inp_len value is cancelled out
      so "p" points to valid memory (although technically the pointer arithmetic
      is undefined behaviour again).
      
      We only ever then dereference "p" and never "out" directly so there is
      never an invalid read based on the bad pointer - so there is no security
      issue.
      
      This commit fixes the undefined behaviour by ensuring we use maxpad in
      place of pad, if the supplied pad is invalid.
      
      With thanks to Brian Carpenter for reporting this issue.
      
      Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/3832)
      335d0a46
    • Rich Salz's avatar
      Add DRBG random method · 12fb8c3d
      Rich Salz authored
      
      
      Ported from the last FIPS release, with DUAL_EC and SHA1 and the
      self-tests removed.  Since only AES-CTR is supported, other code
      simplifications were done.  Removed the "entropy blocklen" concept.
      
      Moved internal functions to new include/internal/rand.h.
      
      Reviewed-by: default avatarPaul Dale <paul.dale@oracle.com>
      (Merged from https://github.com/openssl/openssl/pull/3789)
      12fb8c3d
  2. 18 Jul, 2017 8 commits
  3. 17 Jul, 2017 5 commits
  4. 16 Jul, 2017 3 commits
  5. 15 Jul, 2017 11 commits
  6. 14 Jul, 2017 5 commits
  7. 13 Jul, 2017 6 commits