-: 0:Source:keyed_checksum_types.c -: 0:Graph:/var/tsitkova/Sources/v10/trunk/src/lib/crypto/krb/keyed_checksum_types.so.gcno -: 0:Data:/var/tsitkova/Sources/v10/trunk/src/lib/crypto/krb/keyed_checksum_types.so.gcda -: 0:Runs:1630 -: 0:Programs:1 -: 1:/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -: 2:/* -: 3: * Copyright (C) 1998 by the FundsXpress, INC. -: 4: * -: 5: * All rights reserved. -: 6: * -: 7: * Export of this software from the United States of America may require -: 8: * a specific license from the United States Government. It is the -: 9: * responsibility of any person or organization contemplating export to -: 10: * obtain such a license before exporting. -: 11: * -: 12: * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and -: 13: * distribute this software and its documentation for any purpose and -: 14: * without fee is hereby granted, provided that the above copyright -: 15: * notice appear in all copies and that both that copyright notice and -: 16: * this permission notice appear in supporting documentation, and that -: 17: * the name of FundsXpress. not be used in advertising or publicity pertaining -: 18: * to distribution of the software without specific, written prior -: 19: * permission. FundsXpress makes no representations about the suitability of -: 20: * this software for any purpose. It is provided "as is" without express -: 21: * or implied warranty. -: 22: * -: 23: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -: 24: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -: 25: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -: 26: */ -: 27: -: 28:#include "crypto_int.h" -: 29: -: 30:static krb5_boolean 144: 31:is_keyed_for(const struct krb5_cksumtypes *ctp, -: 32: const struct krb5_keytypes *ktp) -: 33:{ 144: 34: if (ctp->flags & CKSUM_UNKEYED) 48: 35: return FALSE; 96: 36: return (!ctp->enc || ktp->enc == ctp->enc); -: 37:} -: 38: -: 39:krb5_error_code KRB5_CALLCONV 6: 40:krb5_c_keyed_checksum_types(krb5_context context, krb5_enctype enctype, -: 41: unsigned int *count, krb5_cksumtype **cksumtypes) -: 42:{ -: 43: unsigned int i, c, nctypes; -: 44: krb5_cksumtype *ctypes; -: 45: const struct krb5_cksumtypes *ctp; -: 46: const struct krb5_keytypes *ktp; -: 47: 6: 48: *count = 0; 6: 49: *cksumtypes = NULL; -: 50: 6: 51: ktp = find_enctype(enctype); 6: 52: if (ktp == NULL) #####: 53: return KRB5_BAD_ENCTYPE; -: 54: 6: 55: nctypes = 0; 78: 56: for (i = 0; i < krb5int_cksumtypes_length; i++) { 72: 57: ctp = &krb5int_cksumtypes_list[i]; 72: 58: if (is_keyed_for(ctp, ktp)) 16: 59: nctypes++; -: 60: } -: 61: 6: 62: ctypes = malloc(nctypes * sizeof(krb5_cksumtype)); 6: 63: if (ctypes == NULL) #####: 64: return ENOMEM; -: 65: 6: 66: c = 0; 78: 67: for (i = 0; i < krb5int_cksumtypes_length; i++) { 72: 68: ctp = &krb5int_cksumtypes_list[i]; 72: 69: if (is_keyed_for(ctp, ktp)) 16: 70: ctypes[c++] = ctp->ctype; -: 71: } -: 72: 6: 73: *count = nctypes; 6: 74: *cksumtypes = ctypes; 6: 75: return 0; -: 76:} -: 77: -: 78:void KRB5_CALLCONV 6: 79:krb5_free_cksumtypes(krb5_context context, krb5_cksumtype *val) -: 80:{ 6: 81: free(val); 6: 82:}