Open SCAP Library
Loading...
Searching...
No Matches
cvss_priv.h
Go to the documentation of this file.
1
9/*
10 * Copyright 2009 Red Hat Inc., Durham, North Carolina.
11 * All Rights Reserved.
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 *
27 * Authors:
28 * Maros Barabas <mbarabas@redhat.com>
29 * Lukas Kuklinek <lkuklinek@redhat.com>
30 */
31
32#ifndef CVSS_PRIV_H_
33#define CVSS_PRIV_H_
34
35#include <stdlib.h>
36#include <libxml/xmlreader.h>
37#include <libxml/xmlwriter.h>
38
39#include "public/cvss_score.h"
40#include "common/util.h"
41
42
43#define CVSSMAX(a, b) ((a) > (b) ? (a) : (b))
44
45struct cvss_impact;
46struct cvss_metrics;
47
48enum cvss_key {
49 CVSS_KEY_NONE = CVSS_NONE,
50
51 CVSS_KEY_access_vector = CVSS_BASE,
52 CVSS_KEY_access_complexity,
53 CVSS_KEY_authentication,
54 CVSS_KEY_confidentiality_impact,
55 CVSS_KEY_integrity_impact,
56 CVSS_KEY_availability_impact,
57 CVSS_KEY_BASE_END_,
58 CVSS_KEY_BASE_NUM = CVSS_KEY_BASE_END_ - CVSS_BASE,
59
60 CVSS_KEY_exploitability = CVSS_TEMPORAL,
61 CVSS_KEY_remediation_level,
62 CVSS_KEY_report_confidence,
63 CVSS_KEY_TEMPORAL_END_,
64 CVSS_KEY_TEMPORAL_NUM = CVSS_KEY_TEMPORAL_END_ - CVSS_TEMPORAL,
65
66 CVSS_KEY_collateral_damage_potential = CVSS_ENVIRONMENTAL,
67 CVSS_KEY_target_distribution,
68 CVSS_KEY_confidentiality_requirement,
69 CVSS_KEY_integrity_requirement,
70 CVSS_KEY_availability_requirement,
71 CVSS_KEY_ENVIRONMENTAL_END_,
72 CVSS_KEY_ENVIRONMENTAL_NUM = CVSS_KEY_ENVIRONMENTAL_END_ - CVSS_ENVIRONMENTAL,
73};
74
75// extract category from key
76#define CVSS_CATEGORY(key) ((key) & ~0xff)
77// extract key index within the category
78#define CVSS_KEY_IDX(key) ((key) & 0xff)
79
81 struct cvss_metrics *base_metrics;
82 struct cvss_metrics *temporal_metrics;
83 struct cvss_metrics *environmental_metrics;
84};
85
87 enum cvss_category category;
88 float score;
89 char *source;
90 char *upgraded_from_version;
91 char *generated_on_datetime;
92 union {
93 unsigned BASE[CVSS_KEY_BASE_NUM];
94 unsigned TEMPORAL[CVSS_KEY_TEMPORAL_NUM];
95 unsigned ENVIRONMENTAL[CVSS_KEY_ENVIRONMENTAL_NUM];
96 unsigned ANY[CVSSMAX(CVSSMAX(CVSS_KEY_BASE_NUM, CVSS_KEY_TEMPORAL_NUM), CVSS_KEY_ENVIRONMENTAL_NUM)];
97 } metrics;
98};
99
100struct cvss_impact *cvss_impact_new_from_xml(xmlTextReaderPtr reader);
101bool cvss_impact_export(const struct cvss_impact *imp, xmlTextWriterPtr writer);
102struct cvss_metrics *cvss_metrics_new_from_xml(xmlTextReaderPtr reader);
103bool cvss_metrics_export(const struct cvss_metrics *m, xmlTextWriterPtr writer);
104
105
106#endif
Interface to Common Vulnerability Scoring System Version 2.
cvss_category
CVSS score category.
Definition: cvss_score.h:48
CVSS impact.
Definition: cvss_priv.h:80
CVSS metrics.
Definition: cvss_priv.h:86