2 * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
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 obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
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 EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
22 Contains: Declarations of HMAC routines used by TLS
24 Written by: Doug Mitchell
37 /* forward declaration of HMAC object */
40 /* Opaque reference to an HMAC session context */
42 typedef struct HMACContext
*HMACContextRef
;
44 /* The HMAC algorithms we support */
46 HA_Null
= 0, // i.e., uninitialized
51 /* For convenience..the max size of HMAC, in bytes, this module will ever return */
52 #define TLS_HMAC_MAX_SIZE 20
54 /* Create an HMAC session */
55 typedef OSStatus (*HMAC_AllocFcn
) (
56 const struct HMACReference
*hmac
,
60 HMACContextRef
*hmacCtx
); // RETURNED
63 typedef OSStatus (*HMAC_FreeFcn
) (
64 HMACContextRef hmacCtx
);
66 /* Reusable init, using same key */
67 typedef OSStatus (*HMAC_InitFcn
) (
68 HMACContextRef hmacCtx
);
70 /* normal crypt ops */
71 typedef OSStatus (*HMAC_UpdateFcn
) (
72 HMACContextRef hmacCtx
,
76 typedef OSStatus (*HMAC_FinalFcn
) (
77 HMACContextRef hmacCtx
,
78 void *hmac
, // mallocd by caller
79 unsigned *hmacLen
); // IN/OUT
82 typedef OSStatus (*HMAC_HmacFcn
) (
83 HMACContextRef hmacCtx
,
86 void *hmac
, // mallocd by caller
87 unsigned *hmacLen
); // IN/OUT
89 typedef struct HMACReference
{
95 HMAC_UpdateFcn update
;
100 extern const HMACReference TlsHmacNull
;
101 extern const HMACReference TlsHmacSHA1
;
102 extern const HMACReference TlsHmacMD5
;
107 #endif /* _TLS_HMAC_H_ */