📄 kssl.c
字号:
}krb5_error_codekssl_krb5_get_credentials(krb5_context CO, krb5_const krb5_flags F, krb5_ccache CC, krb5_creds * pCR, krb5_creds ** ppCR) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_get_credentials ) return(p_krb5_get_credentials(CO,F,CC,pCR,ppCR)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekssl_krb5_sname_to_principal(krb5_context CO, krb5_const char * pC1, krb5_const char * pC2, krb5_int32 I, krb5_principal * pPR) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_sname_to_principal ) return(p_krb5_sname_to_principal(CO,pC1,pC2,I,pPR)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekssl_krb5_cc_default(krb5_context CO, krb5_ccache * pCC) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_cc_default ) return(p_krb5_cc_default(CO,pCC)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekssl_krb5_init_context(krb5_context * pCO) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_init_context ) return(p_krb5_init_context(pCO)); else return KRB5KRB_ERR_GENERIC; }voidkssl_krb5_free_context(krb5_context CO) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_free_context ) p_krb5_free_context(CO); }voidkssl_krb5_free_principal(krb5_context c, krb5_principal p) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_free_principal ) p_krb5_free_principal(c,p); }krb5_error_codekssl_krb5_kt_resolve(krb5_context con, krb5_const char * sz, krb5_keytab * kt) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_kt_resolve ) return(p_krb5_kt_resolve(con,sz,kt)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekssl_krb5_kt_default(krb5_context con, krb5_keytab * kt) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_kt_default ) return(p_krb5_kt_default(con,kt)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekssl_krb5_free_ticket(krb5_context con, krb5_ticket * kt) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_free_ticket ) return(p_krb5_free_ticket(con,kt)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekssl_krb5_rd_req(krb5_context con, krb5_auth_context * pacon, krb5_const krb5_data * data, krb5_const_principal princ, krb5_keytab keytab, krb5_flags * flags, krb5_ticket ** pptkt) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_rd_req ) return(p_krb5_rd_req(con,pacon,data,princ,keytab,flags,pptkt)); else return KRB5KRB_ERR_GENERIC; }krb5_booleankrb5_principal_compare(krb5_context con, krb5_const_principal princ1, krb5_const_principal princ2) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_principal_compare ) return(p_krb5_principal_compare(con,princ1,princ2)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekrb5_decrypt_tkt_part(krb5_context con, krb5_const krb5_keyblock *keys, krb5_ticket *ticket) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_decrypt_tkt_part ) return(p_krb5_decrypt_tkt_part(con,keys,ticket)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekrb5_timeofday(krb5_context con, krb5_int32 *timeret) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_timeofday ) return(p_krb5_timeofday(con,timeret)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekrb5_rc_default(krb5_context con, krb5_rcache *rc) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_rc_default ) return(p_krb5_rc_default(con,rc)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekrb5_rc_initialize(krb5_context con, krb5_rcache rc, krb5_deltat lifespan) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_rc_initialize ) return(p_krb5_rc_initialize(con, rc, lifespan)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekrb5_rc_get_lifespan(krb5_context con, krb5_rcache rc, krb5_deltat *lifespanp) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_rc_get_lifespan ) return(p_krb5_rc_get_lifespan(con, rc, lifespanp)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekrb5_rc_destroy(krb5_context con, krb5_rcache rc) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_rc_destroy ) return(p_krb5_rc_destroy(con, rc)); else return KRB5KRB_ERR_GENERIC; }size_t krb5_checksum_size(krb5_context context,krb5_cksumtype ctype) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_checksum_size ) return(p_krb5_checksum_size(context, ctype)); else return KRB5KRB_ERR_GENERIC; }krb5_boolean valid_cksumtype(krb5_cksumtype ctype) { if (!krb5_loaded) load_krb5_dll(); if ( p_valid_cksumtype ) return(p_valid_cksumtype(ctype)); else return KRB5KRB_ERR_GENERIC; }krb5_error_code krb5_kt_free_entry(krb5_context con,krb5_keytab_entry * entry) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_kt_free_entry ) return(p_krb5_kt_free_entry(con,entry)); else return KRB5KRB_ERR_GENERIC; } /* Structure definitions */#ifndef NO_DEF_KRB5_CCACHE#ifndef krb5_x#define krb5_x(ptr,args) ((ptr)?((*(ptr)) args):(abort(),1))#define krb5_xc(ptr,args) ((ptr)?((*(ptr)) args):(abort(),(char*)0))#endif typedef krb5_pointer krb5_cc_cursor; /* cursor for sequential lookup */typedef struct _krb5_ccache { krb5_magic magic; struct _krb5_cc_ops FAR *ops; krb5_pointer data; } *krb5_ccache;typedef struct _krb5_cc_ops { krb5_magic magic; char *prefix; char * (KRB5_CALLCONV *get_name) (krb5_context, krb5_ccache); krb5_error_code (KRB5_CALLCONV *resolve) (krb5_context, krb5_ccache *, const char *); krb5_error_code (KRB5_CALLCONV *gen_new) (krb5_context, krb5_ccache *); krb5_error_code (KRB5_CALLCONV *init) (krb5_context, krb5_ccache, krb5_principal); krb5_error_code (KRB5_CALLCONV *destroy) (krb5_context, krb5_ccache); krb5_error_code (KRB5_CALLCONV *close) (krb5_context, krb5_ccache); krb5_error_code (KRB5_CALLCONV *store) (krb5_context, krb5_ccache, krb5_creds *); krb5_error_code (KRB5_CALLCONV *retrieve) (krb5_context, krb5_ccache, krb5_flags, krb5_creds *, krb5_creds *); krb5_error_code (KRB5_CALLCONV *get_princ) (krb5_context, krb5_ccache, krb5_principal *); krb5_error_code (KRB5_CALLCONV *get_first) (krb5_context, krb5_ccache, krb5_cc_cursor *); krb5_error_code (KRB5_CALLCONV *get_next) (krb5_context, krb5_ccache, krb5_cc_cursor *, krb5_creds *); krb5_error_code (KRB5_CALLCONV *end_get) (krb5_context, krb5_ccache, krb5_cc_cursor *); krb5_error_code (KRB5_CALLCONV *remove_cred) (krb5_context, krb5_ccache, krb5_flags, krb5_creds *); krb5_error_code (KRB5_CALLCONV *set_flags) (krb5_context, krb5_ccache, krb5_flags); } krb5_cc_ops;#endif /* NO_DEF_KRB5_CCACHE */krb5_error_code kssl_krb5_cc_get_principal (krb5_context context, krb5_ccache cache, krb5_principal *principal) { if ( p_krb5_cc_get_principal ) return(p_krb5_cc_get_principal(context,cache,principal)); else return(krb5_x ((cache)->ops->get_princ,(context, cache, principal))); }krb5_error_codekssl_krb5_auth_con_setrcache(krb5_context con, krb5_auth_context acon, krb5_rcache rcache) { if ( p_krb5_auth_con_setrcache ) return(p_krb5_auth_con_setrcache(con,acon,rcache)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekssl_krb5_get_server_rcache(krb5_context con, krb5_const krb5_data * data, krb5_rcache * rcache) { if ( p_krb5_get_server_rcache ) return(p_krb5_get_server_rcache(con,data,rcache)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekssl_krb5_auth_con_getrcache(krb5_context con, krb5_auth_context acon, krb5_rcache * prcache) { if ( p_krb5_auth_con_getrcache ) return(p_krb5_auth_con_getrcache(con,acon, prcache)); else return KRB5KRB_ERR_GENERIC; } krb5_error_codekssl_krb5_kt_close(krb5_context context, krb5_keytab keytab) { if ( p_krb5_kt_close ) return(p_krb5_kt_close(context,keytab)); else return KRB5KRB_ERR_GENERIC; }krb5_error_codekssl_krb5_kt_get_entry(krb5_context context, krb5_keytab keytab, krb5_const_principal principal, krb5_kvno vno, krb5_enctype enctype, krb5_keytab_entry *entry) { if ( p_krb5_kt_get_entry ) return(p_krb5_kt_get_entry(context,keytab,principal,vno,enctype,entry)); else return KRB5KRB_ERR_GENERIC; }#endif /* OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32 */char*kstring(char *string) { static char *null = "[NULL]"; return ((string == NULL)? null: string); }/* Given KRB5 enctype (basically DES or 3DES),** return closest match openssl EVP_ encryption algorithm.** Return NULL for unknown or problematic (krb5_dk_encrypt) enctypes.** Assume ENCTYPE_*_RAW (krb5_raw_encrypt) are OK.*/const EVP_CIPHER *kssl_map_enc(krb5_enctype enctype) { switch (enctype) { case ENCTYPE_DES_HMAC_SHA1: /* EVP_des_cbc(); */ case ENCTYPE_DES_CBC_CRC: case ENCTYPE_DES_CBC_MD4: case ENCTYPE_DES_CBC_MD5: case ENCTYPE_DES_CBC_RAW: return EVP_des_cbc(); break; case ENCTYPE_DES3_CBC_SHA1: /* EVP_des_ede3_cbc(); */ case ENCTYPE_DES3_CBC_SHA: case ENCTYPE_DES3_CBC_RAW: return EVP_des_ede3_cbc(); break; default: return NULL; break; } }/* Return true:1 if p "looks like" the start of the real authenticator** described in kssl_skip_confound() below. The ASN.1 pattern is** "62 xx 30 yy" (APPLICATION-2, SEQUENCE), where xx-yy =~ 2, and** xx and yy are possibly multi-byte length fields.*/int kssl_test_confound(unsigned char *p) { int len = 2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -