]> git.saurik.com Git - apple/security.git/blob - AppleCSP/PBKDF2/pbkdDigest.h
Security-163.tar.gz
[apple/security.git] / AppleCSP / PBKDF2 / pbkdDigest.h
1 /*
2 * Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please
7 * obtain a copy of the License at http://www.apple.com/publicsource and
8 * read it before using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
12 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
13 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
15 * Please see the License for the specific language governing rights and
16 * limitations under the License.
17 */
18 /*
19 * pbkdDigest.h - SHA1/MD5 digest object for HMAC and PBE routines
20 */
21
22 #ifndef _PBKD_DIGEST_H_
23 #define _PBKD_DIGEST_H_
24
25 #include <Security/cssmtype.h>
26 #include <MiscCSPAlgs/MD5.h>
27 #include <MiscCSPAlgs/SHA1.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #define kSHA1DigestSize SHA1_DIGEST_SIZE
34 #define kSHA1BlockSize SHA1_BLOCK_SIZE
35
36 #define kMD5DigestSize MD5_DIGEST_SIZE
37 #define kMD5BlockSize MD5_BLOCK_SIZE
38
39
40 typedef struct {
41 union {
42 sha1Obj sha1Context; // must be allocd via sha1Alloc
43 struct MD5Context md5Context;
44 } dig;
45 CSSM_BOOL isSha1;
46 } DigestCtx;
47
48 /* Ops on a DigestCtx */
49 CSSM_RETURN DigestCtxInit(
50 DigestCtx *ctx,
51 CSSM_BOOL isSha1);
52 void DigestCtxFree(
53 DigestCtx *ctx);
54 void DigestCtxUpdate(
55 DigestCtx *ctx,
56 const void *textPtr,
57 UInt32 textLen);
58 void DigestCtxFinal(
59 DigestCtx *ctx,
60 void *digest);
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif /* _PBKD_DIGEST_H_ */
67