Exemple #1
0
static krb5_error_code
asn1_decode_sequence_of_keys(krb5_data *in, krb5_key_data **out,
                             krb5_int16 *n_key_data, krb5_kvno *mkvno)
{
    krb5_error_code err;
    ldap_seqof_key_data *p;
    int i;

    /*
     * This should be pushed back into other library initialization
     * code.
     */
    err = kldap_ensure_initialized ();
    if (err)
        return err;

    err = accessor.asn1_ldap_decode_sequence_of_keys(in, &p);
    if (err)
        return err;

    /* Set kvno and key_data_ver in each key_data element. */
    for (i = 0; i < p->n_key_data; i++) {
        p->key_data[i].key_data_kvno = p->kvno;
        p->key_data[i].key_data_ver =
            (p->key_data[i].key_data_length[1] == 0) ? 1 : 2;
    }

    *out = p->key_data;
    *n_key_data = p->n_key_data;
    *mkvno = p->mkvno;
    free(p);
    return 0;
}
Exemple #2
0
static krb5_error_code
asn1_encode_sequence_of_keys(krb5_key_data *key_data, krb5_int16 n_key_data,
                             krb5_int32 mkvno, krb5_data **code)
{
    krb5_error_code err;
    ldap_seqof_key_data val;

    /*
     * This should be pushed back into other library initialization
     * code.
     */
    err = kldap_ensure_initialized ();
    if (err)
        return err;

    val.key_data = key_data;
    val.n_key_data = n_key_data;
    val.mkvno = mkvno;

    return accessor.asn1_ldap_encode_sequence_of_keys(&val, code);
}
Exemple #3
0
static krb5_error_code
asn1_decode_sequence_of_keys(krb5_data *in, krb5_key_data **out,
                             krb5_int16 *n_key_data, krb5_kvno *mkvno)
{
    krb5_error_code err;
    ldap_seqof_key_data *p;

    /*
     * This should be pushed back into other library initialization
     * code.
     */
    err = kldap_ensure_initialized ();
    if (err)
        return err;

    err = accessor.asn1_ldap_decode_sequence_of_keys(in, &p);
    if (err)
        return err;
    *out = p->key_data;
    *n_key_data = p->n_key_data;
    *mkvno = p->mkvno;
    free(p);
    return 0;
}