Пример #1
0
krb5_error_code
k5_asn1_full_encode(const void *rep, const struct atype_info *a,
                    krb5_data **code_out)
{
    size_t len;
    asn1_error_code ret;
    asn1buf *buf = NULL;
    krb5_data *d;

    *code_out = NULL;

    if (rep == NULL)
        return ASN1_MISSING_FIELD;
    ret = asn1buf_create(&buf);
    if (ret)
        return ret;
    ret = encode_atype_and_tag(buf, rep, a, &len);
    if (ret)
        goto cleanup;
    ret = asn12krb5_buf(buf, &d);
    if (ret)
        goto cleanup;
    *code_out = d;
cleanup:
    asn1buf_destroy(&buf);
    return ret;
}
Пример #2
0
krb5_error_code
krb5int_asn1_do_full_encode(const void *rep, krb5_data **code,
                            const struct atype_info *a)
{
    unsigned int length;
    asn1_error_code retval;
    asn1buf *buf = NULL;
    krb5_data *d;

    *code = NULL;

    if (rep == NULL)
        return ASN1_MISSING_FIELD;

    retval = asn1buf_create(&buf);
    if (retval)
        return retval;

    retval = krb5int_asn1_encode_a_thing(buf, rep, a, &length);
    if (retval)
        goto cleanup;
    retval = asn12krb5_buf(buf, &d);
    if (retval)
        goto cleanup;
    *code = d;
cleanup:
    asn1buf_destroy(&buf);
    return retval;
}