xref: /illumos-gate/usr/src/uts/common/gssapi/mechs/krb5/crypto/crc32/crc32.c (revision 508a0e8cf1600b06c1f7361ad76e736710d3fdf8)
1 /*
2  * Copyright 2001-2002 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #pragma ident	"%Z%%M%	%I%	%E% SMI"
7 
8 /*
9  * lib/crypto/crc32/crc.c
10  *
11  * Copyright 1990 by the Massachusetts Institute of Technology.
12  * All Rights Reserved.
13  *
14  * Export of this software from the United States of America may
15  *   require a specific license from the United States Government.
16  *   It is the responsibility of any person or organization contemplating
17  *   export to obtain such a license before exporting.
18  *
19  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
20  * distribute this software and its documentation for any purpose and
21  * without fee is hereby granted, provided that the above copyright
22  * notice appear in all copies and that both that copyright notice and
23  * this permission notice appear in supporting documentation, and that
24  * the name of M.I.T. not be used in advertising or publicity pertaining
25  * to distribution of the software without specific, written prior
26  * permission.  M.I.T. makes no representations about the suitability of
27  * this software for any purpose.  It is provided "as is" without express
28  * or implied warranty.
29  *
30  *
31  * CRC-32/AUTODIN-II routines
32  */
33 
34 #include <k5-int.h>
35 #include <gssapiP_generic.h>
36 #include <crc-32.h>
37 #include <sys/crc32.h>
38 
39 static uint32_t const crc_table[256] = { CRC32_TABLE };
40 
41 void
42 mit_crc32(in, in_length, cksum)
43 	krb5_const krb5_pointer in;
44 	krb5_const size_t in_length;
45 	unsigned long *cksum;
46 {
47 	unsigned int crc;
48 
49 	CRC32(crc, in, in_length, 0, crc_table);
50 
51 	*cksum = crc;
52 }
53