Re: [kitten] New Version Notification for draft-kaduk-kitten-gss-loop-02.txt (fwd)
mrex@sap.com (Martin Rex) Mon, 20 January 2014 19:32 UTC
Return-Path: <mrex@sap.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 75F861A0227 for <kitten@ietfa.amsl.com>; Mon, 20 Jan 2014 11:32:34 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.852
X-Spam-Level:
X-Spam-Status: No, score=-3.852 tagged_above=-999 required=5 tests=[BAYES_50=0.8, HELO_EQ_DE=0.35, RCVD_IN_DNSWL_HI=-5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham
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 EwcfMXQgIhEg for <kitten@ietfa.amsl.com>; Mon, 20 Jan 2014 11:32:32 -0800 (PST)
Received: from smtpde01.sap-ag.de (smtpde01.sap-ag.de [155.56.68.170]) by ietfa.amsl.com (Postfix) with ESMTP id A76B11A0216 for <kitten@ietf.org>; Mon, 20 Jan 2014 11:32:31 -0800 (PST)
Received: from mail05.wdf.sap.corp by smtpde01.sap-ag.de (26) with ESMTP id s0KJWP1h014630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 20 Jan 2014 20:32:25 +0100 (MET)
In-Reply-To: <CAK3OfOiE=ytjN0UqCTv2gQCnDHv-u2vO63AwGuSUoDh2PnTtnA@mail.gmail.com>
To: Nico Williams <nico@cryptonector.com>
Date: Mon, 20 Jan 2014 20:32:25 +0100
X-Mailer: ELM [version 2.4ME+ PL125 (25)]
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="US-ASCII"
Message-Id: <20140120193225.529C31ABBC@ld9781.wdf.sap.corp>
From: mrex@sap.com
X-SAP: out
Cc: "kitten@ietf.org" <kitten@ietf.org>, Jeffrey Hutzelman <jhutz@cmu.edu>
Subject: Re: [kitten] New Version Notification for draft-kaduk-kitten-gss-loop-02.txt (fwd)
X-BeenThere: kitten@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: mrex@sap.com
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: Mon, 20 Jan 2014 19:32:34 -0000
Nico Williams wrote: > > Nonetheless, it seems clear that the intention is that calling a > gss_release/delete_*() function will modify the input/output parameter > so that calling it again is safe, so that releasing a zero-length, > non-zero valued buffer ought to be safe. In theory yes, but practice may differ. What I'm afraid of is wrapper functions that look like this: OM_uint32 app_wrapper_gss_release_cred(gss_ctx_id_t cred) { OM_uint32 maj_stat; OM_uint32 min_stat; gss_cred_id_t l_cred = cred; maj_stat = gss_release_cred(&min_stat, &l_cred); if ( GSS_S_COMPLETE!=maj_stat ) { app_show_error( maj_stat, min_stat); } return(maj_stat); } And if that app_wrapper_* release function is called twice, then a non-zero copy of the original cred will be passed on the second call, and that may result in the undefined behaviour of double-free(). > > The API can output zero-length buffers from gss_unwrap(), > so the question comes up of whether such buffers can have > non-zero values -- the RFC doesn't say. correct -- gss_unwrap() may return a zero-length output buffer. The length of the buffer must be zero for obvious reasons. The value of the pointer is then irrelevant, and the gssapi mechanism must be able to cope safely with whatever it returns along with a zero length. > > The other places where the API can output a zero-length token in > non-error conditions are gss_init/accept_sec_context() and > gss_delete_sec_context, Nope, neither of these three calls can return a zero-length output token, they either return a token or do not return a token (which means that a gssapi wrapper mechanism that would blindly copy output parameters from underlying implementations and use an implementation specific malloc(0) would be buggy and leak memory for these three functions. > > and there the text is not entirely > dispositive... but it is highly suggestive that zero-length tokens > are empty, and this, together with the general design of > gss_release/delete_*() strongly implies that it should be safe to call > any of those twice with the same input/output parameter. No, NEVER. The only thing that _might_ be safe, when the gssapi mechanism designer didn't mess up, is superfluous release calls with a NULL handle, i.e. calling it once with a handle that gets zeroed, and then calling it again with the zero-ed handle. The big difference here is that the second call is *NOT* with the same handle, but with a handle that was zero-ed by a prior release call. This is why I don't like the current language, that would suggest the wrapper describe above could be safely called as well (which it can not). > > The only reason to assume that releasing a zero-length/non-zero value > buffer is that an implementation might have called malloc(0) in the > process of outputting a zero-length buffer from gss_unwrap() malloc(0) is something that no reasonable gssapi mechanism implementation should ever do. -Martin
- [kitten] New Version Notification for draft-kaduk… Benjamin Kaduk
- Re: [kitten] New Version Notification for draft-k… Greg Hudson
- Re: [kitten] New Version Notification for draft-k… Martin Rex
- Re: [kitten] New Version Notification for draft-k… Nico Williams
- Re: [kitten] New Version Notification for draft-k… Russ Allbery
- Re: [kitten] New Version Notification for draft-k… Greg Hudson
- Re: [kitten] New Version Notification for draft-k… Nico Williams
- Re: [kitten] New Version Notification for draft-k… Nico Williams
- Re: [kitten] New Version Notification for draft-k… Jeffrey Hutzelman
- Re: [kitten] New Version Notification for draft-k… Nico Williams
- Re: [kitten] New Version Notification for draft-k… Martin Rex
- Re: [kitten] New Version Notification for draft-k… Jeffrey Hutzelman
- Re: [kitten] New Version Notification for draft-k… Martin Rex
- Re: [kitten] New Version Notification for draft-k… Jeffrey Hutzelman
- Re: [kitten] New Version Notification for draft-k… Martin Rex
- Re: [kitten] New Version Notification for draft-k… Benjamin Kaduk