xref: /aoo41x/main/sal/inc/rtl/digest.h (revision 9eab2a37)
1*9eab2a37SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9eab2a37SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9eab2a37SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9eab2a37SAndrew Rist  * distributed with this work for additional information
6*9eab2a37SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9eab2a37SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9eab2a37SAndrew Rist  * "License"); you may not use this file except in compliance
9*9eab2a37SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9eab2a37SAndrew Rist  *
11*9eab2a37SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9eab2a37SAndrew Rist  *
13*9eab2a37SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9eab2a37SAndrew Rist  * software distributed under the License is distributed on an
15*9eab2a37SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9eab2a37SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9eab2a37SAndrew Rist  * specific language governing permissions and limitations
18*9eab2a37SAndrew Rist  * under the License.
19*9eab2a37SAndrew Rist  *
20*9eab2a37SAndrew Rist  *************************************************************/
21*9eab2a37SAndrew Rist 
22*9eab2a37SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _RTL_DIGEST_H_
25cdf0e10cSrcweir #define _RTL_DIGEST_H_ "$Revision: 1.8 $"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <sal/types.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #ifdef __cplusplus
30cdf0e10cSrcweir extern "C" {
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir 
33cdf0e10cSrcweir /*========================================================================
34cdf0e10cSrcweir  *
35cdf0e10cSrcweir  * rtlDigest.
36cdf0e10cSrcweir  *
37cdf0e10cSrcweir  *======================================================================*/
38cdf0e10cSrcweir /** Digest Handle opaque type.
39cdf0e10cSrcweir  */
40cdf0e10cSrcweir typedef void* rtlDigest;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 
43cdf0e10cSrcweir /** Digest Algorithm enumeration.
44cdf0e10cSrcweir     @see rtl_digest_create()
45cdf0e10cSrcweir  */
46cdf0e10cSrcweir enum __rtl_DigestAlgorithm
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 	rtl_Digest_AlgorithmMD2,
49cdf0e10cSrcweir 	rtl_Digest_AlgorithmMD5,
50cdf0e10cSrcweir 	rtl_Digest_AlgorithmSHA,
51cdf0e10cSrcweir 	rtl_Digest_AlgorithmSHA1,
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 	rtl_Digest_AlgorithmHMAC_MD5,
54cdf0e10cSrcweir 	rtl_Digest_AlgorithmHMAC_SHA1,
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	rtl_Digest_AlgorithmInvalid,
57cdf0e10cSrcweir 	rtl_Digest_Algorithm_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
58cdf0e10cSrcweir };
59cdf0e10cSrcweir 
60cdf0e10cSrcweir /** Digest Algorithm type.
61cdf0e10cSrcweir  */
62cdf0e10cSrcweir typedef enum __rtl_DigestAlgorithm rtlDigestAlgorithm;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
65cdf0e10cSrcweir /** Error Code enumeration.
66cdf0e10cSrcweir  */
67cdf0e10cSrcweir enum __rtl_DigestError
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 	rtl_Digest_E_None,
70cdf0e10cSrcweir 	rtl_Digest_E_Argument,
71cdf0e10cSrcweir 	rtl_Digest_E_Algorithm,
72cdf0e10cSrcweir 	rtl_Digest_E_BufferSize,
73cdf0e10cSrcweir 	rtl_Digest_E_Memory,
74cdf0e10cSrcweir 	rtl_Digest_E_Unknown,
75cdf0e10cSrcweir 	rtl_Digest_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
76cdf0e10cSrcweir };
77cdf0e10cSrcweir 
78cdf0e10cSrcweir /** Error Code type.
79cdf0e10cSrcweir  */
80cdf0e10cSrcweir typedef enum __rtl_DigestError rtlDigestError;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 
83cdf0e10cSrcweir /** Create a digest handle for the given algorithm.
84cdf0e10cSrcweir     @see rtlDigestAlgorithm
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	@param  Algorithm [in] digest algorithm.
87cdf0e10cSrcweir 	@return Digest handle, or 0 upon failure.
88cdf0e10cSrcweir  */
89cdf0e10cSrcweir rtlDigest SAL_CALL rtl_digest_create  (
90cdf0e10cSrcweir 	rtlDigestAlgorithm Algorithm
91cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 
94cdf0e10cSrcweir /** Destroy a digest handle.
95cdf0e10cSrcweir 	@postcond Digest handle destroyed and invalid.
96cdf0e10cSrcweir     @param    Digest [in] digest handle to be destroyed.
97cdf0e10cSrcweir 	@return   None.
98cdf0e10cSrcweir  */
99cdf0e10cSrcweir void SAL_CALL rtl_digest_destroy (
100cdf0e10cSrcweir 	rtlDigest Digest
101cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 
104cdf0e10cSrcweir /** Query the algorithm of a given digest.
105cdf0e10cSrcweir     @param  Digest [in] digest handle.
106cdf0e10cSrcweir 	@return digest algorithm, or rtl_Digest_AlgorithmInvalid upon failure.
107cdf0e10cSrcweir  */
108cdf0e10cSrcweir rtlDigestAlgorithm SAL_CALL rtl_digest_queryAlgorithm (
109cdf0e10cSrcweir 	rtlDigest Digest
110cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 
113cdf0e10cSrcweir /** Query the length of a given digest.
114cdf0e10cSrcweir     @param  Digest [in] digest handle.
115cdf0e10cSrcweir 	@return digest length, or 0 upon failure.
116cdf0e10cSrcweir  */
117cdf0e10cSrcweir sal_uInt32 SAL_CALL rtl_digest_queryLength (
118cdf0e10cSrcweir 	rtlDigest Digest
119cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
122cdf0e10cSrcweir /** Initialize a digest with given data.
123cdf0e10cSrcweir     @param  Digest  [in] digest handle.
124cdf0e10cSrcweir 	@param  pData   [in] data buffer.
125cdf0e10cSrcweir 	@param  nDatLen [in] data length.
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
128cdf0e10cSrcweir  */
129cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_init (
130cdf0e10cSrcweir 	rtlDigest Digest,
131cdf0e10cSrcweir 	const sal_uInt8 *pData, sal_uInt32 nDatLen
132cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 
135cdf0e10cSrcweir /** Update a digest with given data.
136cdf0e10cSrcweir     @param  Digest  [in] digest handle.
137cdf0e10cSrcweir 	@param  pData   [in] data buffer.
138cdf0e10cSrcweir 	@param  nDatLen [in] data length.
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
141cdf0e10cSrcweir  */
142cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_update (
143cdf0e10cSrcweir 	rtlDigest Digest,
144cdf0e10cSrcweir 	const void *pData, sal_uInt32 nDatLen
145cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 
148cdf0e10cSrcweir /** Finalize a digest and retrieve the digest value.
149cdf0e10cSrcweir     @precond  Digest value length must not be less than digest length.
150cdf0e10cSrcweir 	@postcond Digest initialized to accept another update sequence.
151cdf0e10cSrcweir 	@see      rtl_digest_queryLength()
152cdf0e10cSrcweir 	@see      rtl_digest_update()
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     @param  Digest  [in] digest handle.
155cdf0e10cSrcweir 	@param  pBuffer [in] digest value buffer.
156cdf0e10cSrcweir 	@param  nBufLen [in] digest value length.
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
159cdf0e10cSrcweir  */
160cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_get (
161cdf0e10cSrcweir 	rtlDigest Digest,
162cdf0e10cSrcweir 	sal_uInt8 *pBuffer, sal_uInt32 nBufLen
163cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
164cdf0e10cSrcweir 
165cdf0e10cSrcweir /*========================================================================
166cdf0e10cSrcweir  *
167cdf0e10cSrcweir  * rtl_digest_MD2 interface.
168cdf0e10cSrcweir  *
169cdf0e10cSrcweir  *======================================================================*/
170cdf0e10cSrcweir #define RTL_DIGEST_LENGTH_MD2 16
171cdf0e10cSrcweir 
172cdf0e10cSrcweir /** Create a MD2 digest handle.
173cdf0e10cSrcweir     @descr The MD2 digest algorithm is specified in
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     RFC 1319 (Informational)
176cdf0e10cSrcweir       The MD2 Message-Digest Algorithm
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     @see rtl_digest_create()
179cdf0e10cSrcweir  */
180cdf0e10cSrcweir rtlDigest SAL_CALL rtl_digest_createMD2 (void) SAL_THROW_EXTERN_C();
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 
183cdf0e10cSrcweir /** Destroy a MD2 digest handle.
184cdf0e10cSrcweir     @see rtl_digest_destroy()
185cdf0e10cSrcweir  */
186cdf0e10cSrcweir void SAL_CALL rtl_digest_destroyMD2 (
187cdf0e10cSrcweir 	rtlDigest Digest
188cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 
191cdf0e10cSrcweir /** Update a MD2 digest with given data.
192cdf0e10cSrcweir     @see rtl_digest_update()
193cdf0e10cSrcweir  */
194cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_updateMD2 (
195cdf0e10cSrcweir 	rtlDigest Digest,
196cdf0e10cSrcweir 	const void *pData, sal_uInt32 nDatLen
197cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 
200cdf0e10cSrcweir /** Finalize a MD2 digest and retrieve the digest value.
201cdf0e10cSrcweir     @see rtl_digest_get()
202cdf0e10cSrcweir  */
203cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_getMD2 (
204cdf0e10cSrcweir 	rtlDigest Digest,
205cdf0e10cSrcweir 	sal_uInt8 *pBuffer, sal_uInt32 nBufLen
206cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 
209cdf0e10cSrcweir /** Evaluate a MD2 digest value from given data.
210cdf0e10cSrcweir     @descr This function performs an optimized call sequence on a
211cdf0e10cSrcweir 	single data buffer, avoiding digest creation and destruction.
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 	@see rtl_digest_updateMD2()
214cdf0e10cSrcweir 	@see rtl_digest_getMD2()
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 	@param  pData   [in] data buffer.
217cdf0e10cSrcweir 	@param  nDatLen [in] data length.
218cdf0e10cSrcweir 	@param  pBuffer [in] digest value buffer.
219cdf0e10cSrcweir 	@param  nBufLen [in] digest value length.
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
222cdf0e10cSrcweir  */
223cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_MD2 (
224cdf0e10cSrcweir 	const void *pData,   sal_uInt32 nDatLen,
225cdf0e10cSrcweir 	sal_uInt8  *pBuffer, sal_uInt32 nBufLen
226cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
227cdf0e10cSrcweir 
228cdf0e10cSrcweir /*========================================================================
229cdf0e10cSrcweir  *
230cdf0e10cSrcweir  * rtl_digest_MD5 interface.
231cdf0e10cSrcweir  *
232cdf0e10cSrcweir  *======================================================================*/
233cdf0e10cSrcweir #define RTL_DIGEST_LENGTH_MD5 16
234cdf0e10cSrcweir 
235cdf0e10cSrcweir /** Create a MD5 digest handle.
236cdf0e10cSrcweir     @descr The MD5 digest algorithm is specified in
237cdf0e10cSrcweir 
238cdf0e10cSrcweir     RFC 1321 (Informational)
239cdf0e10cSrcweir       The MD5 Message-Digest Algorithm
240cdf0e10cSrcweir 
241cdf0e10cSrcweir     @see rtl_digest_create()
242cdf0e10cSrcweir  */
243cdf0e10cSrcweir rtlDigest SAL_CALL rtl_digest_createMD5 (void) SAL_THROW_EXTERN_C();
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 
246cdf0e10cSrcweir /** Destroy a MD5 digest handle.
247cdf0e10cSrcweir     @see rtl_digest_destroy()
248cdf0e10cSrcweir  */
249cdf0e10cSrcweir void SAL_CALL rtl_digest_destroyMD5 (
250cdf0e10cSrcweir 	rtlDigest Digest
251cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 
254cdf0e10cSrcweir /** Update a MD5 digest with given data.
255cdf0e10cSrcweir     @see rtl_digest_update()
256cdf0e10cSrcweir  */
257cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_updateMD5 (
258cdf0e10cSrcweir 	rtlDigest Digest,
259cdf0e10cSrcweir 	const void *pData, sal_uInt32 nDatLen
260cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 
263cdf0e10cSrcweir /** Finalize a MD5 digest and retrieve the digest value.
264cdf0e10cSrcweir     @see rtl_digest_get()
265cdf0e10cSrcweir  */
266cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_getMD5 (
267cdf0e10cSrcweir 	rtlDigest Digest,
268cdf0e10cSrcweir 	sal_uInt8 *pBuffer, sal_uInt32 nBufLen
269cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 
272cdf0e10cSrcweir /** Retrieve the raw (not finalized) MD5 digest value.
273cdf0e10cSrcweir 	@descr This function is a non-standard replacement for
274cdf0e10cSrcweir 	rtl_digest_getMD5() and must be used with caution.
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 	@postcond Digest initialized to accept another update sequence.
277cdf0e10cSrcweir     @see      rtl_digest_get()
278cdf0e10cSrcweir  */
279cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_rawMD5 (
280cdf0e10cSrcweir 	rtlDigest Digest,
281cdf0e10cSrcweir 	sal_uInt8 *pBuffer, sal_uInt32 nBufLen
282cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 
285cdf0e10cSrcweir /** Evaluate a MD5 digest value from given data.
286cdf0e10cSrcweir     @descr This function performs an optimized call sequence on a
287cdf0e10cSrcweir 	single data buffer, avoiding digest creation and destruction.
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 	@see rtl_digest_updateMD5()
290cdf0e10cSrcweir 	@see rtl_digest_getMD5()
291cdf0e10cSrcweir 
292cdf0e10cSrcweir 	@param  pData   [in] data buffer.
293cdf0e10cSrcweir 	@param  nDatLen [in] data length.
294cdf0e10cSrcweir 	@param  pBuffer [in] digest value buffer.
295cdf0e10cSrcweir 	@param  nBufLen [in] digest value length.
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
298cdf0e10cSrcweir  */
299cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_MD5 (
300cdf0e10cSrcweir 	const void *pData,   sal_uInt32 nDatLen,
301cdf0e10cSrcweir 	sal_uInt8  *pBuffer, sal_uInt32 nBufLen
302cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
303cdf0e10cSrcweir 
304cdf0e10cSrcweir /*========================================================================
305cdf0e10cSrcweir  *
306cdf0e10cSrcweir  * rtl_digest_SHA interface.
307cdf0e10cSrcweir  *
308cdf0e10cSrcweir  *======================================================================*/
309cdf0e10cSrcweir #define RTL_DIGEST_LENGTH_SHA 20
310cdf0e10cSrcweir 
311cdf0e10cSrcweir /** Create a SHA digest handle.
312cdf0e10cSrcweir     @descr The SHA digest algorithm is specified in
313cdf0e10cSrcweir 
314cdf0e10cSrcweir     FIPS PUB 180 (Superseded by FIPS PUB 180-1)
315cdf0e10cSrcweir       Secure Hash Standard
316cdf0e10cSrcweir 
317cdf0e10cSrcweir     @see rtl_digest_create()
318cdf0e10cSrcweir  */
319cdf0e10cSrcweir rtlDigest SAL_CALL rtl_digest_createSHA (void) SAL_THROW_EXTERN_C();
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 
322cdf0e10cSrcweir /** Destroy a SHA digest handle.
323cdf0e10cSrcweir     @see rtl_digest_destroy()
324cdf0e10cSrcweir  */
325cdf0e10cSrcweir void SAL_CALL rtl_digest_destroySHA (
326cdf0e10cSrcweir 	rtlDigest Digest
327cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 
330cdf0e10cSrcweir /** Update a SHA digest with given data.
331cdf0e10cSrcweir     @see rtl_digest_update()
332cdf0e10cSrcweir  */
333cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_updateSHA (
334cdf0e10cSrcweir 	rtlDigest Digest,
335cdf0e10cSrcweir 	const void *pData, sal_uInt32 nDatLen
336cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
337cdf0e10cSrcweir 
338cdf0e10cSrcweir 
339cdf0e10cSrcweir /** Finalize a SHA digest and retrieve the digest value.
340cdf0e10cSrcweir     @see rtl_digest_get()
341cdf0e10cSrcweir  */
342cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_getSHA (
343cdf0e10cSrcweir 	rtlDigest Digest,
344cdf0e10cSrcweir 	sal_uInt8 *pBuffer, sal_uInt32 nBufLen
345cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
346cdf0e10cSrcweir 
347cdf0e10cSrcweir 
348cdf0e10cSrcweir /** Evaluate a SHA digest value from given data.
349cdf0e10cSrcweir     @descr This function performs an optimized call sequence on a
350cdf0e10cSrcweir 	single data buffer, avoiding digest creation and destruction.
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 	@see rtl_digest_updateSHA()
353cdf0e10cSrcweir 	@see rtl_digest_getSHA()
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 	@param  pData   [in] data buffer.
356cdf0e10cSrcweir 	@param  nDatLen [in] data length.
357cdf0e10cSrcweir 	@param  pBuffer [in] digest value buffer.
358cdf0e10cSrcweir 	@param  nBufLen [in] digest value length.
359cdf0e10cSrcweir 
360cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
361cdf0e10cSrcweir  */
362cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_SHA (
363cdf0e10cSrcweir 	const void *pData,   sal_uInt32 nDatLen,
364cdf0e10cSrcweir 	sal_uInt8  *pBuffer, sal_uInt32 nBufLen
365cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
366cdf0e10cSrcweir 
367cdf0e10cSrcweir /*========================================================================
368cdf0e10cSrcweir  *
369cdf0e10cSrcweir  * rtl_digest_SHA1 interface.
370cdf0e10cSrcweir  *
371cdf0e10cSrcweir  *======================================================================*/
372cdf0e10cSrcweir #define RTL_DIGEST_LENGTH_SHA1 20
373cdf0e10cSrcweir 
374cdf0e10cSrcweir /** Create a SHA1 digest handle.
375cdf0e10cSrcweir     @descr The SHA1 digest algorithm is specified in
376cdf0e10cSrcweir 
377cdf0e10cSrcweir     FIPS PUB 180-1 (Supersedes FIPS PUB 180)
378cdf0e10cSrcweir       Secure Hash Standard
379cdf0e10cSrcweir 
380cdf0e10cSrcweir     @see rtl_digest_create()
381cdf0e10cSrcweir  */
382cdf0e10cSrcweir rtlDigest SAL_CALL rtl_digest_createSHA1 (void) SAL_THROW_EXTERN_C();
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 
385cdf0e10cSrcweir /** Destroy a SHA1 digest handle.
386cdf0e10cSrcweir     @see rtl_digest_destroy()
387cdf0e10cSrcweir  */
388cdf0e10cSrcweir void SAL_CALL rtl_digest_destroySHA1 (
389cdf0e10cSrcweir 	rtlDigest Digest
390cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
391cdf0e10cSrcweir 
392cdf0e10cSrcweir 
393cdf0e10cSrcweir /** Update a SHA1 digest with given data.
394cdf0e10cSrcweir     @see rtl_digest_update()
395cdf0e10cSrcweir  */
396cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_updateSHA1 (
397cdf0e10cSrcweir 	rtlDigest Digest,
398cdf0e10cSrcweir 	const void *pData, sal_uInt32 nDatLen
399cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
400cdf0e10cSrcweir 
401cdf0e10cSrcweir 
402cdf0e10cSrcweir /** Finalize a SHA1 digest and retrieve the digest value.
403cdf0e10cSrcweir     @see rtl_digest_get()
404cdf0e10cSrcweir  */
405cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_getSHA1 (
406cdf0e10cSrcweir 	rtlDigest Digest,
407cdf0e10cSrcweir 	sal_uInt8 *pBuffer, sal_uInt32 nBufLen
408cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 
411cdf0e10cSrcweir /** Evaluate a SHA1 digest value from given data.
412cdf0e10cSrcweir     @descr This function performs an optimized call sequence on a
413cdf0e10cSrcweir 	single data buffer, avoiding digest creation and destruction.
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 	@see rtl_digest_updateSHA1()
416cdf0e10cSrcweir 	@see rtl_digest_getSHA1()
417cdf0e10cSrcweir 
418cdf0e10cSrcweir 	@param  pData   [in] data buffer.
419cdf0e10cSrcweir 	@param  nDatLen [in] data length.
420cdf0e10cSrcweir 	@param  pBuffer [in] digest value buffer.
421cdf0e10cSrcweir 	@param  nBufLen [in] digest value length.
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
424cdf0e10cSrcweir  */
425cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_SHA1 (
426cdf0e10cSrcweir 	const void *pData,   sal_uInt32 nDatLen,
427cdf0e10cSrcweir 	sal_uInt8  *pBuffer, sal_uInt32 nBufLen
428cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
429cdf0e10cSrcweir 
430cdf0e10cSrcweir /*========================================================================
431cdf0e10cSrcweir  *
432cdf0e10cSrcweir  * rtl_digest_HMAC_MD5 interface.
433cdf0e10cSrcweir  *
434cdf0e10cSrcweir  *======================================================================*/
435cdf0e10cSrcweir #define RTL_DIGEST_LENGTH_HMAC_MD5 RTL_DIGEST_LENGTH_MD5
436cdf0e10cSrcweir 
437cdf0e10cSrcweir /** Create a HMAC_MD5 digest handle.
438cdf0e10cSrcweir     @descr The HMAC_MD5 digest algorithm is specified in
439cdf0e10cSrcweir 
440cdf0e10cSrcweir     RFC 2104 (Informational)
441cdf0e10cSrcweir       HMAC: Keyed-Hashing for Message Authentication
442cdf0e10cSrcweir 
443cdf0e10cSrcweir     @see rtl_digest_create()
444cdf0e10cSrcweir  */
445cdf0e10cSrcweir rtlDigest SAL_CALL rtl_digest_createHMAC_MD5 (void) SAL_THROW_EXTERN_C();
446cdf0e10cSrcweir 
447cdf0e10cSrcweir 
448cdf0e10cSrcweir /** Destroy a HMAC_MD5 digest handle.
449cdf0e10cSrcweir     @see rtl_digest_destroy()
450cdf0e10cSrcweir  */
451cdf0e10cSrcweir void SAL_CALL rtl_digest_destroyHMAC_MD5 (
452cdf0e10cSrcweir 	rtlDigest Digest
453cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
454cdf0e10cSrcweir 
455cdf0e10cSrcweir 
456cdf0e10cSrcweir /** Initialize a HMAC_MD5 digest.
457cdf0e10cSrcweir     @see rtl_digest_init()
458cdf0e10cSrcweir 
459cdf0e10cSrcweir     @param  Digest   [in] digest handle.
460cdf0e10cSrcweir 	@param  pKeyData [in] key material buffer.
461cdf0e10cSrcweir 	@param  nKeyLen  [in] key material length.
462cdf0e10cSrcweir 
463cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
464cdf0e10cSrcweir  */
465cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_initHMAC_MD5 (
466cdf0e10cSrcweir 	rtlDigest Digest,
467cdf0e10cSrcweir 	const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen
468cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 
471cdf0e10cSrcweir /** Update a HMAC_MD5 digest with given data.
472cdf0e10cSrcweir     @see rtl_digest_update()
473cdf0e10cSrcweir  */
474cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_updateHMAC_MD5 (
475cdf0e10cSrcweir 	rtlDigest Digest,
476cdf0e10cSrcweir 	const void *pData, sal_uInt32 nDatLen
477cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
478cdf0e10cSrcweir 
479cdf0e10cSrcweir 
480cdf0e10cSrcweir /** Finalize a HMAC_MD5 digest and retrieve the digest value.
481cdf0e10cSrcweir     @see rtl_digest_get()
482cdf0e10cSrcweir  */
483cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_getHMAC_MD5 (
484cdf0e10cSrcweir 	rtlDigest Digest,
485cdf0e10cSrcweir 	sal_uInt8 *pBuffer, sal_uInt32 nBufLen
486cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
487cdf0e10cSrcweir 
488cdf0e10cSrcweir 
489cdf0e10cSrcweir /** Evaluate a HMAC_MD5 digest value from given data.
490cdf0e10cSrcweir     @descr This function performs an optimized call sequence on a
491cdf0e10cSrcweir 	single data buffer, avoiding digest creation and destruction.
492cdf0e10cSrcweir 
493cdf0e10cSrcweir 	@see rtl_digest_initHMAC_MD5()
494cdf0e10cSrcweir 	@see rtl_digest_updateHMAC_MD5()
495cdf0e10cSrcweir 	@see rtl_digest_getHMAC_MD5()
496cdf0e10cSrcweir 
497cdf0e10cSrcweir 	@param  pKeyData [in] key material buffer.
498cdf0e10cSrcweir 	@param  nKeyLen  [in] key material length.
499cdf0e10cSrcweir 	@param  pData    [in] data buffer.
500cdf0e10cSrcweir 	@param  nDatLen  [in] data length.
501cdf0e10cSrcweir 	@param  pBuffer  [in] digest value buffer.
502cdf0e10cSrcweir 	@param  nBufLen  [in] digest value length.
503cdf0e10cSrcweir 
504cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
505cdf0e10cSrcweir  */
506cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_HMAC_MD5 (
507cdf0e10cSrcweir 	const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen,
508cdf0e10cSrcweir 	const void      *pData,    sal_uInt32 nDatLen,
509cdf0e10cSrcweir 	sal_uInt8       *pBuffer,  sal_uInt32 nBufLen
510cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
511cdf0e10cSrcweir 
512cdf0e10cSrcweir /*========================================================================
513cdf0e10cSrcweir  *
514cdf0e10cSrcweir  * rtl_digest_HMAC_SHA1 interface.
515cdf0e10cSrcweir  *
516cdf0e10cSrcweir  *======================================================================*/
517cdf0e10cSrcweir #define RTL_DIGEST_LENGTH_HMAC_SHA1 RTL_DIGEST_LENGTH_SHA1
518cdf0e10cSrcweir 
519cdf0e10cSrcweir /** Create a HMAC_SHA1 digest handle.
520cdf0e10cSrcweir     @descr The HMAC_SHA1 digest algorithm is specified in
521cdf0e10cSrcweir 
522cdf0e10cSrcweir     RFC 2104 (Informational)
523cdf0e10cSrcweir       HMAC: Keyed-Hashing for Message Authentication
524cdf0e10cSrcweir     RFC 2898 (Informational)
525cdf0e10cSrcweir       PKCS #5: Password-Based Cryptography Specification Version 2.0
526cdf0e10cSrcweir 
527cdf0e10cSrcweir     @see rtl_digest_create()
528cdf0e10cSrcweir  */
529cdf0e10cSrcweir rtlDigest SAL_CALL rtl_digest_createHMAC_SHA1 (void) SAL_THROW_EXTERN_C();
530cdf0e10cSrcweir 
531cdf0e10cSrcweir 
532cdf0e10cSrcweir /** Destroy a HMAC_SHA1 digest handle.
533cdf0e10cSrcweir     @see rtl_digest_destroy()
534cdf0e10cSrcweir  */
535cdf0e10cSrcweir void SAL_CALL rtl_digest_destroyHMAC_SHA1 (
536cdf0e10cSrcweir 	rtlDigest Digest
537cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
538cdf0e10cSrcweir 
539cdf0e10cSrcweir 
540cdf0e10cSrcweir /** Initialize a HMAC_SHA1 digest.
541cdf0e10cSrcweir     @see rtl_digest_init()
542cdf0e10cSrcweir 
543cdf0e10cSrcweir     @param  Digest   [in] digest handle.
544cdf0e10cSrcweir 	@param  pKeyData [in] key material buffer.
545cdf0e10cSrcweir 	@param  nKeyLen  [in] key material length.
546cdf0e10cSrcweir 
547cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
548cdf0e10cSrcweir  */
549cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_initHMAC_SHA1 (
550cdf0e10cSrcweir 	rtlDigest Digest,
551cdf0e10cSrcweir 	const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen
552cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
553cdf0e10cSrcweir 
554cdf0e10cSrcweir 
555cdf0e10cSrcweir /** Update a HMAC_SHA1 digest with given data.
556cdf0e10cSrcweir     @see rtl_digest_update()
557cdf0e10cSrcweir  */
558cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_updateHMAC_SHA1 (
559cdf0e10cSrcweir 	rtlDigest Digest,
560cdf0e10cSrcweir 	const void *pData, sal_uInt32 nDatLen
561cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
562cdf0e10cSrcweir 
563cdf0e10cSrcweir 
564cdf0e10cSrcweir /** Finalize a HMAC_SHA1 digest and retrieve the digest value.
565cdf0e10cSrcweir     @see rtl_digest_get()
566cdf0e10cSrcweir  */
567cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_getHMAC_SHA1 (
568cdf0e10cSrcweir 	rtlDigest Digest,
569cdf0e10cSrcweir 	sal_uInt8 *pBuffer, sal_uInt32 nBufLen
570cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
571cdf0e10cSrcweir 
572cdf0e10cSrcweir 
573cdf0e10cSrcweir /** Evaluate a HMAC_SHA1 digest value from given data.
574cdf0e10cSrcweir     @descr This function performs an optimized call sequence on a
575cdf0e10cSrcweir 	single data buffer, avoiding digest creation and destruction.
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 	@see rtl_digest_initHMAC_SHA1()
578cdf0e10cSrcweir 	@see rtl_digest_updateHMAC_SHA1()
579cdf0e10cSrcweir 	@see rtl_digest_getHMAC_SHA1()
580cdf0e10cSrcweir 
581cdf0e10cSrcweir 	@param  pKeyData [in] key material buffer.
582cdf0e10cSrcweir 	@param  nKeyLen  [in] key material length.
583cdf0e10cSrcweir 	@param  pData    [in] data buffer.
584cdf0e10cSrcweir 	@param  nDatLen  [in] data length.
585cdf0e10cSrcweir 	@param  pBuffer  [in] digest value buffer.
586cdf0e10cSrcweir 	@param  nBufLen  [in] digest value length.
587cdf0e10cSrcweir 
588cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
589cdf0e10cSrcweir  */
590cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_HMAC_SHA1 (
591cdf0e10cSrcweir 	const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen,
592cdf0e10cSrcweir 	const void      *pData,    sal_uInt32 nDatLen,
593cdf0e10cSrcweir 	sal_uInt8       *pBuffer,  sal_uInt32 nBufLen
594cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
595cdf0e10cSrcweir 
596cdf0e10cSrcweir /*========================================================================
597cdf0e10cSrcweir  *
598cdf0e10cSrcweir  * rtl_digest_PBKDF2 interface.
599cdf0e10cSrcweir  *
600cdf0e10cSrcweir  *======================================================================*/
601cdf0e10cSrcweir /** Password-Based Key Derivation Function.
602cdf0e10cSrcweir     @descr The PBKDF2 key derivation function is specified in
603cdf0e10cSrcweir 
604cdf0e10cSrcweir     RFC 2898 (Informational)
605cdf0e10cSrcweir       PKCS #5: Password-Based Cryptography Specification Version 2.0
606cdf0e10cSrcweir 
607cdf0e10cSrcweir     @param  pKeyData  [out] derived key
608cdf0e10cSrcweir     @param  nKeyLen   [in]  derived key length
609cdf0e10cSrcweir 	@param  pPassData [in]  password
610cdf0e10cSrcweir 	@param  nPassLen  [in]  password length
611cdf0e10cSrcweir 	@param  pSaltData [in]  salt
612cdf0e10cSrcweir 	@param  nSaltLen  [in]  salt length
613cdf0e10cSrcweir 	@param  nCount    [in]  iteration count
614cdf0e10cSrcweir 
615cdf0e10cSrcweir 	@return rtl_Digest_E_None upon success.
616cdf0e10cSrcweir */
617cdf0e10cSrcweir rtlDigestError SAL_CALL rtl_digest_PBKDF2 (
618cdf0e10cSrcweir 	sal_uInt8       *pKeyData , sal_uInt32 nKeyLen,
619cdf0e10cSrcweir 	const sal_uInt8 *pPassData, sal_uInt32 nPassLen,
620cdf0e10cSrcweir 	const sal_uInt8 *pSaltData, sal_uInt32 nSaltLen,
621cdf0e10cSrcweir 	sal_uInt32       nCount
622cdf0e10cSrcweir ) SAL_THROW_EXTERN_C();
623cdf0e10cSrcweir 
624cdf0e10cSrcweir /*========================================================================
625cdf0e10cSrcweir  *
626cdf0e10cSrcweir  * The End.
627cdf0e10cSrcweir  *
628cdf0e10cSrcweir  *======================================================================*/
629cdf0e10cSrcweir 
630cdf0e10cSrcweir #ifdef __cplusplus
631cdf0e10cSrcweir }
632cdf0e10cSrcweir #endif
633cdf0e10cSrcweir 
634cdf0e10cSrcweir #endif /* _RTL_DIGEST_H_ */
635cdf0e10cSrcweir 
636