Re: [kitten] Clarification of gss_add_cred() behavior

Nico Williams <nico@cryptonector.com> Thu, 19 March 2015 19:50 UTC

Return-Path: <nico@cryptonector.com>
X-Original-To: kitten@ietfa.amsl.com
Delivered-To: kitten@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E6EBB1A8EA9 for <kitten@ietfa.amsl.com>; Thu, 19 Mar 2015 12:50:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.666
X-Spam-Level:
X-Spam-Status: No, score=-1.666 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, IP_NOT_FRIENDLY=0.334, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bb7v1fGYtWOg for <kitten@ietfa.amsl.com>; Thu, 19 Mar 2015 12:50:49 -0700 (PDT)
Received: from homiemail-a102.g.dreamhost.com (sub4.mail.dreamhost.com [69.163.253.135]) by ietfa.amsl.com (Postfix) with ESMTP id 027961A8F40 for <kitten@ietf.org>; Thu, 19 Mar 2015 12:50:49 -0700 (PDT)
Received: from homiemail-a102.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a102.g.dreamhost.com (Postfix) with ESMTP id 7505520047B82 for <kitten@ietf.org>; Thu, 19 Mar 2015 12:50:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cryptonector.com; h=date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=cryptonector.com; bh=NMifAtnpKVhB6J7/JeJvSYcNC0g =; b=XV4hoflcZ47N4jCqt9O1ebFZ5n5wiVhOOs9ImrS4wSjkYxAA5o8Q47EwWT7 09nZmR87MoWbnBki0gpM1yUYQOCLuQW23QApIbOY6nTb1MAwneaU8T4YsQnhaiG5 Zlb5seNAw0f9S2TLaxEj5jWqB5puWGsK+vPHfnRNDNZ6tqr4=
Received: from localhost (108-207-244-174.lightspeed.austtx.sbcglobal.net [108.207.244.174]) (Authenticated sender: nico@cryptonector.com) by homiemail-a102.g.dreamhost.com (Postfix) with ESMTPA id 40DF820047B81 for <kitten@ietf.org>; Thu, 19 Mar 2015 12:50:48 -0700 (PDT)
Date: Thu, 19 Mar 2015 14:50:47 -0500
From: Nico Williams <nico@cryptonector.com>
To: kitten@ietf.org
Message-ID: <20150319195046.GL8099@localhost>
References: <20150319025202.GB8099@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <20150319025202.GB8099@localhost>
User-Agent: Mutt/1.5.21 (2010-09-15)
Archived-At: <http://mailarchive.ietf.org/arch/msg/kitten/CzPn6lmVxNJqgY-LeII7fXP5MNU>
Subject: Re: [kitten] Clarification of gss_add_cred() behavior
X-BeenThere: kitten@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Common Authentication Technologies - Next Generation <kitten.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/kitten>, <mailto:kitten-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/kitten/>
List-Post: <mailto:kitten@ietf.org>
List-Help: <mailto:kitten-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/kitten>, <mailto:kitten-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Mar 2015 19:50:50 -0000

Here's what I want (and which I always thought was a possible way to use
gss_add_cred()):

    /*
     * Build a cred handle one elment-at-a-time.
     *
     * Here some_name is a gss_name_t value other than GSS_C_NO_NAME,
     * and some_mech is a gss_OID value other than GSS_C_NO_OID.
     */
    maj = gss_add_cred(&min, GSS_C_NO_CREDENTIAL,
                       some_name, some_mech,
                       GSS_C_INITIATE, GSS_C_INDEFINITE, 0,
                       &new_cred,
                       NULL, NULL, NULL);
    if (maj == GSS_S_COMPLETE) {
        /* Yes!  I have a cred handle for {some_mech, some_name}! */
        ...

        /*
         * Now I can gss_add_cred() more elements to the brand-new
         * new_cred, one element-at-a-time.
         */
        maj = gss_add_cred(&min, new_cred, some_name, other_mech,
                           GSS_C_INITIATE, GSS_C_INDEFINITE, 0,
                           NULL, NULL, NULL, NULL);
        ...
    }

This would be a handy use-case when the caller wants to initiate a
security context as the same initiator principal as a previous time, and
with the same mechanism (think: SSHv2 re-key exchange with GSS), which
is useful when one wants to re-delegate a fresh credential for the same
initiator principal to some target.

Now, the text in RFCs 2743 and 2744 as to what happens when
input_cred_handle == GSS_C_NO_CREDENTIAL means that my some_name
desired_name must get ignored in the above code, which makes the above
not feasible at all.

But it's worse than that: I can't even use gss_add_cred() to get a
single-mechanism element credential handle if I don't already have one.
It means I can't really use gss_add_cred() without also first using
gss_acquire_cred().  Using gss_acquire_cred() at all is obnoxious when
you have a single mechanism that you want a credential for.

With the text as-is the only real use of gss_add_cred() is to function
as a would-be gss_duplicate_cred() when you ask for an
output_cred_handle.  But it's a rather difficult-to-use cred handle dup
function...

Nico
-- 

On Wed, Mar 18, 2015 at 09:52:02PM -0500, Nico Williams wrote:
> I think the answer is that this text in RFC2743 section 2.1.4, page 39:
> 
>    If GSS_C_NO_CREDENTIAL is specified as input_cred_handle, a non-NULL
>    output_cred_handle must be supplied.  For the case of
>    GSS_C_NO_CREDENTIAL as input_cred_handle, GSS_Add_cred() will create
>    the credential referenced by its output_cred_handle based on default
>    behavior.  That is, the call will have the same effect as if the
>    caller had previously called GSS_Acquire_cred(), specifying the same
>    usage and passing GSS_C_NO_NAME as the desired_name parameter
>    (thereby obtaining an explicit credential handle corresponding to
>    default behavior), had passed that credential handle to
>    GSS_Add_cred(), and had finally called GSS_Release_cred() on the
>    credential handle received from GSS_Acquire_cred().
> 
> and the corresponding and matching text in RFC2744 section 5.3, are
> subtly wrong.  [...]