Ignore:
Timestamp:
Aug 28, 2019 12:02:50 PM (4 years ago)
Author:
riza
Message:

Fixed #2221: When using Openssl as TLS backend, close notify alert is not sent before closing the connection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ssl_sock_ossl.c

    r6053 r6054  
    11691169    /* Destroy SSL instance */ 
    11701170    if (ossock->ossl_ssl) { 
    1171         /** 
    1172          * Avoid calling SSL_shutdown() if handshake wasn't completed. 
    1173          * OpenSSL 1.0.2f complains if SSL_shutdown() is called during an 
    1174          * SSL handshake, while previous versions always return 0.        
    1175          */ 
    1176         if (SSL_in_init(ossock->ossl_ssl) == 0) { 
    1177             SSL_shutdown(ossock->ossl_ssl); 
    1178         }        
    11791171        SSL_free(ossock->ossl_ssl); /* this will also close BIOs */ 
    11801172        ossock->ossl_ssl = NULL; 
     
    11971189static void ssl_reset_sock_state(pj_ssl_sock_t *ssock) 
    11981190{ 
     1191    ossl_sock_t *ossock = (ossl_sock_t *)ssock; 
     1192    /** 
     1193     * Avoid calling SSL_shutdown() if handshake wasn't completed. 
     1194     * OpenSSL 1.0.2f complains if SSL_shutdown() is called during an 
     1195     * SSL handshake, while previous versions always return 0. 
     1196     */ 
     1197    if (ossock->ossl_ssl && SSL_in_init(ossock->ossl_ssl) == 0) { 
     1198        int ret = SSL_shutdown(ossock->ossl_ssl); 
     1199        if (ret == 0) { 
     1200            /* Flush data to send close notify. */ 
     1201            flush_circ_buf_output(ssock, &ssock->shutdown_op_key, 0, 0); 
     1202        } 
     1203    } 
     1204 
    11991205    pj_lock_acquire(ssock->write_mutex); 
    12001206    ssock->ssl_state = SSL_STATE_NULL; 
Note: See TracChangeset for help on using the changeset viewer.