Add rxgk_gss.c

All the routines which deal with GSSAPI types.
This is, in practice, how the client gets a token, and the server
backend for GSSNegotiate().

These routines are split out into a separate file, and their prototypes
hidden behind ifndef KERNEL, because we need to allow rxgk to be usable
in the absence of a gssapi library, which is the case in the kernel.

Provide a compatibility definition of GSS_C_PRF_KEY_FULL, as there
are known implementations in the wild that provide the function but
do not provide the keyusage constants.

Change-Id: Id2966de07853dd6a74cb40225851728d2422421c
Implement SRXGK_GSSNegotiate()

In-kernel we must fail; the userspace implementation is already
in the tree in rxgk_gss.c.

Change-Id: Id715e3287df5921a20aebe4e65259fd2097dc2b4
Add rxgk_packet.c

Routines to apply and verify encryption and MICs to the data in
rx packets.  Backend to the rxgk_crypto framework for the actual
crypto operations.

Change-Id: I724efacf7df1d688c0d61a327fa9ee9c8168d715
Implement the rxgk server routines

Provide non-trivial implementations of the security class routines
used by the server, along with helpers as necessary.

In addition to the normal NewServerSecurityObject routine, provide
wrappers NewServiceSecObj and NewEphemeralService_SecObj that create
the security object, create an rx service for the key negotiation service
needed for clients to negotiate tokens useful with this server security
object, and register the getkey function used for the security object
as service-specific data to be used when encrypting tokens produced by
this rx service.  The Ephemeral variant creates a random token-encrypting
key for use by the service, so no getkey routine needs to be supplied
by the caller.

The identity supplied in a client's token is given as a list of
PrAuthNames; we assume that at most one name is supplied at present,
as the meaning of compound identities (and the use of compound
identities for keyed cache managers) is not fully specified yet.
Convert the PrAuthName to an rx_identity for caching in the server
connection state, as the rx_identity type is more compatible with
superuser checks on the connection.

Also provide an rxgk_GetServerInfo routine which extracts the cached
identity, for use in libauth when making superuser checks.
This moves our dependency on rx_identity from the private data structures
into the public header, so move the nested include accordingly.

Change-Id: I0f48b69d4ab758d8a4d76ebfb1daf3009c4fe060
Implement rxgk client security object routines

Also add rxgk_NegotiateSecurityObject, a routine that creates
an rxnull connection to a target server, obtains a token using
the GSSNegotiate RPC on that connection, and uses the resulting
token to make an rxgk connection to that same server.

Change-Id: Ic7e11b02cb1573cfdb6d11d4de9a77ab1c563262
Implement SRXGK_CombineTokens

Most of the logic we need is already in place in rxgk_token.c; we just
need to pull out the token data structures, combine the identity lists,
and call into that code.

Change-Id: I68dd5dffab579d89601a55b8ed82961f8e12fc1b
Build rxgk support into libafsrpc

This is done rather differently for the shared and static libafsrpc
forms.  For the shared library, we can add a dependency on the shared
$(GSSAPI_LIBS) and link in liboafs_rxgk.la directly.  libafsrpc_rxgk.la
(which only has stubs for the rxgk GSS-using routines) is linked into
the static library, so that it remains useful for statically linking
applications.  Consumers of libafsrpc.a need not be modified in
accordance with this change.

Change-Id: I76c0329ba842fb0d4d66534810b114a0813c90a0
BuildServerSecurityObjects allocate for rxgk

Don't do anything with it for now, just leave a place in the
array.

Change-Id: I304e0f6bcf7d3b2a2cb46c976f41e09809a436db
Let superuser identities be superusers

We have a special rx_identity_kind for superusers, let it actually
be useful for something.

Change-Id: I1d551ed8e5fcfd6bdc29c6c27eee4c2ae67e1a89
Add rxgk support to userok

Sprinkle @RXGK_LIBS_STATIC@ as needed to keep LWP bits building.

Change-Id: I5da2a89532453b6bec61fc87218a61455e39f6f0
Implement afsconf_GetRXGKKey

Also afsconf_GetLatestRXGKKey, as a side effect, since we want to have
a single getkey function both for getting encrypting and decrypting keys;
a kvno/enctype pair of 0/0 indicates that the "get latest" behavior is
desired.

Implement both functions in terms of an internal helper that takes
as an argument the type of key to look for in the KeyFileExt.  We
can reuse these helpers wholesale for per-fileserver keys, later.

This also requires implementing an ordering on the quality of the
different RFC 3961 enctypes (which are stored as the subtype of keys
of type afsconf_rxgk).  This is ... pretty awkward to code up, and
also subject to debate on the actual ordering.  Since the IANA enctype
registry changes rarely, just assign a full ordering on the standardized
(symmetric!) enctypes, giving integers as the ordered values, and
store that in a constant array.  Then, the lookup table allows the
comparison of the strength of enctypes ~directly.

Provide stubs for KERNEL use; UKERNEL builds this file but does not
have any real rxgk support yet, so fails to link due to the
missing rxgk_make_key symbol.

Sprinkle some @RXGK_LIBS_STATIC@ to keep the LWP bits building and
add the corresponding dependencies on @RXGK_TARGET@.

Change-Id: I81389b21238fd6588cc4381b026816005f81a30c
Add afsconf_BuildUbikServerSecurityObjects

This new interface is specifically for use in building the server
security objects that will be used to handle ubik-internal connections
(that is, DISK_ and VOTE_).

This is the normaml set from BuildServerSecurityObjects, with a custom
rxgk server security object.  The only tokens used for ubik-internal
communication are printed tokens, so the rxgk key negotiation service
(RXGK_) should not be provided.  afsconf_GetRXGKKey is used as the
getkey function for these connections, since the cell-wide rxgk key
from KeyFileExt is used for them.

Change-Id: Id332aabcf80ed35bda36dcce92e762d46b590f47
Use afsconf_BuildUbikServerSecurityObjects for vl, ptserver

Accept rxgk tokens for incoming intra-ubik connections.

Change-Id: I31dca8c8db4dada1a5d3f9b193e7506fdf6ece47
Add afsconf_BuildDbServerSecurityObjects

Used to build the server security objects for database servers that
will accept the actual user RPCs (for the VL and PR services, etc.).

Change-Id: I59e6bce2c1ccf8c873bda913b28f26d9c2a49f63
Use afsconf_BuildDbServerSecurityObjects for the vl, ptserver

Change-Id: I713d78384f4d6347b17104a97ad72650ac363491
Add afsconf_ClientAuthRXGK

Always encrypts, eliminating the need for a separate 'Secure' variant.
On modern hardware the AES we'll end up doing should be faster than
our rx stack can keep up with.

Change-Id: Ib27f2799eb927ac5aa71eab94212171344dd93df
Add -rxgk option to vlserver, ptserver

Optionally use rxgk for ubik server-to-server connections, via
afsconf_ClientAuthRXGK.  All the db servers in the cell must have
been upgraded to a version that accepts rxgk ubik connections before
this option can safely be enabled.

Change-Id: Iefae46291330d2b5e05b2a2bbaec1b9150b3c892
Add afsconf getkey variants for RXGKFS

That is, getkey routines for use by fileservers.

Fileservers will keep their token-encrypting keys in KeyFileExt,
using a new key type afsconf_rxgk_fs.  Such keys are only used
if no keys of type afsconf_rxgk are present (that is, the cell-wide
key takes precedence, both at token-decyryption time and at
vlserver-registration time).

Also fix some whitespace nits where the KeyFileExt key types
are defined.

Change-Id: Ife585cc976ffe1b1f86d9f285f3be9e599c75c29
Add afsconf_BuildFileServerSecurityObjects

Make use of the new getkey routines for per-fileserver keys, but
only if there are no cell-wide keys available.

Change-Id: I0cd3b7c5654c113f18c0a49c6e7bd84b2b5edfb7
Implement SRXGK_AFSCombineTokens

This functionality requires a way for the vlserver to be able to lookup
the token-encrypting key for a given fileserver UUID.  To do this from
the rx security class directly would be a layering violation; rxgk
cannot depend on the vlserver directly.  Instead, supply a callback
as service-specific data, which gives a routine to retrieve a key
for encrypting tokens to a given UUID.

No implementations of this getfskey hook are provided in this commit;
the vlserver's implementation will come in a later commit.

Change-Id: Icd955202c92a3665e1e827b81687e17a2a28638d