OpenCoverage

tasn_typ.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/tasn_typ.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 2000-2016 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/asn1.h>-
12#include <openssl/asn1t.h>-
13-
14/* Declarations for string types */-
15-
16#define IMPLEMENT_ASN1_STRING_FUNCTIONS(sname) \-
17 IMPLEMENT_ASN1_TYPE(sname) \-
18 IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(sname, sname, sname) \-
19sname *sname##_new(void) \-
20{ \-
21 return ASN1_STRING_type_new(V_##sname); \-
22} \-
23void sname##_free(sname *x) \-
24{ \-
25 ASN1_STRING_free(x); \-
26}-
27-
28IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
executed 583024 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
executed 101093 times by 1 test: return (ASN1_OCTET_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_OCTET_STRING_it)));
Executed by:
  • libcrypto.so.1.1
executed 87 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_OCTET_STRING_it)));
Executed by:
  • libcrypto.so.1.1
executed 17876 times by 2 tests: return ASN1_STRING_type_new(4);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
87-583024
29IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
executed 197716 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
executed 117664 times by 1 test: return (ASN1_INTEGER *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_INTEGER_it)));
Executed by:
  • libcrypto.so.1.1
executed 1240 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_INTEGER_it)));
Executed by:
  • libcrypto.so.1.1
executed 173404 times by 1 test: return ASN1_STRING_type_new(2);
Executed by:
  • libcrypto.so.1.1
1240-197716
30IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
executed 7189 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
executed 3812 times by 1 test: return (ASN1_ENUMERATED *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_ENUMERATED_it)));
Executed by:
  • libcrypto.so.1.1
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_ENUMERATED_it)));
never executed: return ASN1_STRING_type_new(10);
0-7189
31IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)
executed 8996 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
never executed: return (ASN1_BIT_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_BIT_STRING_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_BIT_STRING_it)));
executed 23041 times by 1 test: return ASN1_STRING_type_new(3);
Executed by:
  • libcrypto.so.1.1
0-23041
32IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTF8STRING)
never executed: end of block
never executed: return (ASN1_UTF8STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_UTF8STRING_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_UTF8STRING_it)));
never executed: return ASN1_STRING_type_new(12);
0
33IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_PRINTABLESTRING)
never executed: end of block
never executed: return (ASN1_PRINTABLESTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_PRINTABLESTRING_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_PRINTABLESTRING_it)));
never executed: return ASN1_STRING_type_new(19);
0
34IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_T61STRING)
never executed: end of block
never executed: return (ASN1_T61STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_T61STRING_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_T61STRING_it)));
never executed: return ASN1_STRING_type_new(20);
0
35IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_IA5STRING)
executed 102 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
never executed: return (ASN1_IA5STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_IA5STRING_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_IA5STRING_it)));
executed 107 times by 1 test: return ASN1_STRING_type_new(22);
Executed by:
  • libcrypto.so.1.1
0-107
36IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
never executed: end of block
never executed: return (ASN1_GENERALSTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_GENERALSTRING_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_GENERALSTRING_it)));
never executed: return ASN1_STRING_type_new(27);
0
37IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
never executed: end of block
never executed: return (ASN1_UTCTIME *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_UTCTIME_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_UTCTIME_it)));
never executed: return ASN1_STRING_type_new(23);
0
38IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
executed 2338 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
never executed: return (ASN1_GENERALIZEDTIME *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_GENERALIZEDTIME_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_GENERALIZEDTIME_it)));
executed 2338 times by 1 test: return ASN1_STRING_type_new(24);
Executed by:
  • libcrypto.so.1.1
0-2338
39IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
never executed: end of block
never executed: return (ASN1_VISIBLESTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_VISIBLESTRING_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_VISIBLESTRING_it)));
never executed: return ASN1_STRING_type_new(26);
0
40IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)
never executed: end of block
never executed: return (ASN1_UNIVERSALSTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_UNIVERSALSTRING_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_UNIVERSALSTRING_it)));
never executed: return ASN1_STRING_type_new(28);
0
41IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BMPSTRING)
never executed: end of block
never executed: return (ASN1_BMPSTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_BMPSTRING_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_BMPSTRING_it)));
never executed: return ASN1_STRING_type_new(30);
0
42-
43IMPLEMENT_ASN1_TYPE(ASN1_NULL)-
44IMPLEMENT_ASN1_FUNCTIONS(ASN1_NULL)
never executed: end of block
never executed: return (ASN1_NULL *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_NULL_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_NULL_it)));
executed 2 times by 1 test: return (ASN1_NULL *)ASN1_item_new((&(ASN1_NULL_it)));
Executed by:
  • libcrypto.so.1.1
0-2
45-
46IMPLEMENT_ASN1_TYPE(ASN1_OBJECT)-
47-
48IMPLEMENT_ASN1_TYPE(ASN1_ANY)-
49-
50/* Just swallow an ASN1_SEQUENCE in an ASN1_STRING */-
51IMPLEMENT_ASN1_TYPE(ASN1_SEQUENCE)-
52-
53IMPLEMENT_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
executed 30523 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
never executed: return (ASN1_TYPE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_ANY_it)));
executed 7832 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_ANY_it)));
Executed by:
  • libcrypto.so.1.1
executed 228911 times by 1 test: return (ASN1_TYPE *)ASN1_item_new((&(ASN1_ANY_it)));
Executed by:
  • libcrypto.so.1.1
0-228911
54-
55/* Multistring types */-
56-
57IMPLEMENT_ASN1_MSTRING(ASN1_PRINTABLE, B_ASN1_PRINTABLE)-
58IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
never executed: end of block
never executed: return (ASN1_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_PRINTABLE_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_PRINTABLE_it)));
never executed: return (ASN1_STRING *)ASN1_item_new((&(ASN1_PRINTABLE_it)));
0
59-
60IMPLEMENT_ASN1_MSTRING(DISPLAYTEXT, B_ASN1_DISPLAYTEXT)-
61IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
never executed: end of block
never executed: return (ASN1_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(DISPLAYTEXT_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(DISPLAYTEXT_it)));
never executed: return (ASN1_STRING *)ASN1_item_new((&(DISPLAYTEXT_it)));
0
62-
63IMPLEMENT_ASN1_MSTRING(DIRECTORYSTRING, B_ASN1_DIRECTORYSTRING)-
64IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
never executed: end of block
never executed: return (ASN1_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(DIRECTORYSTRING_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(DIRECTORYSTRING_it)));
never executed: return (ASN1_STRING *)ASN1_item_new((&(DIRECTORYSTRING_it)));
0
65-
66/* Three separate BOOLEAN type: normal, DEFAULT TRUE and DEFAULT FALSE */-
67IMPLEMENT_ASN1_TYPE_ex(ASN1_BOOLEAN, ASN1_BOOLEAN, -1)-
68IMPLEMENT_ASN1_TYPE_ex(ASN1_TBOOLEAN, ASN1_BOOLEAN, 1)-
69IMPLEMENT_ASN1_TYPE_ex(ASN1_FBOOLEAN, ASN1_BOOLEAN, 0)-
70-
71/* Special, OCTET STRING with indefinite length constructed support */-
72-
73IMPLEMENT_ASN1_TYPE_ex(ASN1_OCTET_STRING_NDEF, ASN1_OCTET_STRING, ASN1_TFLG_NDEF)-
74-
75ASN1_ITEM_TEMPLATE(ASN1_SEQUENCE_ANY) =-
76 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, ASN1_SEQUENCE_ANY, ASN1_ANY)-
77ASN1_ITEM_TEMPLATE_END(ASN1_SEQUENCE_ANY)-
78-
79ASN1_ITEM_TEMPLATE(ASN1_SET_ANY) =-
80 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SET_OF, 0, ASN1_SET_ANY, ASN1_ANY)-
81ASN1_ITEM_TEMPLATE_END(ASN1_SET_ANY)-
82-
83IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
executed 3339 times by 1 test: return (ASN1_SEQUENCE_ANY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_SEQUENCE_ANY_it)));
Executed by:
  • libcrypto.so.1.1
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_SEQUENCE_ANY_it)));
0-3339
84IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(ASN1_SEQUENCE_ANY, ASN1_SET_ANY, ASN1_SET_ANY)
never executed: return (ASN1_SEQUENCE_ANY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ASN1_SET_ANY_it)));
never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASN1_SET_ANY_it)));
0
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2