OpenCoverage

pcy_map.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509v3/pcy_map.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 2004-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 "internal/cryptlib.h"-
11#include <openssl/x509.h>-
12#include <openssl/x509v3.h>-
13#include "internal/x509_int.h"-
14-
15#include "pcy_int.h"-
16-
17/*-
18 * Set policy mapping entries in cache. Note: this modifies the passed-
19 * POLICY_MAPPINGS structure-
20 */-
21-
22int policy_cache_set_mapping(X509 *x, POLICY_MAPPINGS *maps)-
23{-
24 POLICY_MAPPING *map;-
25 X509_POLICY_DATA *data;-
26 X509_POLICY_CACHE *cache = x->policy_cache;-
27 int i;-
28 int ret = 0;-
29 if (sk_POLICY_MAPPING_num(maps) == 0) {
sk_POLICY_MAPP...num(maps) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
30 ret = -1;-
31 goto bad_mapping;
never executed: goto bad_mapping;
0
32 }-
33 for (i = 0; i < sk_POLICY_MAPPING_num(maps); i++) {
i < sk_POLICY_...PING_num(maps)Description
TRUEnever evaluated
FALSEnever evaluated
0
34 map = sk_POLICY_MAPPING_value(maps, i);-
35 /* Reject if map to or from anyPolicy */-
36 if ((OBJ_obj2nid(map->subjectDomainPolicy) == NID_any_policy)
(OBJ_obj2nid(m...olicy) == 746)Description
TRUEnever evaluated
FALSEnever evaluated
0
37 || (OBJ_obj2nid(map->issuerDomainPolicy) == NID_any_policy)) {
(OBJ_obj2nid(m...olicy) == 746)Description
TRUEnever evaluated
FALSEnever evaluated
0
38 ret = -1;-
39 goto bad_mapping;
never executed: goto bad_mapping;
0
40 }-
41-
42 /* Attempt to find matching policy data */-
43 data = policy_cache_find_data(cache, map->issuerDomainPolicy);-
44 /* If we don't have anyPolicy can't map */-
45 if (data == NULL && !cache->anyPolicy)
data == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
!cache->anyPolicyDescription
TRUEnever evaluated
FALSEnever evaluated
0
46 continue;
never executed: continue;
0
47-
48 /* Create a NODE from anyPolicy */-
49 if (data == NULL) {
data == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
50 data = policy_data_new(NULL, map->issuerDomainPolicy,-
51 cache->anyPolicy->flags-
52 & POLICY_DATA_FLAG_CRITICAL);-
53 if (data == NULL)
data == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
54 goto bad_mapping;
never executed: goto bad_mapping;
0
55 data->qualifier_set = cache->anyPolicy->qualifier_set;-
56 /*-
57 * map->issuerDomainPolicy = NULL;-
58 */-
59 data->flags |= POLICY_DATA_FLAG_MAPPED_ANY;-
60 data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS;-
61 if (!sk_X509_POLICY_DATA_push(cache->data, data)) {
!sk_X509_POLIC...e->data, data)Description
TRUEnever evaluated
FALSEnever evaluated
0
62 policy_data_free(data);-
63 goto bad_mapping;
never executed: goto bad_mapping;
0
64 }-
65 } else
never executed: end of block
0
66 data->flags |= POLICY_DATA_FLAG_MAPPED;
never executed: data->flags |= 0x1;
0
67 if (!sk_ASN1_OBJECT_push(data->expected_policy_set,
!sk_ASN1_OBJEC...tDomainPolicy)Description
TRUEnever evaluated
FALSEnever evaluated
0
68 map->subjectDomainPolicy))
!sk_ASN1_OBJEC...tDomainPolicy)Description
TRUEnever evaluated
FALSEnever evaluated
0
69 goto bad_mapping;
never executed: goto bad_mapping;
0
70 map->subjectDomainPolicy = NULL;-
71-
72 }
never executed: end of block
0
73-
74 ret = 1;-
75 bad_mapping:
code before this statement never executed: bad_mapping:
0
76 if (ret == -1)
ret == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
77 x->ex_flags |= EXFLAG_INVALID_POLICY;
never executed: x->ex_flags |= 0x800;
0
78 sk_POLICY_MAPPING_pop_free(maps, POLICY_MAPPING_free);-
79 return ret;
never executed: return ret;
0
80-
81}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2