From c9ee9a0e791adbddcf06191a26bfaf7f9bc936a8 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Tue, 7 Sep 2010 18:32:28 +0200 Subject: [PATCH] Add some additional files --- mech_eap/accept_sec_context.c | 15 ++++++++ mech_eap/acquire_cred.c | 12 +++++++ mech_eap/acquire_cred_with_password.c | 13 +++++++ mech_eap/add_cred.c | 15 ++++++++ mech_eap/add_cred_with_password.c | 17 ++++++++++ mech_eap/canonicalize_name.c | 7 ++++ mech_eap/compare_name.c | 8 +++++ mech_eap/context_time.c | 27 +++++++++++++++ mech_eap/delete_sec_context.c | 19 +++++++++++ mech_eap/display_name.c | 8 +++++ mech_eap/display_name_ext.c | 8 +++++ mech_eap/duplicate_name.c | 7 ++++ mech_eap/export_name.c | 7 ++++ mech_eap/export_sec_context.c | 7 ++++ mech_eap/get_mic.c | 9 +++++ mech_eap/get_name_attribute.c | 12 +++++++ mech_eap/import_name.c | 8 +++++ mech_eap/import_sec_context.c | 7 ++++ mech_eap/indicate_mechs.c | 6 ++++ mech_eap/init_sec_context.c | 2 +- mech_eap/inquire_context.c | 64 +++++++++++++++++++++++++++++++++++ mech_eap/inquire_cred.c | 10 ++++++ mech_eap/inquire_cred_by_oid.c | 8 +++++ mech_eap/inquire_mechs_for_name.c | 7 ++++ mech_eap/inquire_names_for_mech.c | 7 ++++ mech_eap/inquire_sec_context_by_oid.c | 8 +++++ mech_eap/map_name_to_any.c | 9 +++++ mech_eap/mech_invoke.c | 8 +++++ mech_eap/process_context_token.c | 7 ++++ mech_eap/pseudo_random.c | 10 ++++++ mech_eap/release_any_name_mapping.c | 8 +++++ mech_eap/release_cred.c | 6 ++++ mech_eap/release_name.c | 6 ++++ mech_eap/set_cred_option.c | 10 ++++++ mech_eap/set_name_attribute.c | 9 +++++ mech_eap/set_sec_context_option.c | 8 +++++ mech_eap/store_cred.c | 12 +++++++ mech_eap/unwrap.c | 28 +++++++++++++++ mech_eap/unwrap_iov.c | 10 ++++++ mech_eap/util_context.c | 2 +- mech_eap/util_cred.c | 3 +- mech_eap/util_name.c | 9 +++-- mech_eap/verify_mic.c | 9 +++++ mech_eap/wrap.c | 60 ++++++++++++++++++++++++++++++++ mech_eap/wrap_iov.c | 11 ++++++ mech_eap/wrap_iov_length.c | 11 ++++++ mech_eap/wrap_size_limit.c | 42 +++++++++++++++++++++++ 47 files changed, 590 insertions(+), 6 deletions(-) diff --git a/mech_eap/accept_sec_context.c b/mech_eap/accept_sec_context.c index 3e0654b..fe2c8dd 100644 --- a/mech_eap/accept_sec_context.c +++ b/mech_eap/accept_sec_context.c @@ -32,3 +32,18 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_accept_sec_context(OM_uint32 *minor, + gss_ctx_id_t *context_handle, + gss_cred_id_t acceptor_cred_handle, + gss_buffer_t input_token_buffer, + gss_channel_bindings_t input_chan_bindings, + gss_name_t *src_name, + gss_OID *mech_type, + gss_buffer_t output_token, + OM_uint32 *ret_flags, + OM_uint32 *time_rec, + gss_cred_id_t *delegated_cred_handle) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/acquire_cred.c b/mech_eap/acquire_cred.c index 3e0654b..0bb1f1f 100644 --- a/mech_eap/acquire_cred.c +++ b/mech_eap/acquire_cred.c @@ -32,3 +32,15 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_acquire_cred(OM_uint32 *minor, + gss_name_t desired_name, + OM_uint32 time_req, + gss_OID_set desired_mechs, + gss_cred_usage_t cred_usage, + gss_cred_id_t *output_cred_handle, + gss_OID_set *actual_mechs, + OM_uint32 *time_rec) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/acquire_cred_with_password.c b/mech_eap/acquire_cred_with_password.c index 3e0654b..776ecba 100644 --- a/mech_eap/acquire_cred_with_password.c +++ b/mech_eap/acquire_cred_with_password.c @@ -32,3 +32,16 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_acquire_cred_with_password(OM_uint32 *minor, + const gss_name_t desired_name, + const gss_buffer_t password, + OM_uint32 time_req, + const gss_OID_set desired_mechs, + gss_cred_usage_t cred_usage, + gss_cred_id_t *output_cred_handle, + gss_OID_set *actual_mechs, + OM_uint32 *time_rec) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/add_cred.c b/mech_eap/add_cred.c index 3e0654b..80b4b24 100644 --- a/mech_eap/add_cred.c +++ b/mech_eap/add_cred.c @@ -32,3 +32,18 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_add_cred(OM_uint32 *minor, + gss_cred_id_t input_cred_handle, + gss_name_t desired_name, + gss_OID desired_mech, + gss_cred_usage_t cred_usage, + OM_uint32 initiator_time_req, + OM_uint32 acceptor_time_req, + gss_cred_id_t *output_cred_handle, + gss_OID_set *actual_mechs, + OM_uint32 *initiator_time_rec, + OM_uint32 *acceptor_time_rec) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/add_cred_with_password.c b/mech_eap/add_cred_with_password.c index 3e0654b..a24f6a0 100644 --- a/mech_eap/add_cred_with_password.c +++ b/mech_eap/add_cred_with_password.c @@ -32,3 +32,20 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_add_cred_with_password(OM_uint32 *minor, + const gss_cred_id_t input_cred_handle, + const gss_name_t desired_name, + const gss_OID desired_mech, + const gss_buffer_t password, + gss_cred_usage_t cred_usage, + OM_uint32 initiator_time_req, + OM_uint32 acceptor_time_req, + gss_cred_id_t *output_cred_handle, + gss_OID_set *actual_mechs, + OM_uint32 *initiator_time_rec, + OM_uint32 *acceptor_time_rec) +{ + GSSEAP_NOT_IMPLEMENTED; +} + diff --git a/mech_eap/canonicalize_name.c b/mech_eap/canonicalize_name.c index 3e0654b..5527e38 100644 --- a/mech_eap/canonicalize_name.c +++ b/mech_eap/canonicalize_name.c @@ -32,3 +32,10 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_canonicalize_name(OM_uint32 *minor, + const gss_name_t input_name, + const gss_OID mech_type, + gss_name_t *output_name) +{ +} diff --git a/mech_eap/compare_name.c b/mech_eap/compare_name.c index 3e0654b..6c4af98 100644 --- a/mech_eap/compare_name.c +++ b/mech_eap/compare_name.c @@ -32,3 +32,11 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_compare_name(OM_uint32 *minor, + gss_name_t name1, + gss_name_t name2, + int *name_equal) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/context_time.c b/mech_eap/context_time.c index 3e0654b..8f111d6 100644 --- a/mech_eap/context_time.c +++ b/mech_eap/context_time.c @@ -32,3 +32,30 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_context_time(OM_uint32 *minor, + gss_ctx_id_t context_handle, + OM_uint32 *time_rec) +{ + time_t now, lifetime; + + if (context_handle == GSS_C_NO_CONTEXT) { + return GSS_S_NO_CONTEXT; + } + + if (!CTX_IS_ESTABLISHED(context_handle)) { + return GSS_S_NO_CONTEXT; + } + + *minor = 0; + + time(&now); + lifetime = context_handle->expiryTime - now; + if (lifetime <= 0) { + *time_rec = 0; + return GSS_S_CONTEXT_EXPIRED; + } + + *time_rec = lifetime; + return GSS_S_COMPLETE; +} diff --git a/mech_eap/delete_sec_context.c b/mech_eap/delete_sec_context.c index 3e0654b..b8d41a7 100644 --- a/mech_eap/delete_sec_context.c +++ b/mech_eap/delete_sec_context.c @@ -32,3 +32,22 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_delete_sec_context(OM_uint32 *minor, + gss_ctx_id_t *context_handle, + gss_buffer_t output_token) +{ + if (output_token != GSS_C_NO_BUFFER) { + output_token->length = 0; + output_token->value = NULL; + } + + if (*context_handle == GSS_C_NO_CONTEXT) { + *minor = 0; + return GSS_S_COMPLETE; + } + + /* Delete context token? */ + + return gssEapReleaseContext(minor, context_handle); +} diff --git a/mech_eap/display_name.c b/mech_eap/display_name.c index 3e0654b..0886263 100644 --- a/mech_eap/display_name.c +++ b/mech_eap/display_name.c @@ -32,3 +32,11 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_display_name(OM_uint32 *minor, + gss_name_t input_name, + gss_buffer_t output_name_buffer, + gss_OID *output_name_type) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/display_name_ext.c b/mech_eap/display_name_ext.c index 3e0654b..417f722 100644 --- a/mech_eap/display_name_ext.c +++ b/mech_eap/display_name_ext.c @@ -32,3 +32,11 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_display_name_ext(OM_uint32 *minor, + gss_name_t name, + gss_OID display_as_name_type, + gss_buffer_t display_name) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/duplicate_name.c b/mech_eap/duplicate_name.c index 3e0654b..97e6158 100644 --- a/mech_eap/duplicate_name.c +++ b/mech_eap/duplicate_name.c @@ -32,3 +32,10 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_duplicate_name(OM_uint32 *minor, + const gss_name_t input_name, + gss_name_t *dest_name) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/export_name.c b/mech_eap/export_name.c index 3e0654b..7427cc0 100644 --- a/mech_eap/export_name.c +++ b/mech_eap/export_name.c @@ -32,3 +32,10 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_export_name(OM_uint32 *minor, + const gss_name_t input_name, + gss_buffer_t exported_name) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/export_sec_context.c b/mech_eap/export_sec_context.c index 3e0654b..0285dce 100644 --- a/mech_eap/export_sec_context.c +++ b/mech_eap/export_sec_context.c @@ -32,3 +32,10 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_export_sec_context(OM_uint32 *minor, + gss_ctx_id_t *context_handle, + gss_buffer_t interprocess_token) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/get_mic.c b/mech_eap/get_mic.c index 3e0654b..5b391b6 100644 --- a/mech_eap/get_mic.c +++ b/mech_eap/get_mic.c @@ -32,3 +32,12 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_get_mic(OM_uint32 *minor, + gss_ctx_id_t context_handle, + gss_qop_t qop_req, + gss_buffer_t message_buffer, + gss_buffer_t message_token) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/get_name_attribute.c b/mech_eap/get_name_attribute.c index 3e0654b..400ee9c 100644 --- a/mech_eap/get_name_attribute.c +++ b/mech_eap/get_name_attribute.c @@ -32,3 +32,15 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_get_name_attribute(OM_uint32 *minor, + gss_name_t name, + gss_buffer_t attr, + int *authenticated, + int *complete, + gss_buffer_t value, + gss_buffer_t display_value, + int *more) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/import_name.c b/mech_eap/import_name.c index 3e0654b..152bb21 100644 --- a/mech_eap/import_name.c +++ b/mech_eap/import_name.c @@ -32,3 +32,11 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_import_name(OM_uint32 *minor, + gss_buffer_t import_name_buffer, + gss_OID input_name_type, + gss_name_t *output_name) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/import_sec_context.c b/mech_eap/import_sec_context.c index 3e0654b..d8794dc 100644 --- a/mech_eap/import_sec_context.c +++ b/mech_eap/import_sec_context.c @@ -32,3 +32,10 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_import_sec_context(OM_uint32 *minor, + gss_buffer_t interprocess_token, + gss_ctx_id_t *context_handle) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/indicate_mechs.c b/mech_eap/indicate_mechs.c index 3e0654b..373e481 100644 --- a/mech_eap/indicate_mechs.c +++ b/mech_eap/indicate_mechs.c @@ -32,3 +32,9 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_indicate_mechs(OM_uint32 *minor, + gss_OID_set *mech_set) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/init_sec_context.c b/mech_eap/init_sec_context.c index 719b093..ba338a8 100644 --- a/mech_eap/init_sec_context.c +++ b/mech_eap/init_sec_context.c @@ -138,4 +138,4 @@ peerSetInt(void *data, enum eapol_int_var variable, break; } } - + diff --git a/mech_eap/inquire_context.c b/mech_eap/inquire_context.c index 3e0654b..daa4602 100644 --- a/mech_eap/inquire_context.c +++ b/mech_eap/inquire_context.c @@ -32,3 +32,67 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_inquire_context(OM_uint32 *minor, + gss_ctx_id_t ctx, + gss_name_t *src_name, + gss_name_t *targ_name, + OM_uint32 *lifetime_rec, + gss_OID *mech_type, + OM_uint32 *ctx_flags, + int *locally_initiated, + int *open) +{ + OM_uint32 major, tmpMinor; + + *minor = 0; + + if (ctx == GSS_C_NO_CONTEXT) { + major = GSS_S_NO_CONTEXT; + goto cleanup; + } + + if (src_name != NULL) { + major = gss_duplicate_name(minor, ctx->initiatorName, src_name); + if (GSS_ERROR(major)) + goto cleanup; + } + + if (targ_name != NULL) { + major = gss_duplciate_name(minor, ctx->acceptorName, targ_name); + if (GSS_ERROR(major)) + goto cleanup; + } + + if (lifetime_rec != NULL) { + time_t now = time(NULL); + time_t lifetime = now - ctx->expiryTime; + + if (lifetime < 0) + lifetime = 0; + + *lifetime_rec = lifetime; + } + + if (ctx_flags != NULL) { + *ctx_flags = ctx->gssFlags; + } + + if (locally_initiated != NULL) { + *locally_initiated = CTX_IS_INITIATOR(ctx); + } + + if (open != NULL) { + *open = CTX_IS_ESTABLISHED(ctx); + } + + major = GSS_S_COMPLETE; + +cleanup: + if (GSS_ERROR(major)) { + gssEapReleaseName(&tmpMinor, src_name); + gssEapReleaseName(&tmpMinor, targ_name); + } + + return major; +} diff --git a/mech_eap/inquire_cred.c b/mech_eap/inquire_cred.c index 3e0654b..8c24866 100644 --- a/mech_eap/inquire_cred.c +++ b/mech_eap/inquire_cred.c @@ -32,3 +32,13 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_inquire_cred(OM_uint32 *minor, + gss_cred_id_t cred_handle, + gss_name_t *name, + OM_uint32 *lifetime, + gss_cred_usage_t *cred_usage, + gss_OID_set *mechanisms) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/inquire_cred_by_oid.c b/mech_eap/inquire_cred_by_oid.c index 3e0654b..e6d2972 100644 --- a/mech_eap/inquire_cred_by_oid.c +++ b/mech_eap/inquire_cred_by_oid.c @@ -32,3 +32,11 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_inquire_cred_by_oid(OM_uint32 *minor, + const gss_cred_id_t cred_handle, + const gss_OID desired_object, + gss_buffer_set_t *data_set) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/inquire_mechs_for_name.c b/mech_eap/inquire_mechs_for_name.c index 3e0654b..2624dac 100644 --- a/mech_eap/inquire_mechs_for_name.c +++ b/mech_eap/inquire_mechs_for_name.c @@ -32,3 +32,10 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_inquire_mechs_for_name(OM_uint32 *minor, + const gss_name_t input_name, + gss_OID_set *mech_types) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/inquire_names_for_mech.c b/mech_eap/inquire_names_for_mech.c index 3e0654b..e4e1980 100644 --- a/mech_eap/inquire_names_for_mech.c +++ b/mech_eap/inquire_names_for_mech.c @@ -32,3 +32,10 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_inquire_names_for_mech(OM_uint32 *minor, + gss_OID mechanism, + gss_OID_set *name_types) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/inquire_sec_context_by_oid.c b/mech_eap/inquire_sec_context_by_oid.c index 3e0654b..578a955 100644 --- a/mech_eap/inquire_sec_context_by_oid.c +++ b/mech_eap/inquire_sec_context_by_oid.c @@ -32,3 +32,11 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_inquire_sec_context_by_oid(OM_uint32 *minor, + const gss_ctx_id_t context_handle, + const gss_OID desired_object, + gss_buffer_set_t *data_set) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/map_name_to_any.c b/mech_eap/map_name_to_any.c index 3e0654b..e02fecb 100644 --- a/mech_eap/map_name_to_any.c +++ b/mech_eap/map_name_to_any.c @@ -32,3 +32,12 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_map_name_to_any(OM_uint32 *minor, + gss_name_t name, + int authenticated, + gss_buffer_t type_id, + gss_any_t *output) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/mech_invoke.c b/mech_eap/mech_invoke.c index 3e0654b..df58177 100644 --- a/mech_eap/mech_invoke.c +++ b/mech_eap/mech_invoke.c @@ -32,3 +32,11 @@ #include "gssapiP_eap.h" +OM_uint32 +gssspi_mech_invoke(OM_uint32 *minor, + const gss_OID desired_mech, + const gss_OID desired_object, + gss_buffer_t value) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/process_context_token.c b/mech_eap/process_context_token.c index 3e0654b..c9fa486 100644 --- a/mech_eap/process_context_token.c +++ b/mech_eap/process_context_token.c @@ -32,3 +32,10 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_process_context_token(OM_uint32 *minor, + gss_ctx_id_t ctx, + gss_buffer_t token_buffer) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/pseudo_random.c b/mech_eap/pseudo_random.c index 3e0654b..c4918f5 100644 --- a/mech_eap/pseudo_random.c +++ b/mech_eap/pseudo_random.c @@ -32,3 +32,13 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_pseudo_random(OM_uint32 *minor, + gss_ctx_id_t context, + int prf_key, + const gss_buffer_t prf_in, + ssize_t desired_output_len, + gss_buffer_t prf_out) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/release_any_name_mapping.c b/mech_eap/release_any_name_mapping.c index 3e0654b..5ccc036 100644 --- a/mech_eap/release_any_name_mapping.c +++ b/mech_eap/release_any_name_mapping.c @@ -32,3 +32,11 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_release_any_name_mapping(OM_uint32 *minor, + gss_name_t name, + gss_buffer_t type_id, + gss_any_t *input) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/release_cred.c b/mech_eap/release_cred.c index 3e0654b..0dbcda7 100644 --- a/mech_eap/release_cred.c +++ b/mech_eap/release_cred.c @@ -32,3 +32,9 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_release_cred(OM_uint32 *minor, + gss_cred_id_t *cred_handle) +{ + return gssEapReleaseCred(minor, cred_handle); +} diff --git a/mech_eap/release_name.c b/mech_eap/release_name.c index 3e0654b..d85a81d 100644 --- a/mech_eap/release_name.c +++ b/mech_eap/release_name.c @@ -32,3 +32,9 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_release_name(OM_uint32 *minor, + gss_name_t *name) +{ + return gssEapReleaseName(minor, name); +} diff --git a/mech_eap/set_cred_option.c b/mech_eap/set_cred_option.c index 3e0654b..09dac65 100644 --- a/mech_eap/set_cred_option.c +++ b/mech_eap/set_cred_option.c @@ -32,3 +32,13 @@ #include "gssapiP_eap.h" +#if 0 +OM_uint32 +gssspi_set_cred_option(OM_uint32 *minor, + gss_cred_id_t cred, + const gss_OID desired_object, + const gss_buffer_t value) +{ + GSSEAP_NOT_IMPLEMENTED; +} +#endif diff --git a/mech_eap/set_name_attribute.c b/mech_eap/set_name_attribute.c index 3e0654b..33772b8 100644 --- a/mech_eap/set_name_attribute.c +++ b/mech_eap/set_name_attribute.c @@ -32,3 +32,12 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_set_name_attribute(OM_uint32 *minor, + gss_name_t name, + int complete, + gss_buffer_t attr, + gss_buffer_t value) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/set_sec_context_option.c b/mech_eap/set_sec_context_option.c index 3e0654b..3b1abf5 100644 --- a/mech_eap/set_sec_context_option.c +++ b/mech_eap/set_sec_context_option.c @@ -32,3 +32,11 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_set_sec_context_option(OM_uint32 *minor, + gss_ctx_id_t *pCred, + const gss_OID desired_object, + const gss_buffer_t value) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/store_cred.c b/mech_eap/store_cred.c index 3e0654b..ce45d02 100644 --- a/mech_eap/store_cred.c +++ b/mech_eap/store_cred.c @@ -32,3 +32,15 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_store_cred(OM_uint32 *minor, + const gss_cred_id_t input_cred_handle, + gss_cred_usage_t input_usage, + const gss_OID desired_mech, + OM_uint32 overwrite_cred, + OM_uint32 default_cred, + gss_OID_set *elements_stored, + gss_cred_usage_t *cred_usage_stored) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/unwrap.c b/mech_eap/unwrap.c index 3e0654b..64acb13 100644 --- a/mech_eap/unwrap.c +++ b/mech_eap/unwrap.c @@ -32,3 +32,31 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_unwrap(OM_uint32 *minor, + gss_ctx_id_t ctx, + gss_buffer_t input_message_buffer, + gss_buffer_t output_message_buffer, + int *conf_state, + gss_qop_t *qop_state) +{ + OM_uint32 major, tmpMinor; + gss_iov_buffer_desc iov[2]; + + iov[0].type = GSS_IOV_BUFFER_TYPE_STREAM; + iov[0].buffer = *input_message_buffer; + + iov[1].type = GSS_IOV_BUFFER_TYPE_DATA | GSS_IOV_BUFFER_FLAG_ALLOCATE; + iov[1].buffer.value = NULL; + iov[1].buffer.length = 0; + + major = gss_unwrap_iov(minor, ctx, conf_state, qop_state, iov, 2); + if (major == GSS_S_COMPLETE) { + *output_message_buffer = iov[1].buffer; + } else { + if (iov[1].type & GSS_IOV_BUFFER_FLAG_ALLOCATED) + gss_release_buffer(&tmpMinor, &iov[1].buffer); + } + + return major; +} diff --git a/mech_eap/unwrap_iov.c b/mech_eap/unwrap_iov.c index 3e0654b..264e137 100644 --- a/mech_eap/unwrap_iov.c +++ b/mech_eap/unwrap_iov.c @@ -32,3 +32,13 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_unwrap_iov(OM_uint32 *minor, + gss_ctx_id_t ctx, + int *conf_state, + gss_qop_t *qop_state, + gss_iov_buffer_desc *iov, + int iov_count) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/util_context.c b/mech_eap/util_context.c index 44fc866..daf65d6 100644 --- a/mech_eap/util_context.c +++ b/mech_eap/util_context.c @@ -95,6 +95,6 @@ gssEapReleaseContext(OM_uint32 *minor, GSSEAP_FREE(ctx); *pCtx = GSS_C_NO_CONTEXT; + *minor = 0; return GSS_S_COMPLETE; } - diff --git a/mech_eap/util_cred.c b/mech_eap/util_cred.c index 384c5a1..0db20d9 100644 --- a/mech_eap/util_cred.c +++ b/mech_eap/util_cred.c @@ -70,9 +70,8 @@ gssEapReleaseCred(OM_uint32 *minor, gss_cred_id_t *pCred) memset(cred, 0, sizeof(*cred)); GSSEAP_FREE(cred); - *pCred = NULL; + *minor = 0; return GSS_S_COMPLETE; } - diff --git a/mech_eap/util_name.c b/mech_eap/util_name.c index 1c5910d..580adef 100644 --- a/mech_eap/util_name.c +++ b/mech_eap/util_name.c @@ -53,9 +53,14 @@ gssEapAllocName(OM_uint32 *minor, gss_name_t *pName) OM_uint32 gssEapReleaseName(OM_uint32 *minor, gss_name_t *pName) { - gss_name_t name = *pName; + gss_name_t name; krb5_context kerbCtx = NULL; + if (pName == NULL) { + return GSS_S_COMPLETE; + } + + name = *pName; if (name == GSS_C_NO_NAME) { return GSS_S_COMPLETE; } @@ -69,6 +74,6 @@ gssEapReleaseName(OM_uint32 *minor, gss_name_t *pName) GSSEAP_FREE(name); *pName = NULL; + *minor = 0; return GSS_S_COMPLETE; } - diff --git a/mech_eap/verify_mic.c b/mech_eap/verify_mic.c index 3e0654b..f642d17 100644 --- a/mech_eap/verify_mic.c +++ b/mech_eap/verify_mic.c @@ -32,3 +32,12 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_verify_mic(OM_uint32 *minor, + gss_ctx_id_t context_handle, + gss_buffer_t message_buffer, + gss_buffer_t message_token, + gss_qop_t *qop_state) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/wrap.c b/mech_eap/wrap.c index 3e0654b..5f81544 100644 --- a/mech_eap/wrap.c +++ b/mech_eap/wrap.c @@ -32,3 +32,63 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_wrap(OM_uint32 *minor, + gss_ctx_id_t ctx, + int conf_req_flag, + gss_qop_t qop_req, + gss_buffer_t input_message_buffer, + int *conf_state, + gss_buffer_t output_message_buffer) +{ + OM_uint32 major, tmpMinor; + gss_iov_buffer_desc iov[4]; + unsigned char *p; + int i; + + iov[0].type = GSS_IOV_BUFFER_TYPE_HEADER; + iov[0].buffer.value = NULL; + iov[0].buffer.length = 0; + + iov[1].type = GSS_IOV_BUFFER_TYPE_DATA; + iov[1].buffer = *input_message_buffer; + + iov[2].type = GSS_IOV_BUFFER_TYPE_PADDING; + iov[2].buffer.value = NULL; + iov[2].buffer.length = 0; + + iov[3].type = GSS_IOV_BUFFER_TYPE_TRAILER; + iov[3].buffer.value = NULL; + iov[3].buffer.length = 0; + + major = gss_wrap_iov_length(minor, ctx, conf_req_flag, qop_req, + NULL, iov, 4); + if (GSS_ERROR(major)) { + return major; + } + + for (i = 0, output_message_buffer->length = 0; i < 4; i++) { + output_message_buffer->length += iov[i].buffer.length; + } + + output_message_buffer->value = GSSEAP_MALLOC(output_message_buffer->length); + if (output_message_buffer->value == NULL) { + *minor = ENOMEM; + return GSS_S_FAILURE; + } + + for (i = 0, p = output_message_buffer->value; i < 4; i++) { + if (iov[i].type == GSS_IOV_BUFFER_TYPE_DATA) { + memcpy(p, input_message_buffer->value, input_message_buffer->length); + } + iov[i].buffer.value = p; + p += iov[i].buffer.length; + } + + major = gss_wrap_iov(minor, ctx, conf_req_flag, qop_req, conf_state, iov, 4); + if (GSS_ERROR(major)) { + gss_release_buffer(&tmpMinor, output_message_buffer); + } + + return major; +} diff --git a/mech_eap/wrap_iov.c b/mech_eap/wrap_iov.c index 3e0654b..ccc9b16 100644 --- a/mech_eap/wrap_iov.c +++ b/mech_eap/wrap_iov.c @@ -32,3 +32,14 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_wrap_iov(OM_uint32 *minor, + gss_ctx_id_t ctx, + int conf_req_flag, + gss_qop_t qop_req, + int *conf_state, + gss_iov_buffer_desc *iov, + int iov_count) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/wrap_iov_length.c b/mech_eap/wrap_iov_length.c index 3e0654b..9921c27 100644 --- a/mech_eap/wrap_iov_length.c +++ b/mech_eap/wrap_iov_length.c @@ -32,3 +32,14 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_wrap_iov_length(OM_uint32 *minor, + gss_ctx_id_t ctx, + int conf_req_flag, + gss_qop_t qop_req, + int *conf_state, + gss_iov_buffer_desc *iov, + int iov_count) +{ + GSSEAP_NOT_IMPLEMENTED; +} diff --git a/mech_eap/wrap_size_limit.c b/mech_eap/wrap_size_limit.c index 3e0654b..39906dd 100644 --- a/mech_eap/wrap_size_limit.c +++ b/mech_eap/wrap_size_limit.c @@ -32,3 +32,45 @@ #include "gssapiP_eap.h" +OM_uint32 +gss_wrap_size_limit(OM_uint32 *minor, + gss_ctx_id_t ctx, + int conf_req_flag, + gss_qop_t qop_req, + OM_uint32 req_output_size, + OM_uint32 *max_input_size) +{ + gss_iov_buffer_desc iov[4]; + OM_uint32 major, overhead; + + iov[0].type = GSS_IOV_BUFFER_TYPE_HEADER; + iov[0].buffer.value = NULL; + iov[0].buffer.length = 0; + + iov[1].type = GSS_IOV_BUFFER_TYPE_DATA; + iov[1].buffer.length = req_output_size; + iov[1].buffer.value = NULL; + + iov[2].type = GSS_IOV_BUFFER_TYPE_PADDING; + iov[2].buffer.value = NULL; + iov[2].buffer.length = 0; + + iov[3].type = GSS_IOV_BUFFER_TYPE_TRAILER; + iov[3].buffer.value = NULL; + iov[3].buffer.length = 0; + + major = gss_wrap_iov_length(minor, ctx, conf_req_flag, qop_req, + NULL, iov, 4); + if (GSS_ERROR(major)) { + return major; + } + + overhead = iov[0].buffer.length + iov[3].buffer.length; + + if (iov[2].buffer.length == 0 && overhead < req_output_size) + *max_input_size = req_output_size - overhead; + else + *max_input_size = 0; + + return GSS_S_COMPLETE; +} -- 2.1.4