Coverage Report

Created: 2024-06-20 06:28

/src/gnutls/lib/minitasn1/parser_aux.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (C) 2000-2022 Free Software Foundation, Inc.
3
 *
4
 * This file is part of LIBTASN1.
5
 *
6
 * The LIBTASN1 library is free software; you can redistribute it
7
 * and/or modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful, but
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
 * 02110-1301, USA
20
 */
21
22
#ifndef _PARSER_AUX_H
23
# define _PARSER_AUX_H
24
25
/***********************************************/
26
/* Type: list_type                             */
27
/* Description: type used in the list during   */
28
/* the structure creation.                     */
29
/***********************************************/
30
typedef struct list_struct
31
{
32
  asn1_node node;
33
  struct list_struct *next;
34
} list_type;
35
36
/***************************************/
37
/*  Functions used by ASN.1 parser     */
38
/***************************************/
39
asn1_node _asn1_add_static_node (list_type ** e_list, unsigned int type);
40
41
void _asn1_delete_list (list_type * e_list);
42
43
void _asn1_delete_list_and_nodes (list_type * e_list);
44
45
void _asn1_delete_node_from_list (list_type * list, asn1_node node);
46
47
asn1_node
48
_asn1_set_value (asn1_node node, const void *value, unsigned int len);
49
50
asn1_node _asn1_set_value_m (asn1_node node, void *value, unsigned int len);
51
52
asn1_node
53
_asn1_set_value_lv (asn1_node node, const void *value, unsigned int len);
54
55
asn1_node
56
_asn1_append_value (asn1_node node, const void *value, unsigned int len);
57
58
asn1_node _asn1_set_name (asn1_node node, const char *name);
59
60
asn1_node _asn1_cpy_name (asn1_node dst, asn1_node_const src);
61
62
asn1_node _asn1_set_right (asn1_node node, asn1_node right);
63
64
asn1_node _asn1_get_last_right (asn1_node_const node);
65
66
void _asn1_remove_node (asn1_node node, unsigned int flags);
67
68
/* Max 64-bit integer length is 20 chars + 1 for sign + 1 for null termination */
69
0
# define LTOSTR_MAX_SIZE 22
70
char *_asn1_ltostr (int64_t v, char str[LTOSTR_MAX_SIZE]);
71
72
asn1_node _asn1_find_up (asn1_node_const node);
73
74
int _asn1_change_integer_value (asn1_node node);
75
76
0
# define EXPAND_OBJECT_ID_MAX_RECURSION 16
77
int _asn1_expand_object_id (list_type ** list, asn1_node node);
78
79
int _asn1_type_set_config (asn1_node node);
80
81
int _asn1_check_identifier (asn1_node_const node);
82
83
int _asn1_set_default_tag (asn1_node node);
84
85
/******************************************************************/
86
/* Function : _asn1_get_right                                     */
87
/* Description: returns the element pointed by the RIGHT field of */
88
/*              a NODE_ASN element.                               */
89
/* Parameters:                                                    */
90
/*   node: NODE_ASN element pointer.                              */
91
/* Return: field RIGHT of NODE.                                   */
92
/******************************************************************/
93
inline static asn1_node
94
_asn1_get_right (asn1_node_const node)
95
0
{
96
0
  if (node == NULL)
97
0
    return NULL;
98
0
  return node->right;
99
0
}
Unexecuted instantiation: structure.c:_asn1_get_right
Unexecuted instantiation: coding.c:_asn1_get_right
Unexecuted instantiation: decoding.c:_asn1_get_right
Unexecuted instantiation: element.c:_asn1_get_right
Unexecuted instantiation: parser_aux.c:_asn1_get_right
100
101
/******************************************************************/
102
/* Function : _asn1_set_down                                      */
103
/* Description: sets the field DOWN in a NODE_ASN element.        */
104
/* Parameters:                                                    */
105
/*   node: element pointer.                                       */
106
/*   down: pointer to a NODE_ASN element that you want be pointed */
107
/*          by NODE.                                              */
108
/* Return: pointer to *NODE.                                      */
109
/******************************************************************/
110
inline static asn1_node
111
_asn1_set_down (asn1_node node, asn1_node down)
112
424
{
113
424
  if (node == NULL)
114
0
    return node;
115
424
  node->down = down;
116
424
  if (down)
117
424
    down->left = node;
118
424
  return node;
119
424
}
structure.c:_asn1_set_down
Line
Count
Source
112
424
{
113
424
  if (node == NULL)
114
0
    return node;
115
424
  node->down = down;
116
424
  if (down)
117
424
    down->left = node;
118
424
  return node;
119
424
}
Unexecuted instantiation: coding.c:_asn1_set_down
Unexecuted instantiation: decoding.c:_asn1_set_down
Unexecuted instantiation: element.c:_asn1_set_down
Unexecuted instantiation: parser_aux.c:_asn1_set_down
120
121
/******************************************************************/
122
/* Function : _asn1_get_down                                      */
123
/* Description: returns the element pointed by the DOWN field of  */
124
/*              a NODE_ASN element.                               */
125
/* Parameters:                                                    */
126
/*   node: NODE_ASN element pointer.                              */
127
/* Return: field DOWN of NODE.                                    */
128
/******************************************************************/
129
inline static asn1_node
130
_asn1_get_down (asn1_node_const node)
131
0
{
132
0
  if (node == NULL)
133
0
    return NULL;
134
0
  return node->down;
135
0
}
Unexecuted instantiation: structure.c:_asn1_get_down
Unexecuted instantiation: coding.c:_asn1_get_down
Unexecuted instantiation: decoding.c:_asn1_get_down
Unexecuted instantiation: element.c:_asn1_get_down
Unexecuted instantiation: parser_aux.c:_asn1_get_down
136
137
/******************************************************************/
138
/* Function : _asn1_get_name                                      */
139
/* Description: returns the name of a NODE_ASN element.           */
140
/* Parameters:                                                    */
141
/*   node: NODE_ASN element pointer.                              */
142
/* Return: a null terminated string.                              */
143
/******************************************************************/
144
inline static char *
145
_asn1_get_name (asn1_node_const node)
146
0
{
147
0
  if (node == NULL)
148
0
    return NULL;
149
0
  return (char *) node->name;
150
0
}
Unexecuted instantiation: structure.c:_asn1_get_name
Unexecuted instantiation: coding.c:_asn1_get_name
Unexecuted instantiation: decoding.c:_asn1_get_name
Unexecuted instantiation: element.c:_asn1_get_name
Unexecuted instantiation: parser_aux.c:_asn1_get_name
151
152
/******************************************************************/
153
/* Function : _asn1_mod_type                                      */
154
/* Description: change the field TYPE of an NODE_ASN element.     */
155
/*              The new value is the old one | (bitwise or) the   */
156
/*              paramener VALUE.                                  */
157
/* Parameters:                                                    */
158
/*   node: NODE_ASN element pointer.                              */
159
/*   value: the integer value that must be or-ed with the current */
160
/*          value of field TYPE.                                  */
161
/* Return: NODE pointer.                                          */
162
/******************************************************************/
163
inline static asn1_node
164
_asn1_mod_type (asn1_node node, unsigned int value)
165
0
{
166
0
  if (node == NULL)
167
0
    return node;
168
0
  node->type |= value;
169
0
  return node;
170
0
}
Unexecuted instantiation: structure.c:_asn1_mod_type
Unexecuted instantiation: coding.c:_asn1_mod_type
Unexecuted instantiation: decoding.c:_asn1_mod_type
Unexecuted instantiation: element.c:_asn1_mod_type
Unexecuted instantiation: parser_aux.c:_asn1_mod_type
171
172
#endif