17c478bd9Sstevel@tonic-gate /*
2505d05c7Sgtb * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
37c478bd9Sstevel@tonic-gate * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate */
57c478bd9Sstevel@tonic-gate
67c478bd9Sstevel@tonic-gate /*
77c478bd9Sstevel@tonic-gate * Copyright (C) 1998 by the FundsXpress, INC.
8*2d6eb4a5SToomas Soome *
97c478bd9Sstevel@tonic-gate * All rights reserved.
10*2d6eb4a5SToomas Soome *
117c478bd9Sstevel@tonic-gate * Export of this software from the United States of America may require
127c478bd9Sstevel@tonic-gate * a specific license from the United States Government. It is the
137c478bd9Sstevel@tonic-gate * responsibility of any person or organization contemplating export to
147c478bd9Sstevel@tonic-gate * obtain such a license before exporting.
15*2d6eb4a5SToomas Soome *
167c478bd9Sstevel@tonic-gate * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
177c478bd9Sstevel@tonic-gate * distribute this software and its documentation for any purpose and
187c478bd9Sstevel@tonic-gate * without fee is hereby granted, provided that the above copyright
197c478bd9Sstevel@tonic-gate * notice appear in all copies and that both that copyright notice and
207c478bd9Sstevel@tonic-gate * this permission notice appear in supporting documentation, and that
217c478bd9Sstevel@tonic-gate * the name of FundsXpress. not be used in advertising or publicity pertaining
227c478bd9Sstevel@tonic-gate * to distribution of the software without specific, written prior
237c478bd9Sstevel@tonic-gate * permission. FundsXpress makes no representations about the suitability of
247c478bd9Sstevel@tonic-gate * this software for any purpose. It is provided "as is" without express
257c478bd9Sstevel@tonic-gate * or implied warranty.
26*2d6eb4a5SToomas Soome *
277c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
287c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
297c478bd9Sstevel@tonic-gate * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
307c478bd9Sstevel@tonic-gate */
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gate /* Solaris Kerberos:
337c478bd9Sstevel@tonic-gate * this code is based on the
347c478bd9Sstevel@tonic-gate * usr/src/lib/gss_mechs/mech_krb5/crypto/hash_provider/hash_md5.c
357c478bd9Sstevel@tonic-gate * file, but has been modified to use the Solaris resident md5.o kernel
367c478bd9Sstevel@tonic-gate * module and associated header /usr/include/sys/md5.o.
377c478bd9Sstevel@tonic-gate * This means that the MD5* functions are called instead of krb5_MD5*.
387c478bd9Sstevel@tonic-gate */
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate #include <k5-int.h>
417c478bd9Sstevel@tonic-gate #include <hash_provider.h>
427c478bd9Sstevel@tonic-gate #include <sys/crypto/api.h>
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate static krb5_error_code
k5_md5_hash(krb5_context context,unsigned int icount,krb5_const krb5_data * input,krb5_data * output)457c478bd9Sstevel@tonic-gate k5_md5_hash(krb5_context context,
467c478bd9Sstevel@tonic-gate unsigned int icount, krb5_const krb5_data *input,
477c478bd9Sstevel@tonic-gate krb5_data *output)
487c478bd9Sstevel@tonic-gate {
497c478bd9Sstevel@tonic-gate if (output->length != MD5_CKSUM_LENGTH)
507c478bd9Sstevel@tonic-gate return(KRB5_CRYPTO_INTERNAL);
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gate if (k5_ef_hash(context, icount, input, output))
537c478bd9Sstevel@tonic-gate return(KRB5_KEF_ERROR);
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gate return(0);
567c478bd9Sstevel@tonic-gate }
577c478bd9Sstevel@tonic-gate
587c478bd9Sstevel@tonic-gate const struct krb5_hash_provider krb5int_hash_md5 = {
59505d05c7Sgtb MD5_CKSUM_LENGTH,
60505d05c7Sgtb 64,
617c478bd9Sstevel@tonic-gate k5_md5_hash
627c478bd9Sstevel@tonic-gate };
63