1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 3*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 4*7c478bd9Sstevel@tonic-gate */ 5*7c478bd9Sstevel@tonic-gate 6*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 7*7c478bd9Sstevel@tonic-gate 8*7c478bd9Sstevel@tonic-gate /* 9*7c478bd9Sstevel@tonic-gate * Copyright (C) 1998 by the FundsXpress, INC. 10*7c478bd9Sstevel@tonic-gate * 11*7c478bd9Sstevel@tonic-gate * All rights reserved. 12*7c478bd9Sstevel@tonic-gate * 13*7c478bd9Sstevel@tonic-gate * Export of this software from the United States of America may require 14*7c478bd9Sstevel@tonic-gate * a specific license from the United States Government. It is the 15*7c478bd9Sstevel@tonic-gate * responsibility of any person or organization contemplating export to 16*7c478bd9Sstevel@tonic-gate * obtain such a license before exporting. 17*7c478bd9Sstevel@tonic-gate * 18*7c478bd9Sstevel@tonic-gate * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 19*7c478bd9Sstevel@tonic-gate * distribute this software and its documentation for any purpose and 20*7c478bd9Sstevel@tonic-gate * without fee is hereby granted, provided that the above copyright 21*7c478bd9Sstevel@tonic-gate * notice appear in all copies and that both that copyright notice and 22*7c478bd9Sstevel@tonic-gate * this permission notice appear in supporting documentation, and that 23*7c478bd9Sstevel@tonic-gate * the name of FundsXpress. not be used in advertising or publicity pertaining 24*7c478bd9Sstevel@tonic-gate * to distribution of the software without specific, written prior 25*7c478bd9Sstevel@tonic-gate * permission. FundsXpress makes no representations about the suitability of 26*7c478bd9Sstevel@tonic-gate * this software for any purpose. It is provided "as is" without express 27*7c478bd9Sstevel@tonic-gate * or implied warranty. 28*7c478bd9Sstevel@tonic-gate * 29*7c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 30*7c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 31*7c478bd9Sstevel@tonic-gate * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 32*7c478bd9Sstevel@tonic-gate */ 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #include <k5-int.h> 35*7c478bd9Sstevel@tonic-gate #include <hash_provider.h> 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate static void 38*7c478bd9Sstevel@tonic-gate k5_md5_hash_size(size_t *output) 39*7c478bd9Sstevel@tonic-gate { 40*7c478bd9Sstevel@tonic-gate *output = MD5_CKSUM_LENGTH; 41*7c478bd9Sstevel@tonic-gate } 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate static void 44*7c478bd9Sstevel@tonic-gate k5_md5_block_size(size_t *output) 45*7c478bd9Sstevel@tonic-gate { 46*7c478bd9Sstevel@tonic-gate *output = MD5_BLOCKSIZE; 47*7c478bd9Sstevel@tonic-gate } 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate static krb5_error_code 50*7c478bd9Sstevel@tonic-gate k5_md5_hash(krb5_context context, 51*7c478bd9Sstevel@tonic-gate unsigned int icount, krb5_const krb5_data *input, 52*7c478bd9Sstevel@tonic-gate krb5_data *output) 53*7c478bd9Sstevel@tonic-gate { 54*7c478bd9Sstevel@tonic-gate CK_MECHANISM mechanism; 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate mechanism.mechanism = CKM_MD5; 57*7c478bd9Sstevel@tonic-gate mechanism.pParameter = NULL_PTR; 58*7c478bd9Sstevel@tonic-gate mechanism.ulParameterLen = 0; 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate return(k5_ef_hash(context, &mechanism, icount, input, output)); 61*7c478bd9Sstevel@tonic-gate } 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate const struct krb5_hash_provider krb5int_hash_md5 = { 64*7c478bd9Sstevel@tonic-gate k5_md5_hash_size, 65*7c478bd9Sstevel@tonic-gate k5_md5_block_size, 66*7c478bd9Sstevel@tonic-gate k5_md5_hash 67*7c478bd9Sstevel@tonic-gate }; 68