|
Packit Service |
99d1c0 |
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
Packit Service |
99d1c0 |
/*
|
|
Packit Service |
99d1c0 |
* Copyright (C) 1998 by the FundsXpress, INC.
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* All rights reserved.
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* Export of this software from the United States of America may require
|
|
Packit Service |
99d1c0 |
* a specific license from the United States Government. It is the
|
|
Packit Service |
99d1c0 |
* responsibility of any person or organization contemplating export to
|
|
Packit Service |
99d1c0 |
* obtain such a license before exporting.
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
|
|
Packit Service |
99d1c0 |
* distribute this software and its documentation for any purpose and
|
|
Packit Service |
99d1c0 |
* without fee is hereby granted, provided that the above copyright
|
|
Packit Service |
99d1c0 |
* notice appear in all copies and that both that copyright notice and
|
|
Packit Service |
99d1c0 |
* this permission notice appear in supporting documentation, and that
|
|
Packit Service |
99d1c0 |
* the name of FundsXpress. not be used in advertising or publicity pertaining
|
|
Packit Service |
99d1c0 |
* to distribution of the software without specific, written prior
|
|
Packit Service |
99d1c0 |
* permission. FundsXpress makes no representations about the suitability of
|
|
Packit Service |
99d1c0 |
* this software for any purpose. It is provided "as is" without express
|
|
Packit Service |
99d1c0 |
* or implied warranty.
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
|
Packit Service |
99d1c0 |
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
Packit Service |
99d1c0 |
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit Service |
99d1c0 |
*/
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
#include "crypto_int.h"
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
static krb5_boolean
|
|
Packit Service |
99d1c0 |
is_keyed_for(const struct krb5_cksumtypes *ctp,
|
|
Packit Service |
99d1c0 |
const struct krb5_keytypes *ktp)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
if (ctp->flags & CKSUM_UNKEYED)
|
|
Packit Service |
99d1c0 |
return FALSE;
|
|
Packit Service |
99d1c0 |
return (!ctp->enc || ktp->enc == ctp->enc);
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
krb5_error_code KRB5_CALLCONV
|
|
Packit Service |
99d1c0 |
krb5_c_keyed_checksum_types(krb5_context context, krb5_enctype enctype,
|
|
Packit Service |
99d1c0 |
unsigned int *count, krb5_cksumtype **cksumtypes)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
unsigned int i, c, nctypes;
|
|
Packit Service |
99d1c0 |
krb5_cksumtype *ctypes;
|
|
Packit Service |
99d1c0 |
const struct krb5_cksumtypes *ctp;
|
|
Packit Service |
99d1c0 |
const struct krb5_keytypes *ktp;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
*count = 0;
|
|
Packit Service |
99d1c0 |
*cksumtypes = NULL;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
ktp = find_enctype(enctype);
|
|
Packit Service |
99d1c0 |
if (ktp == NULL)
|
|
Packit Service |
99d1c0 |
return KRB5_BAD_ENCTYPE;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
nctypes = 0;
|
|
Packit Service |
99d1c0 |
for (i = 0; i < krb5int_cksumtypes_length; i++) {
|
|
Packit Service |
99d1c0 |
ctp = &krb5int_cksumtypes_list[i];
|
|
Packit Service |
99d1c0 |
if (is_keyed_for(ctp, ktp))
|
|
Packit Service |
99d1c0 |
nctypes++;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
ctypes = malloc(nctypes * sizeof(krb5_cksumtype));
|
|
Packit Service |
99d1c0 |
if (ctypes == NULL)
|
|
Packit Service |
99d1c0 |
return ENOMEM;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
c = 0;
|
|
Packit Service |
99d1c0 |
for (i = 0; i < krb5int_cksumtypes_length; i++) {
|
|
Packit Service |
99d1c0 |
ctp = &krb5int_cksumtypes_list[i];
|
|
Packit Service |
99d1c0 |
if (is_keyed_for(ctp, ktp))
|
|
Packit Service |
99d1c0 |
ctypes[c++] = ctp->ctype;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
*count = nctypes;
|
|
Packit Service |
99d1c0 |
*cksumtypes = ctypes;
|
|
Packit Service |
99d1c0 |
return 0;
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
void KRB5_CALLCONV
|
|
Packit Service |
99d1c0 |
krb5_free_cksumtypes(krb5_context context, krb5_cksumtype *val)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
free(val);
|
|
Packit Service |
99d1c0 |
}
|