Allow zero length but non-NULL tokens on init_sec_context
[mech_eap.orig] / pseudo_random.c
index f07e099..b92eb3c 100644 (file)
  * or implied warranty.
  */
 
+/*
+ * PRF
+ */
+
 #include "gssapiP_eap.h"
 
 OM_uint32
@@ -76,7 +80,7 @@ gss_pseudo_random(OM_uint32 *minor,
 
     if (ctx == GSS_C_NO_CONTEXT) {
         *minor = EINVAL;
-        return GSS_S_NO_CONTEXT;
+        return GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT;
     }
 
     *minor = 0;
@@ -85,6 +89,7 @@ gss_pseudo_random(OM_uint32 *minor,
 
     if (!CTX_IS_ESTABLISHED(ctx)) {
         GSSEAP_MUTEX_UNLOCK(&ctx->mutex);
+        *minor = GSSEAP_CONTEXT_INCOMPLETE;
         return GSS_S_NO_CONTEXT;
     }
 
@@ -98,7 +103,7 @@ gss_pseudo_random(OM_uint32 *minor,
 
     if (prf_key != GSS_C_PRF_KEY_PARTIAL &&
         prf_key != GSS_C_PRF_KEY_FULL) {
-        code = EINVAL;
+        code = GSSEAP_BAD_PRF_KEY;
         goto cleanup;
     }