OpenCoverage

ssl_mcnf.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/ssl_mcnf.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.-
3 *-
4 * Licensed under the OpenSSL license (the "License"). You may not use-
5 * this file except in compliance with the License. You can obtain a copy-
6 * in the file LICENSE in the source distribution or at-
7 * https://www.openssl.org/source/license.html-
8 */-
9-
10#include <stdio.h>-
11#include <openssl/conf.h>-
12#include <openssl/ssl.h>-
13#include "ssl_locl.h"-
14#include "internal/sslconf.h"-
15-
16/* SSL library configuration module. */-
17-
18void SSL_add_ssl_module(void)-
19{-
20 /* Do nothing. This will be added automatically by libcrypto */-
21}-
22-
23static int ssl_do_config(SSL *s, SSL_CTX *ctx, const char *name, int system)-
24{-
25 SSL_CONF_CTX *cctx = NULL;-
26 size_t i, idx, cmd_count;-
27 int rv = 0;-
28 unsigned int flags;-
29 const SSL_METHOD *meth;-
30 const SSL_CONF_CMD *cmds;-
31-
32 if (s == NULL && ctx == NULL) {
s == ((void *)0)Description
TRUEevaluated 10470 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13encryptiontest
FALSEnever evaluated
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 10470 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13encryptiontest
0-10470
33 SSLerr(SSL_F_SSL_DO_CONFIG, ERR_R_PASSED_NULL_PARAMETER);-
34 goto err;
never executed: goto err;
0
35 }-
36-
37 if (name == NULL && system)
name == ((void *)0)Description
TRUEevaluated 8017 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13encryptiontest
FALSEevaluated 2453 times by 1 test
Evaluated by:
  • libssl.so.1.1
systemDescription
TRUEevaluated 8017 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13encryptiontest
FALSEnever evaluated
0-8017
38 name = "system_default";
executed 8017 times by 2 tests: name = "system_default";
Executed by:
  • libssl.so.1.1
  • tls13encryptiontest
8017
39 if (!conf_ssl_name_find(name, &idx)) {
!conf_ssl_name...nd(name, &idx)Description
TRUEevaluated 8016 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13encryptiontest
FALSEevaluated 2454 times by 1 test
Evaluated by:
  • libssl.so.1.1
2454-8016
40 if (!system) {
!systemDescription
TRUEnever evaluated
FALSEevaluated 8016 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13encryptiontest
0-8016
41 SSLerr(SSL_F_SSL_DO_CONFIG, SSL_R_INVALID_CONFIGURATION_NAME);-
42 ERR_add_error_data(2, "name=", name);-
43 }
never executed: end of block
0
44 goto err;
executed 8016 times by 2 tests: goto err;
Executed by:
  • libssl.so.1.1
  • tls13encryptiontest
8016
45 }-
46 cmds = conf_ssl_get(idx, &name, &cmd_count);-
47 cctx = SSL_CONF_CTX_new();-
48 if (cctx == NULL)
cctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2454 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2454
49 goto err;
never executed: goto err;
0
50 flags = SSL_CONF_FLAG_FILE;-
51 if (!system)
!systemDescription
TRUEevaluated 2453 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
1-2453
52 flags |= SSL_CONF_FLAG_CERTIFICATE | SSL_CONF_FLAG_REQUIRE_PRIVATE;
executed 2453 times by 1 test: flags |= 0x20 | 0x40;
Executed by:
  • libssl.so.1.1
2453
53 if (s != NULL) {
s != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2454 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2454
54 meth = s->method;-
55 SSL_CONF_CTX_set_ssl(cctx, s);-
56 } else {
never executed: end of block
0
57 meth = ctx->method;-
58 SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);-
59 }
executed 2454 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2454
60 if (meth->ssl_accept != ssl_undefined_function)
meth->ssl_acce...fined_functionDescription
TRUEevaluated 1244 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1210 times by 1 test
Evaluated by:
  • libssl.so.1.1
1210-1244
61 flags |= SSL_CONF_FLAG_SERVER;
executed 1244 times by 1 test: flags |= 0x8;
Executed by:
  • libssl.so.1.1
1244
62 if (meth->ssl_connect != ssl_undefined_function)
meth->ssl_conn...fined_functionDescription
TRUEevaluated 1211 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1243 times by 1 test
Evaluated by:
  • libssl.so.1.1
1211-1243
63 flags |= SSL_CONF_FLAG_CLIENT;
executed 1211 times by 1 test: flags |= 0x4;
Executed by:
  • libssl.so.1.1
1211
64 SSL_CONF_CTX_set_flags(cctx, flags);-
65 for (i = 0; i < cmd_count; i++) {
i < cmd_countDescription
TRUEevaluated 10987 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2454 times by 1 test
Evaluated by:
  • libssl.so.1.1
2454-10987
66 char *cmdstr, *arg;-
67-
68 conf_ssl_get_cmd(cmds, i, &cmdstr, &arg);-
69 rv = SSL_CONF_cmd(cctx, cmdstr, arg);-
70 if (rv <= 0) {
rv <= 0Description
TRUEnever evaluated
FALSEevaluated 10987 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-10987
71 if (rv == -2)
rv == -2Description
TRUEnever evaluated
FALSEnever evaluated
0
72 SSLerr(SSL_F_SSL_DO_CONFIG, SSL_R_UNKNOWN_COMMAND);
never executed: ERR_put_error(20,(391),(139),__FILE__,72);
0
73 else-
74 SSLerr(SSL_F_SSL_DO_CONFIG, SSL_R_BAD_VALUE);
never executed: ERR_put_error(20,(391),(384),__FILE__,74);
0
75 ERR_add_error_data(6, "section=", name, ", cmd=", cmdstr,-
76 ", arg=", arg);-
77 goto err;
never executed: goto err;
0
78 }-
79 }
executed 10987 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
10987
80 rv = SSL_CONF_CTX_finish(cctx);-
81 err:
code before this statement executed 2454 times by 1 test: err:
Executed by:
  • libssl.so.1.1
2454
82 SSL_CONF_CTX_free(cctx);-
83 return rv <= 0 ? 0 : 1;
executed 10470 times by 2 tests: return rv <= 0 ? 0 : 1;
Executed by:
  • libssl.so.1.1
  • tls13encryptiontest
rv <= 0Description
TRUEevaluated 8016 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13encryptiontest
FALSEevaluated 2454 times by 1 test
Evaluated by:
  • libssl.so.1.1
2454-10470
84}-
85-
86int SSL_config(SSL *s, const char *name)-
87{-
88 return ssl_do_config(s, NULL, name, 0);
never executed: return ssl_do_config(s, ((void *)0) , name, 0);
0
89}-
90-
91int SSL_CTX_config(SSL_CTX *ctx, const char *name)-
92{-
93 return ssl_do_config(NULL, ctx, name, 0);
executed 2453 times by 1 test: return ssl_do_config( ((void *)0) , ctx, name, 0);
Executed by:
  • libssl.so.1.1
2453
94}-
95-
96void ssl_ctx_system_config(SSL_CTX *ctx)-
97{-
98 ssl_do_config(NULL, ctx, NULL, 1);-
99}
executed 8017 times by 2 tests: end of block
Executed by:
  • libssl.so.1.1
  • tls13encryptiontest
8017
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2