1/*
2 * Copyright (c) 2000-2004,2011,2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24
25/*
26 * SHA1_MD5_Object.h - SHA1, MD5 digest objects
27 *
28 */
29
30#ifndef	_SHA1_MD5_OBJECT_H_
31#define _SHA1_MD5_OBJECT_H_
32
33#include <security_cdsa_utilities/digestobject.h>
34#include <CommonCrypto/CommonDigest.h>
35
36class SHA1Object : public DigestObject
37{
38public:
39	SHA1Object() { }
40	virtual ~SHA1Object() { };
41	virtual void digestInit();
42	virtual void digestUpdate(
43		const void 	*data,
44		size_t 		len);
45	virtual void digestFinal(
46		void 		*digest);
47	virtual DigestObject *digestClone() const;
48	virtual size_t digestSizeInBytes() const;
49private:
50	CC_SHA1_CTX		mCtx;
51};
52
53class MD5Object : public DigestObject
54{
55public:
56	MD5Object() { }
57	virtual ~MD5Object() { }
58	virtual void digestInit();
59	virtual void digestUpdate(
60		const void 	*data,
61		size_t 		len);
62	virtual void digestFinal(
63		void 		*digest);
64	virtual DigestObject *digestClone() const;
65	virtual size_t digestSizeInBytes() const;
66private:
67	CC_MD5_CTX mCtx;
68};
69
70#endif	/* _SHA1_MD5_OBJECT_H_ */
71