rfc4121.c
static krb5_error_code
rfc4121_ctx_size(krb5_context kcontext,
		 gss_OID mech_used,
		 krb5_principal dummy_principal,
		 g_seqnum_state seqstate,
		 krb5_auth_context dummy_auth_context,
		 krb5_keyblock *acceptor_subkey,
		 krb5_authdata_context dummy_authdata_context,
		 size_t *sizep)
{
    krb5_error_code     ret;
    size_t	      required;

    /*
     * GSS exported context token requires:
     *  int32_t	for mech_used->length
     *  ...		for mech_used
     * krb5_gss_ctx_id_rec requires:
     *  int32_t		for KG_CONTEXT
     *  int32_t		for initiate.
     *  int32_t		for established.
     *  int32_t		for have_acceptor_subkey.
     *  int32_t		for seed_init.
     *  int32_t		for gss_flags.
     *  sizeof(seed)    for seed
     *  ...		for here
     *  ...		for there
     *  ...		for subkey
     *  int32_t		for signalg.
     *  int32_t		for cksum_size.
     *  int32_t		for sealalg.
     *  ...		for enc
     *  ...		for seq
     *  int32_t		for authtime.
     *  int32_t		for starttime.
     *  int32_t		for endtime.
     *  int32_t		for renew_till.
     *  int32_t		for flags.
     *  int64_t		for seq_send.
     *  int64_t		for seq_recv.
     *  ...		for seqstate
     *  ...		for auth_context
     *  ...		for mech_used
     *  int32_t		for proto
     *  int32_t		for cksumtype
     *  ...		for acceptor_subkey
     *  int32_t		for acceptor_key_cksumtype
     *  int32_t		for cred_rcache
     *  int32_t		for number of elements in authdata array
     *  ...		for authdata array
     *  int32_t		for trailer.
     */
    ret = EINVAL;
    required = 4 + mech_used->length;
    required += 20 * sizeof(int32_t);
    required += 2 * sizeof(int64_t);
    required += sizeof(seed);

    ret = 0;

    if (!ret)
	ret = rfc4121_oid_size(mech_used, &required);
#ifdef HAVE_KRB5_EXTERNALIZE_OPAQUE
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_PRINCIPAL,
			       dummy_principal, &required);
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_PRINCIPAL,
			       dummy_principal, &required);
#else
    if (!ret)
	ret = k5_size_principal(dummy_principal, &required);
    if (!ret)
	ret = k5_size_principal(dummy_principal, &required);
#endif
    if (!ret)
	ret = rfc4121_seqstate_size(seqstate, &required);
#ifdef HAVE_KRB5_EXTERNALIZE_OPAQUE
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_CONTEXT,
			       kcontext, &required);
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_AUTH_CONTEXT,
			       dummy_auth_context, &required);
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_KEYBLOCK,
			       acceptor_subkey, &required);
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_AUTHDATA_CONTEXT,
			       dummy_authdata_context, &required);
#else
    if (!ret)
	ret = k5_size_context(kcontext, &required);
    if (!ret)
	ret = k5_size_auth_context(dummy_auth_context, &required);
    if (!ret)
	ret = k5_size_keyblock(acceptor_subkey, &required);
    if (!ret)
	ret = k5_size_authdata_context(kcontext, dummy_authdata_context, &required);
#endif
    *sizep += required;

    return(ret);
}
/*
 * Determine the size required for this krb5_gss_ctx_id_rec.
 */
Determine the size required for this krb5_gss_ctx_id_rec.
Determine the size required for this krb5_gss_ctx_id_rec .
static krb5_error_code
rfc4121_ctx_size(krb5_context kcontext,
		 gss_OID mech_used,
		 krb5_principal dummy_principal,
		 g_seqnum_state seqstate,
		 krb5_auth_context dummy_auth_context,
		 krb5_keyblock *acceptor_subkey,
		 krb5_authdata_context dummy_authdata_context,
		 size_t *sizep)
{
    krb5_error_code     ret;
    size_t	      required;
    ret = EINVAL;
    required = 4 + mech_used->length;
    required += 20 * sizeof(int32_t);
    required += 2 * sizeof(int64_t);
    required += sizeof(seed);
    ret = 0;
    if (!ret)
	ret = rfc4121_oid_size(mech_used, &required);
#ifdef HAVE_KRB5_EXTERNALIZE_OPAQUE
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_PRINCIPAL,
			       dummy_principal, &required);
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_PRINCIPAL,
			       dummy_principal, &required);
#else
    if (!ret)
	ret = k5_size_principal(dummy_principal, &required);
    if (!ret)
	ret = k5_size_principal(dummy_principal, &required);
#endif
    if (!ret)
	ret = rfc4121_seqstate_size(seqstate, &required);
#ifdef HAVE_KRB5_EXTERNALIZE_OPAQUE
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_CONTEXT,
			       kcontext, &required);
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_AUTH_CONTEXT,
			       dummy_auth_context, &required);
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_KEYBLOCK,
			       acceptor_subkey, &required);
    if (!ret)
	ret = krb5_size_opaque(kcontext, KV5M_AUTHDATA_CONTEXT,
			       dummy_authdata_context, &required);
#else
    if (!ret)
	ret = k5_size_context(kcontext, &required);
    if (!ret)
	ret = k5_size_auth_context(dummy_auth_context, &required);
    if (!ret)
	ret = k5_size_keyblock(acceptor_subkey, &required);
    if (!ret)
	ret = k5_size_authdata_context(kcontext, dummy_authdata_context, &required);
#endif
    *sizep += required;
    return(ret);
}
static krb5_error_code rfc4121_ctx_size ( krb5_context kcontext , gss_OID mech_used , krb5_principal dummy_principal , g_seqnum_state seqstate , krb5_auth_context dummy_auth_context , krb5_keyblock * acceptor_subkey , krb5_authdata_context dummy_authdata_context , size_t * sizep ) { krb5_error_code ret ; size_t required ; ret = EINVAL ; required = 4 + mech_used -> length ; required += 20 * sizeof ( int32_t ) ; required += 2 * sizeof ( int64_t ) ; required += sizeof ( seed ) ; ret = 0 ; if ( ! ret ) ret = rfc4121_oid_size ( mech_used , & required ) ; #ifdef HAVE_KRB5_EXTERNALIZE_OPAQUE if ( ! ret ) ret = krb5_size_opaque ( kcontext , KV5M_PRINCIPAL , dummy_principal , & required ) ; if ( ! ret ) ret = krb5_size_opaque ( kcontext , KV5M_PRINCIPAL , dummy_principal , & required ) ; #else if ( ! ret ) ret = k5_size_principal ( dummy_principal , & required ) ; if ( ! ret ) ret = k5_size_principal ( dummy_principal , & required ) ; #endif if ( ! ret ) ret = rfc4121_seqstate_size ( seqstate , & required ) ; #ifdef HAVE_KRB5_EXTERNALIZE_OPAQUE if ( ! ret ) ret = krb5_size_opaque ( kcontext , KV5M_CONTEXT , kcontext , & required ) ; if ( ! ret ) ret = krb5_size_opaque ( kcontext , KV5M_AUTH_CONTEXT , dummy_auth_context , & required ) ; if ( ! ret ) ret = krb5_size_opaque ( kcontext , KV5M_KEYBLOCK , acceptor_subkey , & required ) ; if ( ! ret ) ret = krb5_size_opaque ( kcontext , KV5M_AUTHDATA_CONTEXT , dummy_authdata_context , & required ) ; #else if ( ! ret ) ret = k5_size_context ( kcontext , & required ) ; if ( ! ret ) ret = k5_size_auth_context ( dummy_auth_context , & required ) ; if ( ! ret ) ret = k5_size_keyblock ( acceptor_subkey , & required ) ; if ( ! ret ) ret = k5_size_authdata_context ( kcontext , dummy_authdata_context , & required ) ; #endif * sizep += required ; return ( ret ) ; }
Determine the size required for this krb5_gss_ctx_id_rec.
Determine the size required for this krb5_gss_ctx_id_rec .
/*
     * GSS exported context token requires:
     *  int32_t	for mech_used->length
     *  ...		for mech_used
     * krb5_gss_ctx_id_rec requires:
     *  int32_t		for KG_CONTEXT
     *  int32_t		for initiate.
     *  int32_t		for established.
     *  int32_t		for have_acceptor_subkey.
     *  int32_t		for seed_init.
     *  int32_t		for gss_flags.
     *  sizeof(seed)    for seed
     *  ...		for here
     *  ...		for there
     *  ...		for subkey
     *  int32_t		for signalg.
     *  int32_t		for cksum_size.
     *  int32_t		for sealalg.
     *  ...		for enc
     *  ...		for seq
     *  int32_t		for authtime.
     *  int32_t		for starttime.
     *  int32_t		for endtime.
     *  int32_t		for renew_till.
     *  int32_t		for flags.
     *  int64_t		for seq_send.
     *  int64_t		for seq_recv.
     *  ...		for seqstate
     *  ...		for auth_context
     *  ...		for mech_used
     *  int32_t		for proto
     *  int32_t		for cksumtype
     *  ...		for acceptor_subkey
     *  int32_t		for acceptor_key_cksumtype
     *  int32_t		for cred_rcache
     *  int32_t		for number of elements in authdata array
     *  ...		for authdata array
     *  int32_t		for trailer.
     */