cvss.c File Reference

Interface to Common Vulnerability Scoring System Version 2. More...

`#include <stdlib.h>`
`#include <math.h>`
`#include <string.h>`
`#include "public/cvss_score.h"`
`#include "cvss_priv.h"`
`#include "common/elements.h"`

## Data Structures

struct | cvss_keytab_entry
struct | cvss_valtab_entry

## Macros

#define | CVSS_SUPPORTED "2.0"
#define | NS_VULN_STR BAD_CAST "vuln"
#define | NS_CVSS_STR BAD_CAST "cvss"
#define | NS_VULN_URI BAD_CAST "http://scap.nist.gov/schema/vulnerability/0.4"
#define | NS_CVSS_URI BAD_CAST "http://scap.nist.gov/schema/cvss-v2/0.2"
#define | CVSS_W(key) (cvss_impact_entry(impact, CVSS_KEY_##key)->weight)
#define | CVSS_METRIC_ACCESSORS_GEN(cat, key, type)
#define | CVSS_METRIC_ACCESSORS_CIA(cat, key)
#define | CVSS_METRIC_ACCESSORS(cat, key) CVSS_METRIC_ACCESSORS_GEN(cat, key, key)

## Typedefs

typedef float(* | cvss_score_func )(const struct cvss_impact *)

## Functions

const char * | cvss_model_supported (void)
| Get supported version of CVSS XML.
struct cvss_impact * | cvss_impact_new (void)
struct cvss_impact * | cvss_impact_new_from_vector (const char *cvss_vector)
struct cvss_impact * | cvss_impact_new_from_xml (xmlTextReaderPtr reader)
struct cvss_impact * | cvss_impact_clone (const struct cvss_impact *imp)
bool | cvss_impact_export (const struct cvss_impact *imp, xmlTextWriterPtr writer)
bool | cvss_metrics_is_valid (const struct cvss_metrics *metrics)
char * | cvss_impact_to_vector (const struct cvss_impact *impact)
void | cvss_impact_free (struct cvss_impact *impact)
bool | cvss_impact_set_metrics (struct cvss_impact *impact, struct cvss_metrics *metrics)
float | cvss_round (float x)
| Round x to one decimal place as described in CVSS standard.
float | cvss_impact_base_exploitability_subscore (const struct cvss_impact *impact)
float | cvss_impact_base_impact_subscore (const struct cvss_impact *impact)
float | cvss_impact_base_score (const struct cvss_impact *impact)
float | cvss_impact_temporal_multiplier (const struct cvss_impact *impact)
float | cvss_impact_temporal_score (const struct cvss_impact *impact)
float | cvss_impact_base_adjusted_impact_subscore (const struct cvss_impact *impact)
float | cvss_impact_adjusted_base_score (const struct cvss_impact *impact)
float | cvss_impact_adjusted_temporal_score (const struct cvss_impact *impact)
float | cvss_impact_environmental_score (const struct cvss_impact *impact)
void | cvss_impact_describe (const struct cvss_impact *impact, FILE *f)
struct cvss_metrics * | cvss_metrics_new (enum cvss_category category)
struct cvss_metrics * | cvss_metrics_new_from_xml (xmlTextReaderPtr reader)
struct cvss_metrics * | cvss_metrics_clone (const struct cvss_metrics *met)
bool | cvss_metrics_export (const struct cvss_metrics *m, xmlTextWriterPtr writer)
void | cvss_metrics_free (struct cvss_metrics *metrics)

## Detailed Description

Interface to Common Vulnerability Scoring System Version 2.

See details at http://nvd.nist.gov/cvss.cfm

## Macro Definition Documentation

#define CVSS_METRIC_ACCESSORS_CIA | ( |  | cat,
|  |  | key
| ) |  |

Value:
CVSS_METRIC_ACCESSORS_GEN(cat, confidentiality_##key, cia_##key) \
CVSS_METRIC_ACCESSORS_GEN(cat, integrity_##key, cia_##key) CVSS_METRIC_ACCESSORS_GEN(cat, availability_##key, cia_##key)

#define CVSS_METRIC_ACCESSORS_GEN | ( |  | cat,
|  |  | key,
|  |  | type
| ) |  |

Value:
enum cvss_##type cvss_metrics_get_##key(const struct cvss_metrics* metrics) \
{ if (metrics->category != CVSS_##cat) return 0; return metrics->metrics.cat[CVSS_KEY_IDX(CVSS_KEY_##key)]; } \
bool cvss_metrics_set_##key(struct cvss_metrics* metrics, enum cvss_##type newval) \
{ if (metrics->category != CVSS_##cat) return false; metrics->metrics.cat[CVSS_KEY_IDX(CVSS_KEY_##key)] = newval; return true; }