]>
Commit | Line | Data |
---|---|---|
b0d623f7 A |
1 | /* |
2 | * Copyright (c) 2008 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
25 | * | |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
27 | */ | |
28 | ||
29 | ||
30 | #ifndef _NFS_NFS_GSS_CRYPTO_H_ | |
31 | #define _NFS_NFS_GSS_CRYPTO_H_ | |
32 | #include <libkern/libkern.h> | |
33 | #include <libkern/crypto/sha1.h> | |
34 | #include <libkern/crypto/md5.h> | |
316670eb | 35 | #include <libkern/crypto/des.h> |
b0d623f7 A |
36 | |
37 | #define KG_USAGE_SEAL 22 | |
38 | #define KG_USAGE_SIGN 23 | |
39 | #define KG_USAGE_SEQ 24 | |
40 | ||
41 | #define KEY_USAGE_DES3_SEAL (const unsigned char *)"\x00\x00\x00\x16\xaa" | |
42 | #define KEY_USAGE_DES3_SIGN (const unsigned char *)"\x00\x00\x00\x17\x99" | |
43 | #define KEY_USAGE_DES3_SEQ (const unsigned char *)"\x00\x00\x00\x18\x55" | |
44 | #define KEY_USAGE_LEN 5 | |
45 | ||
46 | typedef struct { | |
47 | SHA1_CTX sha1_ctx; | |
48 | des_cblock dk[3]; | |
49 | } HMAC_SHA1_DES3KD_CTX; | |
50 | ||
51 | typedef struct { | |
52 | MD5_CTX md5_ctx; | |
316670eb | 53 | des_cbc_key_schedule *sched; |
b0d623f7 A |
54 | } MD5_DESCBC_CTX; |
55 | ||
56 | #define MD5_DESCBC_DIGEST_LENGTH 8 | |
57 | ||
58 | __BEGIN_DECLS | |
59 | ||
60 | void krb5_nfold(unsigned int, const unsigned char *, unsigned int, unsigned char *); | |
61 | void des3_make_key(const unsigned char[21], des_cblock[3]); | |
b0d623f7 | 62 | int des3_derive_key(des_cblock[3], des_cblock[3], const unsigned char *, int); |
316670eb | 63 | |
b0d623f7 A |
64 | void HMAC_SHA1_DES3KD_Init(HMAC_SHA1_DES3KD_CTX *, des_cblock[3], int); |
65 | void HMAC_SHA1_DES3KD_Update(HMAC_SHA1_DES3KD_CTX *, void *, size_t); | |
66 | void HMAC_SHA1_DES3KD_Final(void *, HMAC_SHA1_DES3KD_CTX *); | |
b0d623f7 | 67 | |
316670eb | 68 | void MD5_DESCBC_Init(MD5_DESCBC_CTX *, des_cbc_key_schedule *); |
b0d623f7 A |
69 | void MD5_DESCBC_Update(MD5_DESCBC_CTX *, void *, size_t); |
70 | void MD5_DESCBC_Final(void *, MD5_DESCBC_CTX *); | |
71 | ||
72 | __END_DECLS | |
73 | ||
74 | #endif /* _NFS_NFS_GSS_CRYPTO_H_ */ |