Bug Summary

File:out/../deps/openssl/openssl/crypto/x509/v3_ist.c
Warning:line 132, column 9
Value stored to 'new_line' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name v3_ist.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/maurizio/node-v18.6.0/out -resource-dir /usr/local/lib/clang/16.0.0 -D V8_DEPRECATION_WARNINGS -D V8_IMMINENT_DEPRECATION_WARNINGS -D _GLIBCXX_USE_CXX11_ABI=1 -D NODE_OPENSSL_CONF_NAME=nodejs_conf -D NODE_OPENSSL_HAS_QUIC -D __STDC_FORMAT_MACROS -D OPENSSL_NO_PINSHARED -D OPENSSL_THREADS -D OPENSSL_NO_HW -D OPENSSL_API_COMPAT=0x10100001L -D STATIC_LEGACY -D NDEBUG -D OPENSSL_USE_NODELETE -D L_ENDIAN -D OPENSSL_BUILDING_OPENSSL -D AES_ASM -D BSAES_ASM -D CMLL_ASM -D ECP_NISTZ256_ASM -D GHASH_ASM -D KECCAK1600_ASM -D MD5_ASM -D OPENSSL_BN_ASM_GF2m -D OPENSSL_BN_ASM_MONT -D OPENSSL_BN_ASM_MONT5 -D OPENSSL_CPUID_OBJ -D OPENSSL_IA32_SSE2 -D PADLOCK_ASM -D POLY1305_ASM -D SHA1_ASM -D SHA256_ASM -D SHA512_ASM -D VPAES_ASM -D WHIRLPOOL_ASM -D X25519_ASM -D OPENSSL_PIC -D MODULESDIR="/home/maurizio/node-v18.6.0/out/Release/obj.target/deps/openssl/lib/openssl-modules" -D OPENSSLDIR="/home/maurizio/node-v18.6.0/out/Release/obj.target/deps/openssl" -D OPENSSLDIR="/etc/ssl" -D ENGINESDIR="/dev/null" -D TERMIOS -I ../deps/openssl/openssl -I ../deps/openssl/openssl/include -I ../deps/openssl/openssl/crypto -I ../deps/openssl/openssl/crypto/include -I ../deps/openssl/openssl/crypto/modes -I ../deps/openssl/openssl/crypto/ec/curve448 -I ../deps/openssl/openssl/crypto/ec/curve448/arch_32 -I ../deps/openssl/openssl/providers/common/include -I ../deps/openssl/openssl/providers/implementations/include -I ../deps/openssl/config -I ../deps/openssl/config/archs/linux-x86_64/asm -I ../deps/openssl/config/archs/linux-x86_64/asm/include -I ../deps/openssl/config/archs/linux-x86_64/asm/crypto -I ../deps/openssl/config/archs/linux-x86_64/asm/crypto/include/internal -I ../deps/openssl/config/archs/linux-x86_64/asm/providers/common/include -internal-isystem /usr/local/lib/clang/16.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-unused-parameter -Wno-missing-field-initializers -Wno-old-style-declaration -fdebug-compilation-dir=/home/maurizio/node-v18.6.0/out -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2022-08-22-142216-507842-1 -x c ../deps/openssl/openssl/crypto/x509/v3_ist.c
1/*
2 * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (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 "internal/cryptlib.h"
12#include <openssl/conf.h>
13#include <openssl/asn1.h>
14#include <openssl/asn1t.h>
15#include <openssl/x509v3.h>
16#include "ext_dat.h"
17
18/*
19 * Issuer Sign Tool (1.2.643.100.112) The name of the tool used to signs the subject (ASN1_SEQUENCE)
20 * This extention is required to obtain the status of a qualified certificate at Russian Federation.
21 * RFC-style description is available here: https://tools.ietf.org/html/draft-deremin-rfc4491-bis-04#section-5
22 * Russian Federal Law 63 "Digital Sign" is available here: http://www.consultant.ru/document/cons_doc_LAW_112701/
23 */
24
25ASN1_SEQUENCE(ISSUER_SIGN_TOOL)static const ASN1_TEMPLATE ISSUER_SIGN_TOOL_seq_tt[] = {
26 ASN1_SIMPLE(ISSUER_SIGN_TOOL, signTool, ASN1_UTF8STRING){ (0), (0), __builtin_offsetof(ISSUER_SIGN_TOOL, signTool), "signTool"
, (ASN1_UTF8STRING_it) }
,
27 ASN1_SIMPLE(ISSUER_SIGN_TOOL, cATool, ASN1_UTF8STRING){ (0), (0), __builtin_offsetof(ISSUER_SIGN_TOOL, cATool), "cATool"
, (ASN1_UTF8STRING_it) }
,
28 ASN1_SIMPLE(ISSUER_SIGN_TOOL, signToolCert, ASN1_UTF8STRING){ (0), (0), __builtin_offsetof(ISSUER_SIGN_TOOL, signToolCert
), "signToolCert", (ASN1_UTF8STRING_it) }
,
29 ASN1_SIMPLE(ISSUER_SIGN_TOOL, cAToolCert, ASN1_UTF8STRING){ (0), (0), __builtin_offsetof(ISSUER_SIGN_TOOL, cAToolCert),
"cAToolCert", (ASN1_UTF8STRING_it) }
30} ASN1_SEQUENCE_END(ISSUER_SIGN_TOOL); const ASN1_ITEM * ISSUER_SIGN_TOOL_it(void) { static const ASN1_ITEM
local_it = { 0x1, 16, ISSUER_SIGN_TOOL_seq_tt, sizeof(ISSUER_SIGN_TOOL_seq_tt
) / sizeof(ASN1_TEMPLATE), ((void*)0), sizeof(ISSUER_SIGN_TOOL
), "ISSUER_SIGN_TOOL" }; return &local_it; }
31
32IMPLEMENT_ASN1_FUNCTIONS(ISSUER_SIGN_TOOL)ISSUER_SIGN_TOOL *d2i_ISSUER_SIGN_TOOL(ISSUER_SIGN_TOOL **a, const
unsigned char **in, long len) { return (ISSUER_SIGN_TOOL *)ASN1_item_d2i
((ASN1_VALUE **)a, in, len, (ISSUER_SIGN_TOOL_it())); } int i2d_ISSUER_SIGN_TOOL
(const ISSUER_SIGN_TOOL *a, unsigned char **out) { return ASN1_item_i2d
((const ASN1_VALUE *)a, out, (ISSUER_SIGN_TOOL_it())); } ISSUER_SIGN_TOOL
*ISSUER_SIGN_TOOL_new(void) { return (ISSUER_SIGN_TOOL *)ASN1_item_new
((ISSUER_SIGN_TOOL_it())); } void ISSUER_SIGN_TOOL_free(ISSUER_SIGN_TOOL
*a) { ASN1_item_free((ASN1_VALUE *)a, (ISSUER_SIGN_TOOL_it()
)); }
33
34
35static ISSUER_SIGN_TOOL *v2i_issuer_sign_tool(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
36 STACK_OF(CONF_VALUE)struct stack_st_CONF_VALUE *nval)
37{
38 ISSUER_SIGN_TOOL *ist = ISSUER_SIGN_TOOL_new();
39 int i;
40
41 if (ist == NULL((void*)0)) {
42 ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE)(ERR_new(), ERR_set_debug("../deps/openssl/openssl/crypto/x509/v3_ist.c"
,42,__func__), ERR_set_error)((34),((256|((0x1 << 18L)|
(0x2 << 18L)))),((void*)0))
;
43 return NULL((void*)0);
44 }
45 for (i = 0; i < sk_CONF_VALUE_num(nval)OPENSSL_sk_num(ossl_check_const_CONF_VALUE_sk_type(nval)); ++i) {
46 CONF_VALUE *cnf = sk_CONF_VALUE_value(nval, i)((CONF_VALUE *)OPENSSL_sk_value(ossl_check_const_CONF_VALUE_sk_type
(nval), (i)))
;
47
48 if (cnf == NULL((void*)0)) {
49 continue;
50 }
51 if (strcmp(cnf->name, "signTool") == 0) {
52 ist->signTool = ASN1_UTF8STRING_new();
53 if (ist->signTool == NULL((void*)0)) {
54 ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE)(ERR_new(), ERR_set_debug("../deps/openssl/openssl/crypto/x509/v3_ist.c"
,54,__func__), ERR_set_error)((34),((256|((0x1 << 18L)|
(0x2 << 18L)))),((void*)0))
;
55 ISSUER_SIGN_TOOL_free(ist);
56 return NULL((void*)0);
57 }
58 ASN1_STRING_set(ist->signTool, cnf->value, strlen(cnf->value));
59 } else if (strcmp(cnf->name, "cATool") == 0) {
60 ist->cATool = ASN1_UTF8STRING_new();
61 if (ist->cATool == NULL((void*)0)) {
62 ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE)(ERR_new(), ERR_set_debug("../deps/openssl/openssl/crypto/x509/v3_ist.c"
,62,__func__), ERR_set_error)((34),((256|((0x1 << 18L)|
(0x2 << 18L)))),((void*)0))
;
63 ISSUER_SIGN_TOOL_free(ist);
64 return NULL((void*)0);
65 }
66 ASN1_STRING_set(ist->cATool, cnf->value, strlen(cnf->value));
67 } else if (strcmp(cnf->name, "signToolCert") == 0) {
68 ist->signToolCert = ASN1_UTF8STRING_new();
69 if (ist->signToolCert == NULL((void*)0)) {
70 ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE)(ERR_new(), ERR_set_debug("../deps/openssl/openssl/crypto/x509/v3_ist.c"
,70,__func__), ERR_set_error)((34),((256|((0x1 << 18L)|
(0x2 << 18L)))),((void*)0))
;
71 ISSUER_SIGN_TOOL_free(ist);
72 return NULL((void*)0);
73 }
74 ASN1_STRING_set(ist->signToolCert, cnf->value, strlen(cnf->value));
75 } else if (strcmp(cnf->name, "cAToolCert") == 0) {
76 ist->cAToolCert = ASN1_UTF8STRING_new();
77 if (ist->cAToolCert == NULL((void*)0)) {
78 ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE)(ERR_new(), ERR_set_debug("../deps/openssl/openssl/crypto/x509/v3_ist.c"
,78,__func__), ERR_set_error)((34),((256|((0x1 << 18L)|
(0x2 << 18L)))),((void*)0))
;
79 ISSUER_SIGN_TOOL_free(ist);
80 return NULL((void*)0);
81 }
82 ASN1_STRING_set(ist->cAToolCert, cnf->value, strlen(cnf->value));
83 } else {
84 ERR_raise(ERR_LIB_X509V3, ERR_R_PASSED_INVALID_ARGUMENT)(ERR_new(), ERR_set_debug("../deps/openssl/openssl/crypto/x509/v3_ist.c"
,84,__func__), ERR_set_error)((34),((262|(0x2 << 18L)))
,((void*)0))
;
85 ISSUER_SIGN_TOOL_free(ist);
86 return NULL((void*)0);
87 }
88 }
89 return ist;
90}
91
92static int i2r_issuer_sign_tool(X509V3_EXT_METHOD *method,
93 ISSUER_SIGN_TOOL *ist, BIO *out,
94 int indent)
95{
96 int new_line = 0;
97
98 if (ist == NULL((void*)0)) {
99 ERR_raise(ERR_LIB_X509V3, ERR_R_PASSED_INVALID_ARGUMENT)(ERR_new(), ERR_set_debug("../deps/openssl/openssl/crypto/x509/v3_ist.c"
,99,__func__), ERR_set_error)((34),((262|(0x2 << 18L)))
,((void*)0))
;
100 return 0;
101 }
102 if (ist->signTool != NULL((void*)0)) {
103 if (new_line == 1) {
104 BIO_write(out, "\n", 1);
105 }
106 BIO_printf(out, "%*ssignTool : ", indent, "");
107 BIO_write(out, ist->signTool->data, ist->signTool->length);
108 new_line = 1;
109 }
110 if (ist->cATool != NULL((void*)0)) {
111 if (new_line == 1) {
112 BIO_write(out, "\n", 1);
113 }
114 BIO_printf(out, "%*scATool : ", indent, "");
115 BIO_write(out, ist->cATool->data, ist->cATool->length);
116 new_line = 1;
117 }
118 if (ist->signToolCert != NULL((void*)0)) {
119 if (new_line == 1) {
120 BIO_write(out, "\n", 1);
121 }
122 BIO_printf(out, "%*ssignToolCert: ", indent, "");
123 BIO_write(out, ist->signToolCert->data, ist->signToolCert->length);
124 new_line = 1;
125 }
126 if (ist->cAToolCert != NULL((void*)0)) {
127 if (new_line == 1) {
128 BIO_write(out, "\n", 1);
129 }
130 BIO_printf(out, "%*scAToolCert : ", indent, "");
131 BIO_write(out, ist->cAToolCert->data, ist->cAToolCert->length);
132 new_line = 1;
Value stored to 'new_line' is never read
133 }
134 return 1;
135}
136
137const X509V3_EXT_METHOD ossl_v3_issuer_sign_tool = {
138 NID_issuerSignTool1008, /* nid */
139 X509V3_EXT_MULTILINE0x4, /* flags */
140 ASN1_ITEM_ref(ISSUER_SIGN_TOOL)(ISSUER_SIGN_TOOL_it), /* template */
141 0, 0, 0, 0, /* old functions, ignored */
142 0, /* i2s */
143 0, /* s2i */
144 0, /* i2v */
145 (X509V3_EXT_V2I)v2i_issuer_sign_tool, /* v2i */
146 (X509V3_EXT_I2R)i2r_issuer_sign_tool, /* i2r */
147 0, /* r2i */
148 NULL((void*)0) /* extension-specific data */
149};