Changeset ac3f500 in mod_gnutls


Ignore:
Timestamp:
Jun 18, 2016, 2:58:28 PM (18 months ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
master, debian, upstream
Children:
ef06c74
Parents:
87d507b
git-author:
Thomas Klute <thomas2.klute@…> (06/18/16 14:53:10)
git-committer:
Thomas Klute <thomas2.klute@…> (06/18/16 14:58:28)
Message:

Compatibility code for GnuTLS version < 3.4

  • gnutls_memset() is not available.
  • GNUTLS_MAX_SESSION_ID_SIZE is undefined. GNUTLS_MAX_SESSION_ID serves the same purpose, but the name is less intuitive.
Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_cache.c

    r0831437 rac3f500  
    7070#define MC_TAG "mod_gnutls:"
    7171/* two characters per byte, plus one more for '\0' */
     72#if GNUTLS_VERSION_NUMBER >= 0x030400
    7273#define GNUTLS_SESSION_ID_STRING_LEN ((GNUTLS_MAX_SESSION_ID_SIZE * 2) + 1)
     74#else
     75#define GNUTLS_SESSION_ID_STRING_LEN ((GNUTLS_MAX_SESSION_ID * 2) + 1)
     76#endif
    7377
    7478#if MODULE_MAGIC_NUMBER_MAJOR < 20081201
  • src/gnutls_hooks.c

    r87d507b rac3f500  
    6161{
    6262    /* Free session ticket master key */
     63#if GNUTLS_VERSION_NUMBER >= 0x030400
    6364    gnutls_memset(session_ticket_key.data, 0, session_ticket_key.size);
     65#endif
    6466    gnutls_free(session_ticket_key.data);
    6567    session_ticket_key.data = NULL;
  • src/gnutls_io.c

    rb2e6406 rac3f500  
    2323#ifdef APLOG_USE_MODULE
    2424APLOG_USE_MODULE(gnutls);
     25#endif
     26
     27#if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__)
     28#include <inttypes.h>
    2529#endif
    2630
     
    565569         * small for 32 or 64 bit to matter, but we have to make
    566570         * sure. */
     571#if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__)
     572        if ((apr_size_t) readbytes < len)
     573        {
     574            /* If readbytes is negative the function fails in the
     575             * check above, but the compiler doesn't get that. */
     576            if (__builtin_expect(imaxabs(readbytes) > SIZE_MAX, 0))
     577            {
     578                ap_log_cerror(APLOG_MARK, APLOG_CRIT, APR_EINVAL, ctxt->c,
     579                              "%s: prevented buffer length overflow",
     580                              __func__);
     581                return APR_EINVAL;
     582            }
     583            len = (apr_size_t) readbytes;
     584        }
     585#else
    567586        if ((apr_size_t) readbytes < len
    568587            && __builtin_add_overflow(readbytes, 0, &len))
     
    573592            return APR_EINVAL;
    574593        }
     594#endif
    575595        status =
    576596                gnutls_io_input_read(ctxt, ctxt->input_buffer, &len);
Note: See TracChangeset for help on using the changeset viewer.