Ignore:
Timestamp:
Jun 22, 2021, 9:00:19 PM (3 years ago)
Author:
coas-nagasima
Message:

WolfSSLとAzure IoT SDKを更新

Location:
azure_iot_hub_f767zi/trunk/wolfssl-4.7.0
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • azure_iot_hub_f767zi/trunk/wolfssl-4.7.0/wolfssl/internal.h

    r457 r464  
    7373    #include <wolfssl/wolfcrypt/sha256.h>
    7474#endif
     75#if defined(WOLFSSL_SHA384)
     76    #include <wolfssl/wolfcrypt/sha512.h>
     77#endif
    7578#ifdef HAVE_OCSP
    7679    #include <wolfssl/ocsp.h>
     
    111114#ifdef HAVE_CURVE448
    112115    #include <wolfssl/wolfcrypt/curve448.h>
     116#endif
     117#ifndef WOLFSSL_NO_DEF_TICKET_ENC_CB
     118    #if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) && \
     119        !defined(WOLFSSL_TICKET_ENC_AES128_GCM) && \
     120        !defined(WOLFSSL_TICKET_ENC_AES256_GCM)
     121        #include <wolfssl/wolfcrypt/chacha20_poly1305.h>
     122    #else
     123        #include <wolfssl/wolfcrypt/aes.h>
     124    #endif
    113125#endif
    114126
     
    143155    /* do nothing, just don't pick Unix */
    144156#elif defined(FREERTOS) || defined(FREERTOS_TCP) || defined(WOLFSSL_SAFERTOS)
     157    /* do nothing */
     158#elif defined(RTTHREAD)
    145159    /* do nothing */
    146160#elif defined(EBSNET)
     
    184198#else
    185199    #ifndef SINGLE_THREADED
    186         #define WOLFSSL_PTHREADS
    187         #include <pthread.h>
     200        #if defined(WOLFSSL_LINUXKM)
     201            #define WOLFSSL_KTHREADS
     202            #include <linux/kthread.h>
     203        #elif defined(WOLFSSL_USER_MUTEX)
     204            /* do nothing */
     205        #else
     206            #define WOLFSSL_PTHREADS
     207            #include <pthread.h>
     208        #endif
    188209    #endif
    189210    #if defined(OPENSSL_EXTRA) && !defined(NO_FILESYSTEM)
    190         #include <unistd.h>      /* for close of BIO */
     211        #ifdef FUSION_RTOS
     212           #include <fclunistd.h>
     213        #else
     214            #include <unistd.h>      /* for close of BIO */
     215        #endif
    191216    #endif
    192217#endif
     
    859884#if defined(BUILD_TLS_RSA_WITH_AES_128_GCM_SHA256) || \
    860885    defined(BUILD_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256) || \
     886    defined(BUILD_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) || \
    861887    defined(BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) || \
    862888    defined(BUILD_TLS_PSK_WITH_AES_128_GCM_SHA256) || \
     
    864890    defined(BUILD_TLS_RSA_WITH_AES_256_GCM_SHA384) || \
    865891    defined(BUILD_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384) || \
     892    defined(BUILD_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) || \
    866893    defined(BUILD_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384) || \
    867894    defined(BUILD_TLS_PSK_WITH_AES_256_GCM_SHA384) || \
     
    907934#endif
    908935
    909 #if defined(NO_AES) || defined(NO_AES_DECRYPT)
     936#if defined(NO_AES) || !defined(HAVE_AES_DECRYPT)
    910937    #define AES_BLOCK_SIZE 16
    911938    #undef  BUILD_AES
     
    11501177#ifndef WOLFSSL_MAX_DHKEY_BITS
    11511178    #if (defined(USE_FAST_MATH) && defined(FP_MAX_BITS) && FP_MAX_BITS >= 16384)
    1152         #define WOLFSSL_MAX_DHKEY_BITS 8192
     1179        #define WOLFSSL_MAX_DHKEY_BITS (FP_MAX_BITS / 2)
    11531180    #else
    11541181        #define WOLFSSL_MAX_DHKEY_BITS 4096
     
    11661193    /* max psk identity/hint supported */
    11671194    #if defined(WOLFSSL_TLS13)
    1168         #define MAX_PSK_ID_LEN 256
     1195        /* OpenSSL has a 1472 byte sessiont ticket */
     1196        #define MAX_PSK_ID_LEN 1536
    11691197    #else
    11701198        #define MAX_PSK_ID_LEN 128
     
    11751203    /* maximum early data size */
    11761204    #define MAX_EARLY_DATA_SZ  4096
     1205#endif
     1206
     1207#ifndef WOLFSSL_MAX_RSA_BITS
     1208    #if (defined(USE_FAST_MATH) && defined(FP_MAX_BITS) && FP_MAX_BITS >= 16384)
     1209        #define WOLFSSL_MAX_RSA_BITS (FP_MAX_BITS / 2)
     1210    #else
     1211        #define WOLFSSL_MAX_RSA_BITS 4096
     1212    #endif
     1213#endif
     1214#if (WOLFSSL_MAX_RSA_BITS % 8)
     1215    #error RSA maximum bit size must be multiple of 8
    11771216#endif
    11781217
     
    11971236    TLSv1_3_MINOR   = 4,        /* TLSv1_3 minor version number */
    11981237    TLS_DRAFT_MAJOR = 0x7f,     /* Draft TLS major version number */
    1199 #ifdef WOLFSSL_TLS13_DRAFT
    1200 #ifdef WOLFSSL_TLS13_DRAFT_18
    1201     TLS_DRAFT_MINOR = 0x12,     /* Minor version number of TLS draft */
    1202 #elif defined(WOLFSSL_TLS13_DRAFT_22)
    1203     TLS_DRAFT_MINOR = 0x16,     /* Minor version number of TLS draft */
    1204 #elif defined(WOLFSSL_TLS13_DRAFT_23)
    1205     TLS_DRAFT_MINOR = 0x17,     /* Minor version number of TLS draft */
    1206 #elif defined(WOLFSSL_TLS13_DRAFT_26)
    1207     TLS_DRAFT_MINOR = 0x1a,     /* Minor version number of TLS draft */
    1208 #else
    1209     TLS_DRAFT_MINOR = 0x1c,     /* Minor version number of TLS draft */
    1210 #endif
    1211 #endif
    12121238    OLD_HELLO_ID    = 0x01,     /* SSLv2 Client Hello Indicator */
    12131239    INVALID_BYTE    = 0xff,     /* Used to initialize cipher specs values */
     
    12191245                                /* pre RSA and all master */
    12201246#if defined(WOLFSSL_MYSQL_COMPATIBLE) || \
    1221     (defined(USE_FAST_MATH) && defined(FP_MAX_BITS) && FP_MAX_BITS > 8192)
     1247    (defined(USE_FAST_MATH) && defined(FP_MAX_BITS) && FP_MAX_BITS >= 16384)
    12221248#ifndef NO_PSK
    1223     ENCRYPT_LEN     = 1024 + MAX_PSK_ID_LEN + 2,   /* 8192 bit static buffer */
     1249    ENCRYPT_LEN     = (FP_MAX_BITS / 2 / 8) + MAX_PSK_ID_LEN + 2,
    12241250#else
    12251251    ENCRYPT_LEN     = 1024,     /* allow 8192 bit static buffer */
     
    13451371    MAX_SYM_KEY_SIZE    = AES_256_KEY_SIZE,
    13461372#else
    1347     MAX_SYM_KEY_SIZE    = WC_MAX_SYM_KEY_SIZE,
    1348 #endif
    1349 
    1350 #ifdef HAVE_SELFTEST
     1373    #if defined(HAVE_NULL_CIPHER) && defined(WOLFSSL_TLS13)
     1374        #if defined(WOLFSSL_SHA384) && WC_MAX_SYM_KEY_SIZE < 48
     1375            MAX_SYM_KEY_SIZE    = WC_SHA384_DIGEST_SIZE,
     1376        #elif !defined(NO_SHA256) && WC_MAX_SYM_KEY_SIZE < 32
     1377            MAX_SYM_KEY_SIZE    = WC_SHA256_DIGEST_SIZE,
     1378        #else
     1379            MAX_SYM_KEY_SIZE    = WC_MAX_SYM_KEY_SIZE,
     1380        #endif
     1381    #else
     1382        MAX_SYM_KEY_SIZE    = WC_MAX_SYM_KEY_SIZE,
     1383    #endif
     1384#endif
     1385
     1386#if defined(HAVE_SELFTEST) && \
     1387    (!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2))
    13511388    #ifndef WOLFSSL_AES_KEY_SIZE_ENUM
    13521389    #define WOLFSSL_AES_KEY_SIZE_ENUM
     
    14191456
    14201457#ifndef NO_RSA
    1421     MAX_CERT_VERIFY_SZ = 4096 / 8, /* max RSA - default 4096-bits */
     1458    MAX_CERT_VERIFY_SZ = WOLFSSL_MAX_RSA_BITS / 8, /* max RSA bytes */
    14221459#elif defined(HAVE_ECC)
    14231460    MAX_CERT_VERIFY_SZ = ECC_MAX_SIG_SIZE, /* max ECC  */
     
    14921529/* number of items in the signature algo list */
    14931530#ifndef WOLFSSL_MAX_SIGALGO
    1494     #define WOLFSSL_MAX_SIGALGO 32
     1531    #define WOLFSSL_MAX_SIGALGO 36
    14951532#endif
    14961533
     
    15621599#endif
    15631600
     1601#if !defined(WOLFSSL_NO_DEF_TICKET_ENC_CB) && !defined(WOLFSSL_NO_SERVER)
     1602    /* Check chosen encryption is available. */
     1603    #if !(defined(HAVE_CHACHA) && defined(HAVE_POLY1305)) && \
     1604        defined(WOLFSSL_TICKET_ENC_CHACHA20_POLY1305)
     1605        #error "ChaCha20-Poly1305 not availble for default ticket encryption"
     1606    #endif
     1607    #if !defined(HAVE_AESGCM) && (defined(WOLFSSL_TICKET_ENC_AES128_GCM) || \
     1608        defined(WOLFSSL_TICKET_ENC_AES256_GCM))
     1609        #error "AES-GCM not availble for default ticket encryption"
     1610    #endif
     1611
     1612    #ifndef WOLFSSL_TICKET_KEY_LIFETIME
     1613        /* Default lifetime is 1 hour from issue of first ticket with key. */
     1614        #define WOLFSSL_TICKET_KEY_LIFETIME       (60 * 60)
     1615    #endif
     1616    #if WOLFSSL_TICKET_KEY_LIFETIME <= SESSION_TICKET_HINT_DEFAULT
     1617        #error "Ticket Key lifetime must be longer than ticket life hint."
     1618    #endif
     1619#endif
     1620
    15641621
    15651622/* don't use extra 3/4k stack space unless need to */
     
    15801637    SERVER_ENCRYPTED_EXTENSIONS_COMPLETE,
    15811638    SERVER_CERT_COMPLETE,
     1639    SERVER_CERT_VERIFY_COMPLETE,
    15821640    SERVER_KEYEXCHANGE_COMPLETE,
    15831641    SERVER_HELLODONE_COMPLETE,
     
    16121670
    16131671    #ifdef WOLFSSL_SESSION_EXPORT
    1614     WOLFSSL_LOCAL int wolfSSL_dtls_import_internal(WOLFSSL* ssl, byte* buf,
     1672    WOLFSSL_LOCAL int wolfSSL_dtls_import_internal(WOLFSSL* ssl, const byte* buf,
    16151673                                                                     word32 sz);
    16161674    WOLFSSL_LOCAL int wolfSSL_dtls_export_internal(WOLFSSL* ssl, byte* buf,
     
    16191677                                                          byte* buf, word32 sz);
    16201678    WOLFSSL_LOCAL int wolfSSL_dtls_import_state_internal(WOLFSSL* ssl,
    1621                                                           byte* buf, word32 sz);
     1679                                                    const byte* buf, word32 sz);
    16221680    WOLFSSL_LOCAL int wolfSSL_send_session(WOLFSSL* ssl);
    16231681    #endif
     
    16471705WOLFSSL_LOCAL int DoFinished(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
    16481706                            word32 size, word32 totalSz, int sniff);
     1707#ifdef WOLFSSL_TLS13
     1708WOLFSSL_LOCAL int DoTls13Finished(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
     1709                           word32 size, word32 totalSz, int sniff);
     1710#endif
    16491711WOLFSSL_LOCAL int DoApplicationData(WOLFSSL* ssl, byte* input, word32* inOutIdx);
    16501712/* TLS v1.3 needs these */
     
    16661728WOLFSSL_LOCAL int  PickHashSigAlgo(WOLFSSL* ssl, const byte* hashSigAlgo,
    16671729                                   word32 hashSigAlgoSz);
     1730#ifdef WOLF_CRYPTO_CB
     1731WOLFSSL_LOCAL int  CreateDevPrivateKey(void** pkey, byte* buffer, word32 length,
     1732                                       int hsType, int label, int id,
     1733                                       void* heap, int devId);
     1734#endif
    16681735WOLFSSL_LOCAL int  DecodePrivateKey(WOLFSSL *ssl, word16* length);
    16691736#ifdef HAVE_PK_CALLBACKS
     
    16781745WOLFSSL_LOCAL int  MatchDomainName(const char* pattern, int len, const char* str);
    16791746#ifndef NO_CERTS
    1680 WOLFSSL_LOCAL int  CheckAltNames(DecodedCert* dCert, char* domain);
    1681 #ifdef OPENSSL_EXTRA
    1682 WOLFSSL_LOCAL int  CheckIPAddr(DecodedCert* dCert, char* ipasc);
    1683 #endif
     1747WOLFSSL_LOCAL int  CheckForAltNames(DecodedCert* dCert, const char* domain, int* checkCN);
     1748WOLFSSL_LOCAL int  CheckIPAddr(DecodedCert* dCert, const char* ipasc);
    16841749#endif
    16851750WOLFSSL_LOCAL int  CreateTicket(WOLFSSL* ssl);
    1686 WOLFSSL_LOCAL int  HashOutputRaw(WOLFSSL* ssl, const byte* output, int sz);
     1751WOLFSSL_LOCAL int  HashRaw(WOLFSSL* ssl, const byte* output, int sz);
    16871752WOLFSSL_LOCAL int  HashOutput(WOLFSSL* ssl, const byte* output, int sz,
    16881753                              int ivSz);
    16891754WOLFSSL_LOCAL int  HashInput(WOLFSSL* ssl, const byte* input, int sz);
    1690 #if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
     1755
     1756#ifdef HAVE_SNI
     1757#ifndef NO_WOLFSSL_SERVER
    16911758WOLFSSL_LOCAL int SNI_Callback(WOLFSSL* ssl);
     1759#endif
    16921760#endif
    16931761#ifdef WOLFSSL_TLS13
     
    17021770                                     word32* inOutIdx, word32 helloSz,
    17031771                                     byte* extMsgType);
     1772WOLFSSL_LOCAL int RestartHandshakeHash(WOLFSSL* ssl);
    17041773#endif
    17051774int TimingPadVerify(WOLFSSL* ssl, const byte* input, int padLen, int t,
     
    18301899#define MAX_DESCRIPTION_SZ 255
    18311900#endif
    1832 /* wolfSSL Cipher type just points back to SSL */
    18331901struct WOLFSSL_CIPHER {
    18341902    byte cipherSuite0;
    18351903    byte cipherSuite;
    1836     WOLFSSL* ssl;
     1904    const WOLFSSL* ssl;
    18371905#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
    18381906    char description[MAX_DESCRIPTION_SZ];
     
    19742042    VerifyCallback  verifyCallback;      /* Verify callback */
    19752043#endif
    1976     CallbackCACache caCacheCallback;     /* CA cache addition callback */
    1977     CbMissingCRL    cbMissingCRL;        /* notify through cb of missing crl */
    1978     CbOCSPIO        ocspIOCb;            /* I/O callback for OCSP lookup */
    1979     CbOCSPRespFree  ocspRespFreeCb;      /* Frees OCSP Response from IO Cb */
    1980     wolfSSL_Mutex   caLock;              /* CA list lock */
    1981     byte            crlEnabled;          /* is CRL on ? */
    1982     byte            crlCheckAll;         /* always leaf, but all ? */
    1983     byte            ocspEnabled;         /* is OCSP on ? */
    1984     byte            ocspCheckAll;        /* always leaf, but all ? */
    1985     byte            ocspSendNonce;       /* send the OCSP nonce ? */
    1986     byte            ocspUseOverrideURL;  /* ignore cert's responder, override */
    1987     byte            ocspStaplingEnabled; /* is OCSP Stapling on ? */
     2044    CallbackCACache caCacheCallback;       /* CA cache addition callback */
     2045    CbMissingCRL    cbMissingCRL;          /* notify thru cb of missing crl */
     2046    CbOCSPIO        ocspIOCb;              /* I/O callback for OCSP lookup */
     2047    CbOCSPRespFree  ocspRespFreeCb;        /* Frees OCSP Response from IO Cb */
     2048    wolfSSL_Mutex   caLock;                /* CA list lock */
     2049    byte            crlEnabled:1;          /* is CRL on ? */
     2050    byte            crlCheckAll:1;         /* always leaf, but all ? */
     2051    byte            ocspEnabled:1;         /* is OCSP on ? */
     2052    byte            ocspCheckAll:1;        /* always leaf, but all ? */
     2053    byte            ocspSendNonce:1;       /* send the OCSP nonce ? */
     2054    byte            ocspUseOverrideURL:1;  /* ignore cert responder, override */
     2055    byte            ocspStaplingEnabled:1; /* is OCSP Stapling on ? */
     2056#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
     2057||  defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
     2058    byte            ocspMustStaple:1;      /* server must respond with staple */
     2059#endif
    19882060
    19892061#ifndef NO_RSA
     
    19932065    short           minEccKeySz;         /* minimum allowed ECC key size */
    19942066#endif
     2067    wolfSSL_Mutex   refMutex;   /* reference count mutex */
     2068    int             refCount;         /* reference count */
    19952069};
    19962070
     
    20052079
    20062080#ifndef NO_CERTS
    2007 #if !defined NOCERTS &&\
    2008     (!defined(NO_WOLFSSL_CLIENT) || !defined(WOLFSSL_NO_CLIENT_AUTH))
     2081#if !defined(NO_WOLFSSL_CLIENT) || !defined(WOLFSSL_NO_CLIENT_AUTH)
    20092082typedef struct ProcPeerCertArgs {
    20102083    buffer*      certs;
     
    21222195#endif
    21232196#ifdef WOLFSSL_RENESAS_TSIP_TLS
    2124     byte tsip_client_write_MAC_secret[TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE];
    2125     byte tsip_server_write_MAC_secret[TSIP_TLS_HMAC_KEY_INDEX_WORDSIZE];
     2197
     2198    tsip_hmac_sha_key_index_t tsip_client_write_MAC_secret;
     2199    tsip_hmac_sha_key_index_t tsip_server_write_MAC_secret;
     2200
    21262201#endif
    21272202} Keys;
     
    21332208
    21342209typedef enum {
     2210#ifdef HAVE_SNI
    21352211    TLSX_SERVER_NAME                = 0x0000, /* a.k.a. SNI  */
     2212#endif
    21362213    TLSX_MAX_FRAGMENT_LENGTH        = 0x0001,
    21372214    TLSX_TRUSTED_CA_KEYS            = 0x0003,
     
    21402217    TLSX_SUPPORTED_GROUPS           = 0x000a, /* a.k.a. Supported Curves */
    21412218    TLSX_EC_POINT_FORMATS           = 0x000b,
    2142 #if !defined(WOLFSSL_NO_SIGALG)
    2143     TLSX_SIGNATURE_ALGORITHMS       = 0x000d,
     2219#if !defined(NO_CERTS) && !defined(WOLFSSL_NO_SIGALG)
     2220    TLSX_SIGNATURE_ALGORITHMS       = 0x000d, /* HELLO_EXT_SIG_ALGO */
    21442221#endif
    21452222    TLSX_APPLICATION_LAYER_PROTOCOL = 0x0010, /* a.k.a. ALPN */
     
    21482225    TLSX_ENCRYPT_THEN_MAC           = 0x0016, /* RFC 7366 */
    21492226#endif
     2227    TLSX_EXTENDED_MASTER_SECRET     = 0x0017, /* HELLO_EXT_EXTMS */
    21502228    TLSX_QUANTUM_SAFE_HYBRID        = 0x0018, /* a.k.a. QSH  */
    21512229    TLSX_SESSION_TICKET             = 0x0023,
     
    21582236    #endif
    21592237    TLSX_SUPPORTED_VERSIONS         = 0x002b,
     2238    #ifdef WOLFSSL_SEND_HRR_COOKIE
    21602239    TLSX_COOKIE                     = 0x002c,
     2240    #endif
    21612241    #if defined(HAVE_SESSION_TICKET) || !defined(NO_PSK)
    21622242    TLSX_PSK_KEY_EXCHANGE_MODES     = 0x002d,
     
    21652245    TLSX_POST_HANDSHAKE_AUTH        = 0x0031,
    21662246    #endif
    2167     #if defined(WOLFSSL_TLS13_DRAFT_18) || defined(WOLFSSL_TLS13_DRAFT_22)
    2168     TLSX_KEY_SHARE                  = 0x0028,
    2169     #else
     2247    #if !defined(NO_CERTS) && !defined(WOLFSSL_NO_SIGALG)
    21702248    TLSX_SIGNATURE_ALGORITHMS_CERT  = 0x0032,
     2249    #endif
    21712250    TLSX_KEY_SHARE                  = 0x0033,
    2172     #endif
    21732251#endif
    21742252    TLSX_RENEGOTIATION_INFO         = 0xff01
     
    23122390        OcspRequest ocsp;
    23132391    } request;
    2314 #if defined(WOLFSSL_TLS13) && !defined(NO_WOLFSSL_SERVER)
     2392#if defined(WOLFSSL_TLS13)
    23152393    buffer response;
    23162394#endif
     
    24292507} SessionTicket;
    24302508
     2509#if !defined(WOLFSSL_NO_DEF_TICKET_ENC_CB) && !defined(WOLFSSL_NO_SERVER)
     2510
     2511/* Data passed to default SessionTicket enc/dec callback. */
     2512typedef struct TicketEncCbCtx {
     2513    /* Name for this context. */
     2514    byte name[WOLFSSL_TICKET_NAME_SZ];
     2515    /* Current keys - current and next. */
     2516    byte key[2][WOLFSSL_TICKET_KEY_SZ];
     2517    /* Expirary date of keys. */
     2518    word32 expirary[2];
     2519    /* Random number generator to use for generating name, keys and IV. */
     2520    WC_RNG rng;
     2521#ifndef SINGLE_THREADED
     2522    /* Mutex for access to changing keys. */
     2523    wolfSSL_Mutex mutex;
     2524#endif
     2525    /* Pointer back to SSL_CTX. */
     2526    WOLFSSL_CTX* ctx;
     2527} TicketEncCbCtx;
     2528
     2529#endif /* !WOLFSSL_NO_DEF_TICKET_ENC_CB && !WOLFSSL_NO_SERVER */
     2530
    24312531WOLFSSL_LOCAL int  TLSX_UseSessionTicket(TLSX** extensions,
    24322532                                             SessionTicket* ticket, void* heap);
     
    25122612
    25132613#if defined(HAVE_SESSION_TICKET) || !defined(NO_PSK)
    2514 #ifndef WOLFSSL_TLS13_DRAFT_18
    25152614/* Ticket nonce - for deriving PSK.
    25162615 * Length allowed to be: 1..255. Only support 4 bytes.
     
    25202619    byte data[MAX_TICKET_NONCE_SZ];
    25212620} TicketNonce;
    2522 #endif
    25232621
    25242622/* The PreSharedKey extension information - entry in a linked list. */
     
    25762674};
    25772675
     2676WOLFSSL_LOCAL int DeriveEarlySecret(WOLFSSL* ssl);
     2677WOLFSSL_LOCAL int DeriveHandshakeSecret(WOLFSSL* ssl);
     2678WOLFSSL_LOCAL int DeriveTls13Keys(WOLFSSL* ssl, int secret, int side, int store);
     2679WOLFSSL_LOCAL int DeriveMasterSecret(WOLFSSL* ssl);
     2680WOLFSSL_LOCAL int DeriveResumptionPSK(WOLFSSL* ssl, byte* nonce, byte nonceLen, byte* secret);
     2681WOLFSSL_LOCAL int DeriveResumptionSecret(WOLFSSL* ssl, byte* key);
     2682
     2683WOLFSSL_LOCAL int Tls13_Exporter(WOLFSSL* ssl, unsigned char *out, size_t outLen,
     2684        const char *label, size_t labelLen,
     2685        const unsigned char *context, size_t contextLen);
     2686
    25782687/* The key update request values for KeyUpdate message. */
    25792688enum KeyUpdateRequest {
     
    25922701#endif
    25932702
     2703#ifdef WOLFSSL_STATIC_EPHEMERAL
     2704/* contains static ephemeral keys */
     2705typedef struct {
     2706#ifndef NO_DH
     2707    DerBuffer* dhKey;
     2708#endif
     2709#ifdef HAVE_ECC
     2710    DerBuffer* ecKey;
     2711#endif
     2712} StaticKeyExchangeInfo_t;
     2713#endif
     2714
     2715
    25942716/* wolfSSL context type */
    25952717struct WOLFSSL_CTX {
     
    26092731    DerBuffer*  certChain;
    26102732                 /* chain after self, in DER, with leading size for each cert */
    2611     #if defined(OPENSSL_EXTRA) || defined(WOLFSSL_EXTRA)
     2733    #if defined(OPENSSL_EXTRA) || defined(WOLFSSL_EXTRA) || defined(HAVE_LIGHTY)
    26122734    WOLF_STACK_OF(WOLFSSL_X509_NAME)* ca_names;
    26132735    #endif
     
    26212743#endif
    26222744    DerBuffer*  privateKey;
    2623     byte        privateKeyType:7;
     2745    byte        privateKeyType:6;
    26242746    byte        privateKeyId:1;
     2747    byte        privateKeyLabel:1;
    26252748    int         privateKeySz;
    26262749    int         privateKeyDevId;
     
    26562779    byte        haveEMS:1;        /* have extended master secret extension */
    26572780    byte        useClientOrder:1; /* Use client's cipher preference order */
     2781#if defined(HAVE_SESSION_TICKET)
     2782    byte        noTicketTls12:1;  /* TLS 1.2 server won't send ticket */
     2783#endif
    26582784#ifdef WOLFSSL_TLS13
    2659     byte        noTicketTls13:1;  /* Server won't create new Ticket */
     2785    byte        noTicketTls13:1;  /* TLS 1.3 Server won't create new Ticket */
    26602786    byte        noPskDheKe:1;     /* Don't use (EC)DHE with PSK */
    26612787#endif
     
    27002826    short       minEccKeySz;      /* minimum ECC key size */
    27012827#endif
    2702 #if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
    27032828    unsigned long     mask;             /* store SSL_OP_ flags */
    2704 #endif
    27052829#ifdef OPENSSL_EXTRA
    27062830    byte              sessionCtx[ID_LEN]; /* app session context ID */
     
    27452869    wc_psk_server_tls13_callback server_psk_tls13_cb;  /* server callback */
    27462870#endif
     2871    void*       psk_ctx;
    27472872    char        server_hint[MAX_PSK_ID_LEN + NULL_TERM_LEN];
    27482873#endif /* HAVE_SESSION_TICKET || !NO_PSK */
     
    27612886    void*            passwd_userdata;
    27622887#endif
    2763 #if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
     2888#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(WOLFSSL_WPAS_SMALL)
    27642889    WOLFSSL_X509_STORE x509_store; /* points to ctx->cm */
    27652890    WOLFSSL_X509_STORE* x509_store_pt; /* take ownership of external store */
     
    27702895    WOLFSSL_CRYPTO_EX_DATA ex_data;
    27712896#endif
    2772 #if defined(HAVE_ALPN) && (defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY))
     2897#if defined(HAVE_ALPN) && (defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || defined(HAVE_LIGHTY))
    27732898    CallbackALPNSelect alpnSelect;
    27742899    void*              alpnSelectArg;
    27752900#endif
    2776 #if defined(OPENSSL_ALL) || (defined(OPENSSL_EXTRA) && (defined(HAVE_STUNNEL) || \
    2777                              defined(WOLFSSL_NGINX) || defined(HAVE_LIGHTY) || \
    2778                              defined(WOLFSSL_HAPROXY) || defined(WOLFSSL_OPENSSH) ))
     2901#ifdef HAVE_SNI
    27792902    CallbackSniRecv sniRecvCb;
    27802903    void*           sniRecvCbArg;
     
    28052928        void*              ticketEncCtx;  /* session encrypt context */
    28062929        int                ticketHint;    /* ticket hint in seconds */
     2930        #ifndef WOLFSSL_NO_DEF_TICKET_ENC_CB
     2931            TicketEncCbCtx ticketKeyCtx;
     2932        #endif
    28072933    #endif
    28082934    #ifdef HAVE_SUPPORTED_CURVES
     
    28662992#endif /* HAVE_PK_CALLBACKS */
    28672993#ifdef HAVE_WOLF_EVENT
    2868         WOLF_EVENT_QUEUE event_queue;
     2994    WOLF_EVENT_QUEUE event_queue;
    28692995#endif /* HAVE_WOLF_EVENT */
    28702996#ifdef HAVE_EXT_CACHE
    2871         WOLFSSL_SESSION*(*get_sess_cb)(WOLFSSL*, unsigned char*, int, int*);
    2872         int (*new_sess_cb)(WOLFSSL*, WOLFSSL_SESSION*);
    2873         void (*rem_sess_cb)(WOLFSSL_CTX*, WOLFSSL_SESSION*);
     2997    WOLFSSL_SESSION*(*get_sess_cb)(WOLFSSL*, unsigned char*, int, int*);
     2998    int (*new_sess_cb)(WOLFSSL*, WOLFSSL_SESSION*);
     2999    void (*rem_sess_cb)(WOLFSSL_CTX*, WOLFSSL_SESSION*);
    28743000#endif
    28753001#if defined(OPENSSL_EXTRA) && defined(WOLFCRYPT_HAVE_SRP) && !defined(NO_SHA256)
    2876         Srp*  srp;  /* TLS Secure Remote Password Protocol*/
    2877         byte* srp_password;
     3002    Srp*  srp;  /* TLS Secure Remote Password Protocol*/
     3003    byte* srp_password;
     3004#endif
     3005#ifdef WOLFSSL_STATIC_EPHEMERAL
     3006    StaticKeyExchangeInfo_t staticKE;
    28783007#endif
    28793008};
     
    29403069};
    29413070
    2942 
    29433071/* Supported Authentication Schemes */
    29443072enum SignatureAlgorithm {
     
    29993127#endif
    30003128
     3129#if defined(WOLFSSL_DTLS) && defined(HAVE_SECURE_RENEGOTIATION)
     3130enum CipherSrc {
     3131    KEYS_NOT_SET = 0,
     3132    KEYS,     /* keys from ssl->keys are loaded */
     3133    SCR       /* keys from ssl->secure_renegotiation->tmp_keys are loaded */
     3134};
     3135#endif
    30013136
    30023137/* cipher for now */
     
    30383173    byte    state;
    30393174    byte    setup;       /* have we set it up flag for detection */
     3175#if defined(WOLFSSL_DTLS) && defined(HAVE_SECURE_RENEGOTIATION)
     3176    enum CipherSrc src;  /* DTLS uses this to determine which keys
     3177                          * are currently loaded */
     3178#endif
    30403179} Ciphers;
    30413180
     
    31393278    byte               sessionCtxSz;              /* sessionCtx length        */
    31403279    byte               sessionCtx[ID_LEN];        /* app specific context id  */
     3280    wolfSSL_Mutex      refMutex;                  /* ref count mutex */
     3281    int                refCount;                  /* reference count */
    31413282#endif
    31423283#ifdef WOLFSSL_TLS13
     
    31473288    word32             ticketSeen;                /* Time ticket seen (ms) */
    31483289    word32             ticketAdd;                 /* Added by client */
    3149         #ifndef WOLFSSL_TLS13_DRAFT_18
    31503290    TicketNonce        ticketNonce;               /* Nonce used to derive PSK */
    3151         #endif
    31523291    #endif
    31533292    #ifdef WOLFSSL_EARLY_DATA
     
    31613300    byte               isDynamic;
    31623301#endif
    3163 #ifdef HAVE_EXT_CACHE
     3302#if defined(HAVE_EXT_CACHE) || defined(OPENSSL_EXTRA)
    31643303    byte               isAlloced;
    31653304#endif
     
    31673306    WOLFSSL_CRYPTO_EX_DATA ex_data;
    31683307#endif
     3308    byte               side;                      /* Either WOLFSSL_CLIENT_END or
     3309                                                     WOLFSSL_SERVER_END */
    31693310};
    31703311
    31713312
    3172 WOLFSSL_LOCAL
    3173 WOLFSSL_SESSION* GetSession(WOLFSSL*, byte*, byte);
    3174 WOLFSSL_LOCAL
    3175 int          SetSession(WOLFSSL*, WOLFSSL_SESSION*);
    3176 
    3177 typedef int (*hmacfp) (WOLFSSL*, byte*, const byte*, word32, int, int, int);
     3313WOLFSSL_LOCAL WOLFSSL_SESSION* GetSession(WOLFSSL*, byte*, byte);
     3314WOLFSSL_LOCAL int              SetSession(WOLFSSL*, WOLFSSL_SESSION*);
     3315WOLFSSL_LOCAL void             FreeSession(WOLFSSL_SESSION*, int);
     3316
     3317typedef int (*hmacfp) (WOLFSSL*, byte*, const byte*, word32, int, int, int, int);
    31783318
    31793319#ifndef NO_CLIENT_CACHE
     3320    WOLFSSL_LOCAL
    31803321    WOLFSSL_SESSION* GetSessionClient(WOLFSSL*, const byte*, int);
    31813322#endif
     
    32653406    DerBuffer*      certificate;           /* WOLFSSL_CTX owns, unless we own */
    32663407    DerBuffer*      key;                   /* WOLFSSL_CTX owns, unless we own */
    3267     byte            keyType:7;             /* Type of key: RSA, ECC, Ed25519 */
     3408    byte            keyType:6;             /* Type of key: RSA, ECC, Ed25519 */
    32683409    byte            keyId:1;               /* Key data is an id not data */
     3410    byte            keyLabel:1;            /* Key data is a label not data */
    32693411    int             keySz;                 /* Size of RSA key */
    32703412    int             keyDevId;              /* Device Id for key */
     
    33363478    wc_psk_server_tls13_callback server_psk_tls13_cb;  /* server callback */
    33373479#endif
     3480    void*             psk_ctx;
    33383481#endif /* NO_PSK */
    3339 #if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
     3482#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(WOLFSSL_WPAS_SMALL)
    33403483    unsigned long     mask; /* store SSL_OP_ flags */
    33413484#endif
     
    33993542    word16            useTicket:1;        /* Use Ticket not session cache */
    34003543    word16            rejectTicket:1;     /* Callback rejected ticket */
     3544    word16            noTicketTls12:1;    /* TLS 1.2 server won't send ticket */
    34013545#ifdef WOLFSSL_TLS13
    34023546    word16            noTicketTls13:1;    /* Server won't create new Ticket */
     
    35113655    byte            secret[SECRET_LEN];
    35123656#endif
     3657#ifdef HAVE_KEYING_MATERIAL
     3658    byte            exporterSecret[WC_MAX_DIGEST_SIZE];
     3659#endif
    35133660    byte            masterSecret[SECRET_LEN];
    35143661#if defined(WOLFSSL_RENESAS_TSIP_TLS) && \
     
    35493696    #if defined(OPENSSL_ALL)
    35503697    wolf_sk_compare_cb comp;
     3698    wolf_sk_hash_cb hash_fn;
     3699    unsigned long hash;
    35513700    #endif
    35523701
     
    35603709        WOLFSSL_ACCESS_DESCRIPTION* access;
    35613710        WOLFSSL_X509_EXTENSION* ext;
     3711#ifdef OPENSSL_EXTRA
    35623712        WOLFSSL_CONF_VALUE*    conf;
     3713#endif
    35633714        void*                  generic;
    35643715        char*                  string;
     
    35773728#if (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) && \
    35783729    !defined(NO_ASN)
    3579     DecodedName fullName;
    3580     WOLFSSL_X509_NAME_ENTRY cnEntry;
    3581     WOLFSSL_X509_NAME_ENTRY extra[MAX_NAME_ENTRIES]; /* extra entries added */
     3730    int   entrySz; /* number of entries */
     3731    WOLFSSL_X509_NAME_ENTRY entry[MAX_NAME_ENTRIES]; /* all entries i.e. CN */
    35823732    WOLFSSL_X509*           x509;   /* x509 that struct belongs to */
    35833733#endif /* OPENSSL_EXTRA */
    3584 #if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX)
     3734#if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(HAVE_LIGHTY)
    35853735    byte  raw[ASN_NAME_MAX];
    35863736    int   rawLen;
    35873737#endif
     3738    void* heap;
    35883739};
    35893740
     
    36143765#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL)
    36153766    WOLFSSL_STACK* ext_sk; /* Store X509_EXTENSIONS from wolfSSL_X509_get_ext */
     3767    WOLFSSL_STACK* ext_sk_full; /* Store X509_EXTENSIONS from wolfSSL_X509_get0_extensions */
    36163768    WOLFSSL_STACK* ext_d2i;/* Store d2i extensions from wolfSSL_X509_get_ext_d2i */
    36173769#endif /* WOLFSSL_QT || OPENSSL_ALL */
    3618 #ifdef OPENSSL_EXTRA
     3770#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
    36193771    WOLFSSL_ASN1_INTEGER* serialNumber; /* Stores SN from wolfSSL_X509_get_serialNumber */
    36203772#endif
     
    36833835    byte             authKeyIdSet:1;
    36843836    byte             authKeyIdCrit:1;
     3837    byte             issuerSet:1;
    36853838#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */
     3839#ifdef WOLFSSL_CERT_REQ
     3840    byte             isCSR:1;
     3841#endif
    36863842    byte             serial[EXTERNAL_SERIAL_SIZE];
    36873843    char             subjectCN[ASN_NAME_MAX];        /* common name short cut */
    36883844#ifdef WOLFSSL_CERT_REQ
     3845#ifdef OPENSSL_ALL
     3846    WOLFSSL_X509_ATTRIBUTE* challengePwAttr;
     3847#endif
    36893848    char             challengePw[CTC_NAME_SIZE]; /* for REQ certs */
    36903849#endif
     
    36953854    WOLFSSL_X509_PUBKEY key;
    36963855#endif
    3697     byte issuerSet:1;
     3856#if defined(OPENSSL_ALL) || defined(KEEP_OUR_CERT) || defined(KEEP_PEER_CERT) || \
     3857    defined(SESSION_CERTS)
     3858    byte            notBeforeData[CTC_DATE_SIZE];
     3859    byte            notAfterData[CTC_DATE_SIZE];
     3860#endif
    36983861};
    36993862
     
    37313894    DtlsFrag*       fragList;
    37323895    word32          fragSz;    /* Length of fragments received */
     3896    word16          epoch;     /* Epoch that this message belongs to */
    37333897    word32          seq;       /* Handshake sequence number    */
    37343898    word32          sz;        /* Length of whole message      */
     
    38003964
    38013965
     3966#ifndef WOLFSSL_NO_TLS12
     3967/* Persistable BuildMessage arguments */
     3968typedef struct BuildMsgArgs {
     3969    word32 digestSz;
     3970    word32 sz;
     3971    word32 pad;
     3972    word32 idx;
     3973    word32 headerSz;
     3974    word16 size;
     3975    word32 ivSz;      /* TLSv1.1  IV */
     3976    byte*  iv;
     3977} BuildMsgArgs;
     3978#endif
     3979
    38023980#ifdef WOLFSSL_ASYNC_CRYPT
    38033981    #define MAX_ASYNC_ARGS 18
     
    38083986        FreeArgsCb    freeArgs; /* function pointer to cleanup args */
    38093987        word32        args[MAX_ASYNC_ARGS]; /* holder for current args */
     3988        BuildMsgArgs  buildArgs; /* holder for current BuildMessage args */
    38103989    };
    38113990#endif
     
    39614140    word16          pssAlgo;
    39624141#ifdef WOLFSSL_TLS13
    3963     #if !defined(WOLFSSL_TLS13_DRAFT_18) && !defined(WOLFSSL_TLS13_DRAFT_22)
    39644142    word16          certHashSigAlgoSz;  /* SigAlgoCert ext length in bytes */
    39654143    byte            certHashSigAlgo[WOLFSSL_MAX_SIGALGO]; /* cert sig/algo to
    39664144                                                           * offer */
    3967     #endif /* !WOLFSSL_TLS13_DRAFT_18 && !WOLFSSL_TLS13_DRAFT_22 */
    39684145#endif
    39694146#ifdef HAVE_NTRU
     
    40154192    int             dtls_timeout_max;   /* maximum timeout value */
    40164193    int             dtls_timeout;       /* current timeout value, changes */
     4194#ifndef NO_ASN_TIME
     4195    word32          dtls_start_timeout;
     4196#endif /* !NO_ASN_TIME */
    40174197    word32          dtls_tx_msg_list_sz;
    40184198    word32          dtls_rx_msg_list_sz;
     
    41054285#ifdef HAVE_OCSP
    41064286        void*       ocspIOCtx;
     4287        byte ocspProducedDate[MAX_DATE_SZ];
     4288        int ocspProducedDateFormat;
    41074289    #ifdef OPENSSL_EXTRA
    41084290        byte*       ocspResp;
     
    41924374    WOLFSSL_STACK* peerCertChain;    /* Used in wolfSSL_get_peer_cert_chain */
    41934375#endif
     4376#ifdef WOLFSSL_STATIC_EPHEMERAL
     4377    StaticKeyExchangeInfo_t staticKE;
     4378#endif
     4379#if defined(OPENSSL_ALL) || defined(WOLFSSL_HAPROXY)
     4380    /* Added in libest port: allow applications to get the 'tls-unique' Channel
     4381     * Binding Type (https://tools.ietf.org/html/rfc5929#section-3). This is
     4382     * used in the EST protocol to bind an enrollment to a TLS session through
     4383     * 'proof-of-possession' (https://tools.ietf.org/html/rfc7030#section-3.4
     4384     * and https://tools.ietf.org/html/rfc7030#section-3.5). */
     4385    byte clientFinished[TLS_FINISHED_SZ];
     4386    byte serverFinished[TLS_FINISHED_SZ];
     4387#endif
    41944388};
    41954389
     
    42114405                                WOLFSSL_CRL* crl, int verify);
    42124406
    4213     #ifdef OPENSSL_EXTRA
    4214     WOLFSSL_LOCAL int CheckHostName(DecodedCert* dCert, char *domainName,
     4407    WOLFSSL_LOCAL int CheckHostName(DecodedCert* dCert, const char *domainName,
    42154408                                    size_t domainNameLen);
    4216     #endif
    42174409#endif
    42184410
     
    42994491
    43004492
    4301 static const byte client[SIZEOF_SENDER] = { 0x43, 0x4C, 0x4E, 0x54 };
    4302 static const byte server[SIZEOF_SENDER] = { 0x53, 0x52, 0x56, 0x52 };
     4493static const byte client[SIZEOF_SENDER+1] = { 0x43, 0x4C, 0x4E, 0x54, 0x00 }; /* CLNT */
     4494static const byte server[SIZEOF_SENDER+1] = { 0x53, 0x52, 0x56, 0x52, 0x00 }; /* SRVR */
    43034495
    43044496static const byte tls_client[FINISHED_LABEL_SZ + 1] = "client finished";
     
    43234515WOLFSSL_LOCAL int SendData(WOLFSSL*, const void*, int);
    43244516#ifdef WOLFSSL_TLS13
    4325 #ifdef WOLFSSL_TLS13_DRAFT_18
    4326 WOLFSSL_LOCAL int SendTls13HelloRetryRequest(WOLFSSL*);
    4327 #else
    43284517WOLFSSL_LOCAL int SendTls13ServerHello(WOLFSSL*, byte);
    4329 #endif
    43304518#endif
    43314519WOLFSSL_LOCAL int SendCertificate(WOLFSSL*);
     
    43574545WOLFSSL_LOCAL int IsAtLeastTLSv1_2(const WOLFSSL* ssl);
    43584546WOLFSSL_LOCAL int IsAtLeastTLSv1_3(const ProtocolVersion pv);
     4547WOLFSSL_LOCAL int TLSv1_3_Capable(WOLFSSL* ssl);
    43594548
    43604549WOLFSSL_LOCAL void FreeHandshakeResources(WOLFSSL* ssl);
     
    44544643#ifndef WOLFSSL_AEAD_ONLY
    44554644    WOLFSSL_LOCAL int  TLS_hmac(WOLFSSL* ssl, byte* digest, const byte* in,
    4456                                 word32 sz, int padSz, int content, int verify);
     4645                                word32 sz, int padSz, int content, int verify, int epochOrder);
    44574646#endif
    44584647#endif
     
    44764665    WOLFSSL_LOCAL void DtlsMsgDelete(DtlsMsg*, void*);
    44774666    WOLFSSL_LOCAL void DtlsMsgListDelete(DtlsMsg*, void*);
    4478     WOLFSSL_LOCAL int  DtlsMsgSet(DtlsMsg*, word32, const byte*, byte,
     4667    WOLFSSL_LOCAL void DtlsTxMsgListClean(WOLFSSL* ssl);
     4668    WOLFSSL_LOCAL int  DtlsMsgSet(DtlsMsg*, word32, word16, const byte*, byte,
    44794669                                                       word32, word32, void*);
    4480     WOLFSSL_LOCAL DtlsMsg* DtlsMsgFind(DtlsMsg*, word32);
    4481     WOLFSSL_LOCAL void DtlsMsgStore(WOLFSSL*, word32, const byte*, word32,
     4670    WOLFSSL_LOCAL DtlsMsg* DtlsMsgFind(DtlsMsg*, word32, word32);
     4671    WOLFSSL_LOCAL void DtlsMsgStore(WOLFSSL*, word32, word32, const byte*, word32,
    44824672                                                byte, word32, word32, void*);
    44834673    WOLFSSL_LOCAL DtlsMsg* DtlsMsgInsert(DtlsMsg*, DtlsMsg*);
    44844674
    4485     WOLFSSL_LOCAL int  DtlsMsgPoolSave(WOLFSSL*, const byte*, word32);
     4675    WOLFSSL_LOCAL int  DtlsMsgPoolSave(WOLFSSL*, const byte*, word32, enum HandShakeType);
    44864676    WOLFSSL_LOCAL int  DtlsMsgPoolTimeout(WOLFSSL*);
    44874677    WOLFSSL_LOCAL int  VerifyForDtlsMsgPoolSend(WOLFSSL*, byte, word32);
     4678    WOLFSSL_LOCAL int  VerifyForTxDtlsMsgDelete(WOLFSSL* ssl, DtlsMsg* head);
    44884679    WOLFSSL_LOCAL void DtlsMsgPoolReset(WOLFSSL*);
    44894680    WOLFSSL_LOCAL int  DtlsMsgPoolSend(WOLFSSL*, int);
    44904681#endif /* WOLFSSL_DTLS */
    44914682
    4492 #ifndef NO_TLS
    4493 
    4494 
    4495 #endif /* NO_TLS */
     4683#if defined(HAVE_SECURE_RENEGOTIATION) && defined(WOLFSSL_DTLS)
     4684    WOLFSSL_LOCAL int DtlsSCRKeysSet(WOLFSSL* ssl);
     4685    WOLFSSL_LOCAL int IsDtlsMsgSCRKeys(WOLFSSL* ssl);
     4686    WOLFSSL_LOCAL int DtlsUseSCRKeys(WOLFSSL* ssl);
     4687    WOLFSSL_LOCAL int DtlsCheckOrder(WOLFSSL* ssl, int order);
     4688#endif
     4689    WOLFSSL_LOCAL int IsSCR(WOLFSSL* ssl);
     4690
     4691    WOLFSSL_LOCAL void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out);
    44964692
    44974693#if defined(WOLFSSL_TLS13) && (defined(HAVE_SESSION_TICKET) || !defined(NO_PSK))
     
    45014697
    45024698#ifndef NO_CERTS
    4503     WOLFSSL_LOCAL void InitX509Name(WOLFSSL_X509_NAME*, int);
    4504     WOLFSSL_LOCAL void FreeX509Name(WOLFSSL_X509_NAME* name, void* heap);
     4699    WOLFSSL_LOCAL void InitX509Name(WOLFSSL_X509_NAME*, int, void*);
     4700    WOLFSSL_LOCAL void FreeX509Name(WOLFSSL_X509_NAME* name);
    45054701    WOLFSSL_LOCAL void InitX509(WOLFSSL_X509*, int, void* heap);
    45064702    WOLFSSL_LOCAL void FreeX509(WOLFSSL_X509*);
     
    45254721    byte cipherSuite0;
    45264722    byte cipherSuite;
    4527 #if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
     4723#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT) || \
     4724    defined(WOLFSSL_HAPROXY) || defined(WOLFSSL_NGINX)
    45284725    byte minor;
    45294726    byte major;
    45304727#endif
     4728    byte flags;
    45314729} CipherSuiteInfo;
    45324730
     
    45504748WOLFSSL_LOCAL const char* wolfSSL_get_cipher_name_iana(WOLFSSL* ssl);
    45514749WOLFSSL_LOCAL int GetCipherSuiteFromName(const char* name, byte* cipherSuite0,
    4552                                          byte* cipherSuite);
     4750                                         byte* cipherSuite, int* flags);
     4751
    45534752
    45544753enum encrypt_side {
     
    45884787WOLFSSL_LOCAL void FreeHandshakeHashes(WOLFSSL* ssl);
    45894788
     4789
     4790#ifndef WOLFSSL_NO_TLS12
     4791WOLFSSL_LOCAL void FreeBuildMsgArgs(WOLFSSL* ssl, BuildMsgArgs* args);
     4792#endif
    45904793WOLFSSL_LOCAL int BuildMessage(WOLFSSL* ssl, byte* output, int outSz,
    45914794                        const byte* input, int inSz, int type, int hashOutput,
    4592                         int sizeOnly, int asyncOkay);
     4795                        int sizeOnly, int asyncOkay, int epochOrder);
    45934796
    45944797#ifdef WOLFSSL_TLS13
Note: See TracChangeset for help on using the changeset viewer.