sanon: Fix flags and ctx export/import confusion

We were passing SANON flags to _gss_mg_import_rfc4121_context(), which
wants GSS flags.  Meanwhile, I broke gss_inquire_context() on imported
SAnon contexts when I did my review of SAnon.

This commit fixes both issues and removes SANON_FLAG_*, which were only
ever needed because of a flag to track whether a context was locally
initiated or accepted.  Now we use a separate int field of the sanon_ctx
to track whether a context was locally initiated.  Once an SAnon context
is fully established, we rely on gss_inquire_context() on the rfc4121
sub-context for all metadata that isn't the initiator and acceptor names
nor the mechanism OID.
This commit is contained in:
Nicolas Williams
2020-04-26 00:53:29 -05:00
parent 51fdb4bc04
commit 2cb40ed97c
7 changed files with 34 additions and 72 deletions

View File

@@ -278,7 +278,7 @@ _gss_sanon_curve25519(OM_uint32 *minor,
p = kdf_context.data;
if (sc->flags & SANON_FLAG_INITIATOR) {
if (sc->is_initiator) {
memcpy(p, sc->pk, sizeof(sc->pk));
memcpy(&p[pk->length], pk->value, pk->length);
} else {
@@ -318,14 +318,10 @@ _gss_sanon_curve25519(OM_uint32 *minor,
OM_uint32
_gss_sanon_import_rfc4121_context(OM_uint32 *minor,
sanon_ctx sc,
OM_uint32 flags,
gss_const_buffer_t session_key)
{
return _gss_mg_import_rfc4121_context(minor,
!!(sc->flags & SANON_FLAG_INITIATOR),
flags,
KRB5_ENCTYPE_AES128_CTS_HMAC_SHA256_128,
session_key,
&sc->rfc4121);
return _gss_mg_import_rfc4121_context(minor, sc->is_initiator, sc->flags,
KRB5_ENCTYPE_AES128_CTS_HMAC_SHA256_128,
session_key, &sc->rfc4121);
}