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
39 /* forward declaration of HMAC object */
42 /* Opaque reference to an HMAC session context */
44 typedef struct HMACContext
*HMACContextRef
;
46 /* The HMAC algorithms we support */
48 HA_Null
= 0, // i.e., uninitialized
53 /* For convenience..the max size of HMAC, in bytes, this module will ever return */
54 #define TLS_HMAC_MAX_SIZE 20
56 /* Create an HMAC session */
57 typedef SSLErr (*HMAC_AllocFcn
) (
58 const struct HMACReference
*hmac
,
62 HMACContextRef
*hmacCtx
); // RETURNED
65 typedef SSLErr (*HMAC_FreeFcn
) (
66 HMACContextRef hmacCtx
);
68 /* Reusable init, using same key */
69 typedef SSLErr (*HMAC_InitFcn
) (
70 HMACContextRef hmacCtx
);
72 /* normal crypt ops */
73 typedef SSLErr (*HMAC_UpdateFcn
) (
74 HMACContextRef hmacCtx
,
78 typedef SSLErr (*HMAC_FinalFcn
) (
79 HMACContextRef hmacCtx
,
80 void *hmac
, // mallocd by caller
81 unsigned *hmacLen
); // IN/OUT
84 typedef SSLErr (*HMAC_HmacFcn
) (
85 HMACContextRef hmacCtx
,
88 void *hmac
, // mallocd by caller
89 unsigned *hmacLen
); // IN/OUT
91 typedef struct HMACReference
{
97 HMAC_UpdateFcn update
;
102 extern const HMACReference TlsHmacNull
;
103 extern const HMACReference TlsHmacSHA1
;
104 extern const HMACReference TlsHmacMD5
;
109 #endif /* _TLS_HMAC_H_ */