+static struct wpabuf *
+peerGetEapReqData(void *ctx)
+{
+ return NULL;
+}
+
+static void
+peerSetConfigBlob(void *ctx, struct wpa_config_blob *blob)
+{
+}
+
+static const struct wpa_config_blob *
+peerGetConfigBlob(void *ctx, const char *name)
+{
+ return NULL;
+}
+
+static void
+peerNotifyPending(void *ctx)
+{
+}
+
+static struct eapol_callbacks gssEapPolicyCallbacks = {
+ peerGetConfig,
+ peerGetBool,
+ peerSetBool,
+ peerGetInt,
+ peerSetInt,
+ peerGetEapReqData,
+ peerSetConfigBlob,
+ peerGetConfigBlob,
+ peerNotifyPending,
+};
+
+static OM_uint32
+peerConfigInit(OM_uint32 *minor,
+ gss_cred_id_t cred,
+ gss_ctx_id_t ctx,
+ int loadConfig)
+{
+ krb5_context krbContext;
+ struct eap_peer_config *eapPeerConfig = &ctx->initiatorCtx.eapPeerConfig;
+ krb5_error_code code;
+ char *identity;
+
+ GSSEAP_KRB_INIT(&krbContext);
+
+ if (loadConfig) {
+ }
+
+ code = krb5_unparse_name(krbContext, cred->name->krbPrincipal, &identity);
+ if (code != 0) {
+ *minor = code;
+ return GSS_S_FAILURE;
+ }
+
+ eapPeerConfig->identity = (unsigned char *)identity;
+ eapPeerConfig->identity_len = strlen(identity);
+ eapPeerConfig->password = (unsigned char *)cred->password.value;
+ eapPeerConfig->password_len = cred->password.length;
+
+ return GSS_S_COMPLETE;
+}
+
+static OM_uint32
+peerConfigFree(OM_uint32 *minor,
+ gss_ctx_id_t ctx)
+{
+ krb5_context krbContext;
+ struct eap_peer_config *eapPeerConfig = &ctx->initiatorCtx.eapPeerConfig;
+
+ GSSEAP_KRB_INIT(&krbContext);
+
+ krb5_free_unparsed_name(krbContext, (char *)eapPeerConfig->identity);
+
+ return GSS_S_COMPLETE;
+}
+
+static OM_uint32
+peerDeriveKey(OM_uint32 *minor,
+ gss_ctx_id_t ctx)
+{
+ OM_uint32 major;
+ const unsigned char *key;
+ size_t keyLength;
+ krb5_context krbContext;
+
+ GSSEAP_KRB_INIT(&krbContext);
+
+ /* Cache encryption type derived from selected mechanism OID */
+ major = gssEapOidToEnctype(minor, ctx->mechanismUsed, &ctx->encryptionType);
+ if (GSS_ERROR(major))
+ return major;
+
+ if (ctx->encryptionType != ENCTYPE_NULL &&
+ eap_key_available(ctx->initiatorCtx.eap)) {
+ key = eap_get_eapKeyData(ctx->initiatorCtx.eap, &keyLength);
+
+ major = gssEapDeriveRFC3961Key(minor, key, keyLength,
+ ctx->encryptionType, &ctx->rfc3961Key);
+ if (GSS_ERROR(major))
+ return major;
+ } else {
+ /*
+ * draft-howlett-eap-gss says that integrity/confidentialty should
+ * always be advertised as available, but if we have no keying
+ * material it seems confusing to the caller to advertise this.
+ */
+ ctx->gssFlags &= ~(GSS_C_INTEG_FLAG | GSS_C_CONF_FLAG);
+ }
+
+ return GSS_S_COMPLETE;
+}
+