Open SCAP Library
/home/pvrabec/project/openscap/openscap-0.7.3/src/CVSS/public/cvss.h
Go to the documentation of this file.
00001 
00010 /*
00011  * Copyright 2008-2009 Red Hat Inc., Durham, North Carolina.
00012  * All Rights Reserved.
00013  *
00014  * This library is free software; you can redistribute it and/or
00015  * modify it under the terms of the GNU Lesser General Public
00016  * License as published by the Free Software Foundation; either
00017  * version 2.1 of the License, or (at your option) any later version.
00018  *
00019  * This library is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022  * Lesser General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public
00025  * License along with this library; if not, write to the Free Software
00026  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027  *
00028  * Authors:
00029  *      Tomas Heinrich <theinric@redhat.com>
00030  *      Peter Vrabec   <pvrabec@redhat.com>
00031  *      Brandon Dixon  <Brandon.Dixon@g2-inc.com>
00032  */
00033 
00034 
00035 #ifndef _CVSSCALC_H_
00036 #define _CVSSCALC_H_
00037 
00038 #include <stdbool.h>
00039 
00044 struct cvss_entry;
00045 
00046 /************************************************************/
00060 const char* cvss_entry_get_score(const struct cvss_entry * entry);
00067 const char* cvss_entry_get_AV(const struct cvss_entry * entry);
00074 const char* cvss_entry_get_AC(const struct cvss_entry * entry);
00081 const char* cvss_entry_get_authentication(const struct cvss_entry * entry);
00088 const char* cvss_entry_get_imp_confidentiality(const struct cvss_entry * entry);
00095 const char* cvss_entry_get_imp_integrity(const struct cvss_entry * entry);
00102 const char* cvss_entry_get_imp_availability(const struct cvss_entry * entry);
00109 const char* cvss_entry_get_source(const struct cvss_entry * entry);
00116 const char* cvss_entry_get_generated(const struct cvss_entry * entry);
00117 
00118 /************************************************************/
00121 /************************************************************/
00136 bool cvss_entry_set_score(struct cvss_entry *entry, const char *new_score);
00144 bool cvss_entry_set_AV(struct cvss_entry *entry, const char *new_AV);
00152 bool cvss_entry_set_AC(struct cvss_entry *entry, const char *new_AC);
00160 bool cvss_entry_set_authentication(struct cvss_entry *entry, const char *new_authentication);
00168 bool cvss_entry_set_imp_confidentiality(struct cvss_entry *entry, const char *new_item);
00176 bool cvss_entry_set_imp_integrity(struct cvss_entry *entry, const char *new_item);
00184 bool cvss_entry_set_imp_availability(struct cvss_entry *entry, const char *new_item);
00192 bool cvss_entry_set_source(struct cvss_entry *entry, const char *new_source);
00200 bool cvss_entry_set_generated(struct cvss_entry *entry, const char *new_generated);
00201 
00202 /************************************************************/
00210 struct cvss_entry * cvss_entry_new(void);
00211 
00217 struct cvss_entry * cvss_entry_clone(struct cvss_entry * old_entry);
00218 
00224 void cvss_entry_free(struct cvss_entry * entry);
00225 
00227 
00228 typedef enum {
00229         AV_LOCAL,            
00230         AV_ADJACENT_NETWORK, 
00231         AV_NETWORK           
00232 } cvss_access_vector_t;
00233 
00235 
00238 typedef enum {
00239         AC_HIGH,
00240         AC_MEDIUM,
00241         AC_LOW
00242 } cvss_access_complexity_t;
00243 
00245 
00248 typedef enum {
00249         AU_NONE,             
00250         AU_SINGLE_INSTANCE,  
00251         AU_MULTIPLE_INSTANCE 
00252 } cvss_authentication_t;
00253 
00255 
00258 typedef enum {
00259         CI_NONE,
00260         CI_PARTIAL,
00261         CI_COMPLETE
00262 } cvss_conf_impact_t;
00263 
00265 
00268 typedef enum {
00269         II_NONE,
00270         II_PARTIAL,
00271         II_COMPLETE
00272 } cvss_integ_impact_t;
00273 
00275 
00278 typedef enum {
00279         AI_NONE,
00280         AI_PARTIAL,
00281         AI_COMPLETE
00282 } cvss_avail_impact_t;
00283 
00285 
00288 typedef enum {
00289         EX_UNPROVEN,
00290         EX_PROOF_OF_CONCEPT,
00291         EX_FUNCTIONAL,
00292         EX_HIGH,
00293         EX_NOT_DEFINED
00294 } cvss_exploitability_t;
00295 
00297 
00300 typedef enum {
00301         RL_OFFICIAL_FIX,
00302         RL_TEMPORARY_FIX,
00303         RL_WORKAROUND,
00304         RL_UNAVAILABLE,
00305         RL_NOT_DEFINED
00306 } cvss_remediation_level_t;
00307 
00309 
00313 typedef enum {
00314         RC_UNCONFIRMED,
00315         RC_UNCORROBORATED,
00316         RC_CONFIRMED,
00317         RC_NOT_DEFINED
00318 } cvss_report_confidence_t;
00319 
00321 
00324 typedef enum {
00325         CD_NONE,
00326         CD_LOW,
00327         CD_LOW_MEDIUM,
00328         CD_MEDIUM_HIGH,
00329         CD_HIGH,
00330         CD_NOT_DEFINED
00331 } cvss_collateral_damage_potential_t;
00332 
00334 
00338 typedef enum {
00339         TD_NONE,
00340         TD_LOW,
00341         TD_MEDIUM,
00342         TD_HIGH,
00343         TD_NOT_DEFINED
00344 } cvss_target_distribution_t;
00345 
00347 
00351 typedef enum {
00352         CR_LOW,
00353         CR_MEDIUM,
00354         CR_HIGH,
00355         CR_NOT_DEFINED
00356 } cvss_conf_req_t;
00357 
00359 
00363 typedef enum {
00364         IR_LOW,
00365         IR_MEDIUM,
00366         IR_HIGH,
00367         IR_NOT_DEFINED
00368 } cvss_integ_req_t;
00369 
00371 
00375 typedef enum {
00376         AR_LOW,
00377         AR_MEDIUM,
00378         AR_HIGH,
00379         AR_NOT_DEFINED
00380 } cvss_avail_req_t;
00381 
00382 
00383 /************************************************************/
00396 int cvss_base_score(cvss_access_vector_t ave, cvss_access_complexity_t ace, cvss_authentication_t aue,
00397                     cvss_conf_impact_t   cie, cvss_integ_impact_t      iie, cvss_avail_impact_t   aie, 
00398                     double *base_score, 
00399                     double *impact_score, 
00400                     double *exploitability_score);
00401 
00406 int cvss_temp_score(cvss_exploitability_t    exe, cvss_remediation_level_t rle, 
00407                     cvss_report_confidence_t rce, double             base_score, 
00408                     double             *temporal_score);
00409 
00419 int cvss_env_score(cvss_collateral_damage_potential_t cde, cvss_target_distribution_t   tde, 
00420                    cvss_conf_req_t                    cre, cvss_integ_req_t             ire, 
00421                    cvss_avail_req_t                   are, cvss_access_vector_t         ave, 
00422                    cvss_access_complexity_t           ace, cvss_authentication_t        aue, 
00423                    cvss_conf_impact_t                 cie, cvss_integ_impact_t          iie, 
00424                    cvss_avail_impact_t                aie, cvss_exploitability_t        exe, 
00425                    cvss_remediation_level_t           rle, cvss_report_confidence_t     rce, 
00426                    double *enviromental_score);
00431 int cvss_base_score_struct(const struct cvss_entry * entry,
00432                            double *base_score,
00433                            double *impact_score,
00434                            double *exploitability_score);
00435 
00441 const char * cvss_model_supported(void);
00442 
00443 /************************************************************/
00447 #endif /* _CVSSCALC_H_ */