[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gss_wrap_size_limit()




Hmm, not sure that I actually got that right (didn't test with DES
block sizes). This version works, but will underestimate the
max_input_size; someone with better algebra than I needs to review
it :-)

static OM_uint32
sub_wrap_size (
            OM_uint32 req_output_size,
            OM_uint32 * max_input_size,
            int blocksize,
            int extrasize
           )
{
    size_t len, total_len; 

    len = 8 + req_output_size + blocksize + extrasize;

    gssapi_krb5_encap_length(len, &len, &total_len, GSS_KRB5_MECHANISM);

    total_len -= req_output_size; /* token length */
    if (total_len < req_output_size) {
        *max_input_size = (req_output_size - total_len);
        (*max_input_size) &= (~(OM_uint32)(blocksize - 1));
    } else {
        *max_input_size = 0;
    }
    return GSS_S_COMPLETE;
}

-- Luke

--
Luke Howard | PADL Software Pty Ltd | www.padl.com