00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00032 #ifndef ALP_SECURITY_H_
00033 #define ALP_SECURITY_H_
00034
00035
00036
00037
00038
00039 #include <hiker/types.h>
00040 #include <sys/types.h>
00041 #include <hiker/sysclass.h>
00042 #include <unistd.h>
00043 #include <stdlib.h>
00044
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048
00049
00050
00051
00052
00056 #define ALP_STATUS_SPF_E_NOERR ( ALP_CLASS_SPF | 0x00 )
00057
00059 #define ALP_STATUS_SPF_NO_SERVER ( ALP_CLASS_SPF | 0x01 )
00060
00062 #define ALP_STATUS_SPF_INVALID_PARAM ( ALP_CLASS_SPF | 0x02 )
00063
00065 #define ALP_STATUS_SPF_MEM_ERROR ( ALP_CLASS_SPF | 0x03 )
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00085 #define ALP_SPF_T_STRING 0
00086
00088 #define ALP_SPF_T_BOOLEAN 1
00089
00091 #define ALP_SPF_T_INT 2
00092
00094 #define ALP_SPF_T_IPV4ADDR 3
00095
00097 #define ALP_SPF_T_PATH 4
00098
00100 #define ALP_SPF_T_URL 5
00101
00103 #define ALP_SPF_PKCS5_PIN 0
00104
00106 #define ALP_SPF_PKCS5_PUK 1
00107
00108
00109
00110
00111
00116 typedef unsigned int AlpSPFAssertionType;
00117
00118 typedef unsigned int AlpPackageID;
00119
00120 typedef struct {
00121 char *key;
00122 unsigned int value;
00123 } AlpSPFIntroInstance;
00124
00125 typedef struct {
00126 unsigned int version;
00127 AlpSPFIntroInstance **instances;
00128 } AlpSPFIntroInfo;
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00156 alp_status_t alp_spf_update_open( void );
00157
00169 alp_status_t alp_spf_update( char *message, uint message_len );
00170
00178 alp_status_t alp_spf_update_close( void );
00179
00180
00181
00182
00183
00191 alp_status_t alp_spf_ps_open( void );
00203 alp_status_t alp_spf_ps_get_policyname_from_policy( unsigned int policy, char **policyname );
00215 alp_status_t alp_spf_ps_get_policy_from_policyname( char *policyname, unsigned int *policy);
00216
00228 alp_status_t alp_spf_ps_packageid_increment( unsigned int packageid, unsigned int *out_count );
00229
00241 alp_status_t alp_spf_ps_packageid_decrement( unsigned int packageid, unsigned int *out_count );
00242
00254 alp_status_t alp_spf_ps_packageid_count( unsigned int packageid, unsigned int *out_count );
00255
00269 alp_status_t alp_spf_ps_get_policy_by_certificate( char *certificate, unsigned int certificate_length, unsigned int *policy);
00281 alp_status_t alp_spf_ps_get_policy_by_gid( gid_t gid, unsigned int *policy);
00299 alp_status_t alp_spf_ps_get_certificate_by_policy( unsigned int policy, char **certificate, unsigned int *certificate_length, char **certid, unsigned int *certid_length);
00311 alp_status_t alp_spf_ps_get_gid_by_policy( unsigned int policy, gid_t *gid );
00323 alp_status_t alp_spf_ps_get_policy_by_uid( uid_t uid, unsigned int *policy );
00337 alp_status_t alp_spf_ps_get_policy_by_package( char *path, unsigned int path_length, unsigned int *out_policy);
00349 alp_status_t alp_spf_ps_get_gids_length( unsigned int policy, unsigned int *size );
00368 alp_status_t alp_spf_ps_get_uid_gid_gids_by_policy( unsigned int policy, uid_t *uid, gid_t *gid, gid_t *sgids[], unsigned int *sgids_length );
00382 alp_status_t alp_prv_spf_ps_enroll_package( char *path, unsigned int path_length, unsigned int *out_packageid );
00390 alp_status_t alp_spf_ps_close( void );
00391
00392
00393
00394
00395
00403 alp_status_t alp_spf_query_open( void );
00404 alp_status_t alp_spf_query_set_subject_pid( pid_t subject_pid );
00405 alp_status_t alp_spf_query_reset_subject_pid( void );
00419 alp_status_t alp_spf_query_get_assertion_string( char *assertion, uint assertion_len, char **out_assertion_value);
00420 alp_status_t alp_spf_query_get_assertion_int( char *assertion, uint assertion_len, int *out_assertion_value );
00421 alp_status_t alp_spf_query_get_assertion_boolean( char *assertion, uint assertion_len, uint *out_assertion_value );
00422
00434 alp_status_t alp_spf_query_free_assertion_string( char *assertion, uint assertion_len );
00448 alp_status_t alp_spf_query_assertion_type( char *assertion, uint assertion_len, AlpSPFAssertionType *out_type );
00464 alp_status_t alp_spf_query_get_assertion_string_from_policy( char *policy, char *assertion, uint assertion_len, char **out_assertion_value );
00465 alp_status_t alp_spf_query_get_assertion_int_from_policy( char *policy, char *assertion, uint assertion_len, int *out_assertion_value );
00466 alp_status_t alp_spf_query_get_assertion_boolean_from_policy( char *policy, char *assertion, uint assertion_len, uint *out_assertion_value );
00467 alp_status_t alp_spf_query_assertion_type_from_policy( char *policy, char *assertion, uint assertion_len, AlpSPFAssertionType *out_type );
00475 alp_status_t alp_spf_query_close( void );
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487 alp_status_t alp_spf_info( AlpSPFIntroInfo **out_info );
00488
00489
00490
00491 alp_status_t alp_spf_pkcs5_set( unsigned int which, char *phrase );
00492 alp_status_t alp_spf_pkcs5_check( unsigned int which, char *phrase, unsigned int *correct );
00493 alp_status_t alp_spf_pkcs5_params_get( unsigned int which, unsigned int *iteration, char **salt, unsigned int *active );
00494 alp_status_t alp_spf_pkcs5_params_set( unsigned int which, unsigned int iteration, char *salt, unsigned int active );
00495
00496 #ifdef __cplusplus
00497 }
00498 #endif
00499
00502 #endif