LCOV - code coverage report
Current view: top level - builds/gnutls/coverage/gnutls-git/lib/tls13 - encrypted_extensions.c (source / functions) Hit Total Coverage
Test: GnuTLS-3.6.8 Code Coverage Lines: 22 29 75.9 %
Date: 2019-07-21 03:10:42 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 9 22 40.9 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (C) 2017 Red Hat, Inc.
       3                 :            :  *
       4                 :            :  * Author: Nikos Mavrogiannopoulos
       5                 :            :  *
       6                 :            :  * This file is part of GnuTLS.
       7                 :            :  *
       8                 :            :  * The GnuTLS is free software; you can redistribute it and/or
       9                 :            :  * modify it under the terms of the GNU Lesser General Public License
      10                 :            :  * as published by the Free Software Foundation; either version 2.1 of
      11                 :            :  * the License, or (at your option) any later version.
      12                 :            :  *
      13                 :            :  * This library is distributed in the hope that it will be useful, but
      14                 :            :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      15                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16                 :            :  * Lesser General Public License for more details.
      17                 :            :  *
      18                 :            :  * You should have received a copy of the GNU Lesser General Public License
      19                 :            :  * along with this program.  If not, see <https://www.gnu.org/licenses/>
      20                 :            :  *
      21                 :            :  */
      22                 :            : 
      23                 :            : #include "gnutls_int.h"
      24                 :            : #include "errors.h"
      25                 :            : #include "hello_ext.h"
      26                 :            : #include "handshake.h"
      27                 :            : #include "mbuffers.h"
      28                 :            : #include "tls13/encrypted_extensions.h"
      29                 :            : 
      30                 :        528 : int _gnutls13_recv_encrypted_extensions(gnutls_session_t session)
      31                 :            : {
      32                 :        528 :         int ret;
      33                 :        528 :         gnutls_buffer_st buf;
      34                 :            : 
      35                 :        528 :         ret = _gnutls_recv_handshake(session, GNUTLS_HANDSHAKE_ENCRYPTED_EXTENSIONS, 0, &buf);
      36         [ +  + ]:        528 :         if (ret < 0)
      37         [ -  + ]:         11 :                 return gnutls_assert_val(ret);
      38                 :            : 
      39         [ -  + ]:        517 :         _gnutls_handshake_log("HSK[%p]: parsing encrypted extensions\n", session);
      40                 :       2068 :         ret = _gnutls_parse_hello_extensions(session, GNUTLS_EXT_FLAG_EE, GNUTLS_EXT_ANY,
      41                 :        517 :                                              buf.data, buf.length);
      42                 :        517 :         _gnutls_buffer_clear(&buf);
      43                 :            : 
      44         [ -  + ]:        517 :         if (ret < 0)
      45         [ #  # ]:          0 :                 return gnutls_assert_val(ret);
      46                 :            : 
      47                 :            :         return 0;
      48                 :            : }
      49                 :            : 
      50                 :       3715 : int _gnutls13_send_encrypted_extensions(gnutls_session_t session, unsigned again)
      51                 :            : {
      52                 :       3715 :         int ret;
      53                 :       3715 :         mbuffer_st *bufel = NULL;
      54                 :       3715 :         gnutls_buffer_st buf;
      55                 :            : 
      56         [ +  - ]:       3715 :         if (again == 0) {
      57         [ +  - ]:       7430 :                 ret = _gnutls_buffer_init_handshake_mbuffer(&buf);
      58         [ -  + ]:       3715 :                 if (ret < 0)
      59         [ #  # ]:          0 :                         return gnutls_assert_val(ret);
      60                 :            : 
      61                 :       3715 :                 ret = _gnutls_gen_hello_extensions(session, &buf, GNUTLS_EXT_FLAG_EE, GNUTLS_EXT_ANY);
      62         [ -  + ]:       3715 :                 if (ret < 0) {
      63         [ #  # ]:          0 :                         gnutls_assert();
      64                 :          0 :                         goto cleanup;
      65                 :            :                 }
      66                 :            : 
      67                 :       3715 :                 bufel = _gnutls_buffer_to_mbuffer(&buf);
      68                 :            :         }
      69                 :            : 
      70                 :       3715 :         return _gnutls_send_handshake(session, bufel, GNUTLS_HANDSHAKE_ENCRYPTED_EXTENSIONS);
      71                 :            : 
      72                 :          0 :  cleanup:
      73                 :          0 :         _gnutls_buffer_clear(&buf);
      74                 :          0 :         return ret;
      75                 :            : }

Generated by: LCOV version 1.13