LibreOffice
LibreOffice 5.3 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
digest.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_RTL_DIGEST_H
21 #define INCLUDED_RTL_DIGEST_H
22 
23 #include <sal/config.h>
24 
25 #include <sal/saldllapi.h>
26 #include <sal/types.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*========================================================================
33  *
34  * rtlDigest.
35  *
36  *======================================================================*/
39 typedef void* rtlDigest;
40 
41 
46 {
51 
54 
57 };
58 
62 
63 
67 {
75 };
76 
80 
81 
88 SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_create (
89  rtlDigestAlgorithm Algorithm
91 
92 
98 SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroy (
99  rtlDigest Digest
101 
102 
107 SAL_DLLPUBLIC rtlDigestAlgorithm SAL_CALL rtl_digest_queryAlgorithm (
108  rtlDigest Digest
110 
111 
116 SAL_DLLPUBLIC sal_uInt32 SAL_CALL rtl_digest_queryLength (
117  rtlDigest Digest
119 
120 
128 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_init (
129  rtlDigest Digest,
130  const sal_uInt8 *pData, sal_uInt32 nDatLen
132 
133 
141 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_update (
142  rtlDigest Digest,
143  const void *pData, sal_uInt32 nDatLen
145 
146 
159 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_get (
160  rtlDigest Digest,
161  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
163 
164 /*========================================================================
165  *
166  * rtl_digest_MD2 interface.
167  *
168  *======================================================================*/
169 #define RTL_DIGEST_LENGTH_MD2 16
170 
179 SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createMD2 (void) SAL_THROW_EXTERN_C();
180 
181 
185 SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroyMD2 (
186  rtlDigest Digest
187 ) SAL_THROW_EXTERN_C();
188 
189 
193 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateMD2 (
194  rtlDigest Digest,
195  const void *pData, sal_uInt32 nDatLen
196 ) SAL_THROW_EXTERN_C();
197 
198 
202 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getMD2 (
203  rtlDigest Digest,
204  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
205 ) SAL_THROW_EXTERN_C();
206 
207 
223 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_MD2 (
224  const void *pData, sal_uInt32 nDatLen,
225  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
226 ) SAL_THROW_EXTERN_C();
227 
228 /*========================================================================
229  *
230  * rtl_digest_MD5 interface.
231  *
232  *======================================================================*/
233 #define RTL_DIGEST_LENGTH_MD5 16
234 
243 SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createMD5 (void) SAL_THROW_EXTERN_C();
244 
245 
249 SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroyMD5 (
250  rtlDigest Digest
251 ) SAL_THROW_EXTERN_C();
252 
253 
257 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateMD5 (
258  rtlDigest Digest,
259  const void *pData, sal_uInt32 nDatLen
260 ) SAL_THROW_EXTERN_C();
261 
262 
266 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getMD5 (
267  rtlDigest Digest,
268  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
269 ) SAL_THROW_EXTERN_C();
270 
271 
280 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_rawMD5 (
281  rtlDigest Digest,
282  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
283 ) SAL_THROW_EXTERN_C();
284 
285 
301 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_MD5 (
302  const void *pData, sal_uInt32 nDatLen,
303  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
304 ) SAL_THROW_EXTERN_C();
305 
306 /*========================================================================
307  *
308  * rtl_digest_SHA interface.
309  *
310  *======================================================================*/
311 #define RTL_DIGEST_LENGTH_SHA 20
312 
321 SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createSHA (void) SAL_THROW_EXTERN_C();
322 
323 
327 SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroySHA (
328  rtlDigest Digest
329 ) SAL_THROW_EXTERN_C();
330 
331 
335 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateSHA (
336  rtlDigest Digest,
337  const void *pData, sal_uInt32 nDatLen
338 ) SAL_THROW_EXTERN_C();
339 
340 
344 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getSHA (
345  rtlDigest Digest,
346  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
347 ) SAL_THROW_EXTERN_C();
348 
349 
365 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_SHA (
366  const void *pData, sal_uInt32 nDatLen,
367  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
368 ) SAL_THROW_EXTERN_C();
369 
370 /*========================================================================
371  *
372  * rtl_digest_SHA1 interface.
373  *
374  *======================================================================*/
375 #define RTL_DIGEST_LENGTH_SHA1 20
376 
385 SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createSHA1 (void) SAL_THROW_EXTERN_C();
386 
387 
392  rtlDigest Digest
393 ) SAL_THROW_EXTERN_C();
394 
395 
399 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateSHA1 (
400  rtlDigest Digest,
401  const void *pData, sal_uInt32 nDatLen
402 ) SAL_THROW_EXTERN_C();
403 
404 
408 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getSHA1 (
409  rtlDigest Digest,
410  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
411 ) SAL_THROW_EXTERN_C();
412 
413 
429 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_SHA1 (
430  const void *pData, sal_uInt32 nDatLen,
431  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
432 ) SAL_THROW_EXTERN_C();
433 
434 /*========================================================================
435  *
436  * rtl_digest_HMAC_MD5 interface.
437  *
438  *======================================================================*/
439 #define RTL_DIGEST_LENGTH_HMAC_MD5 RTL_DIGEST_LENGTH_MD5
440 
450 SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createHMAC_MD5 (void) SAL_THROW_EXTERN_C();
451 
452 
457  rtlDigest Digest
458 ) SAL_THROW_EXTERN_C();
459 
460 
470 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_initHMAC_MD5 (
471  rtlDigest Digest,
472  const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen
473 ) SAL_THROW_EXTERN_C();
474 
475 
479 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateHMAC_MD5 (
480  rtlDigest Digest,
481  const void *pData, sal_uInt32 nDatLen
482 ) SAL_THROW_EXTERN_C();
483 
484 
488 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getHMAC_MD5 (
489  rtlDigest Digest,
490  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
491 ) SAL_THROW_EXTERN_C();
492 
493 
512 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_HMAC_MD5 (
513  const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen,
514  const void *pData, sal_uInt32 nDatLen,
515  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
516 ) SAL_THROW_EXTERN_C();
517 
518 /*========================================================================
519  *
520  * rtl_digest_HMAC_SHA1 interface.
521  *
522  *======================================================================*/
523 #define RTL_DIGEST_LENGTH_HMAC_SHA1 RTL_DIGEST_LENGTH_SHA1
524 
535 SAL_DLLPUBLIC rtlDigest SAL_CALL rtl_digest_createHMAC_SHA1 (void) SAL_THROW_EXTERN_C();
536 
537 
542  rtlDigest Digest
543 ) SAL_THROW_EXTERN_C();
544 
545 
555 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_initHMAC_SHA1 (
556  rtlDigest Digest,
557  const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen
558 ) SAL_THROW_EXTERN_C();
559 
560 
564 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_updateHMAC_SHA1 (
565  rtlDigest Digest,
566  const void *pData, sal_uInt32 nDatLen
567 ) SAL_THROW_EXTERN_C();
568 
569 
573 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_getHMAC_SHA1 (
574  rtlDigest Digest,
575  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
576 ) SAL_THROW_EXTERN_C();
577 
578 
597 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_HMAC_SHA1 (
598  const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen,
599  const void *pData, sal_uInt32 nDatLen,
600  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
601 ) SAL_THROW_EXTERN_C();
602 
603 /*========================================================================
604  *
605  * rtl_digest_PBKDF2 interface.
606  *
607  *======================================================================*/
624 SAL_DLLPUBLIC rtlDigestError SAL_CALL rtl_digest_PBKDF2 (
625  sal_uInt8 *pKeyData , sal_uInt32 nKeyLen,
626  const sal_uInt8 *pPassData, sal_uInt32 nPassLen,
627  const sal_uInt8 *pSaltData, sal_uInt32 nSaltLen,
628  sal_uInt32 nCount
629 ) SAL_THROW_EXTERN_C();
630 
631 /*========================================================================
632  *
633  * The End.
634  *
635  *======================================================================*/
636 
637 #ifdef __cplusplus
638 }
639 #endif
640 
641 #endif // INCLUDED_RTL_DIGEST_H
642 
643 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC rtlDigestError rtl_digest_HMAC_SHA1(const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen, const void *pData, sal_uInt32 nDatLen, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Evaluate a HMAC_SHA1 digest value from given data.
SAL_DLLPUBLIC rtlDigest rtl_digest_create(rtlDigestAlgorithm Algorithm) SAL_THROW_EXTERN_C()
Create a digest handle for the given algorithm.
#define SAL_DLLPUBLIC
Definition: saldllapi.h:30
SAL_DLLPUBLIC rtlDigest rtl_digest_createMD5(void) SAL_THROW_EXTERN_C()
Create a MD5 digest handle.
SAL_DLLPUBLIC rtlDigestError rtl_digest_MD2(const void *pData, sal_uInt32 nDatLen, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Evaluate a MD2 digest value from given data.
SAL_DLLPUBLIC rtlDigestError rtl_digest_MD5(const void *pData, sal_uInt32 nDatLen, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Evaluate a MD5 digest value from given data.
SAL_DLLPUBLIC rtlDigestError rtl_digest_initHMAC_SHA1(rtlDigest Digest, const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen) SAL_THROW_EXTERN_C()
Initialize a HMAC_SHA1 digest.
SAL_DLLPUBLIC rtlDigestError rtl_digest_getHMAC_SHA1(rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Finalize a HMAC_SHA1 digest and retrieve the digest value.
__rtl_DigestAlgorithm
Digest Algorithm enumeration.
Definition: digest.h:45
SAL_DLLPUBLIC void rtl_digest_destroyMD5(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a MD5 digest handle.
SAL_DLLPUBLIC rtlDigest rtl_digest_createSHA(void) SAL_THROW_EXTERN_C()
Create a SHA digest handle.
Definition: digest.h:52
Definition: digest.h:47
Definition: digest.h:50
void * rtlDigest
Digest Handle opaque type.
Definition: digest.h:39
enum __rtl_DigestAlgorithm rtlDigestAlgorithm
Digest Algorithm type.
Definition: digest.h:61
SAL_DLLPUBLIC rtlDigestError rtl_digest_updateSHA1(rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C()
Update a SHA1 digest with given data.
#define SAL_MAX_ENUM
Definition: types.h:242
SAL_DLLPUBLIC rtlDigestError rtl_digest_getSHA1(rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Finalize a SHA1 digest and retrieve the digest value.
SAL_DLLPUBLIC rtlDigestError rtl_digest_update(rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C()
Update a digest with given data.
SAL_DLLPUBLIC rtlDigestError rtl_digest_HMAC_MD5(const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen, const void *pData, sal_uInt32 nDatLen, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Evaluate a HMAC_MD5 digest value from given data.
unsigned char sal_uInt8
Definition: types.h:54
Definition: digest.h:70
Definition: digest.h:72
SAL_DLLPUBLIC rtlDigestError rtl_digest_initHMAC_MD5(rtlDigest Digest, const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen) SAL_THROW_EXTERN_C()
Initialize a HMAC_MD5 digest.
SAL_DLLPUBLIC rtlDigestError rtl_digest_getSHA(rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Finalize a SHA digest and retrieve the digest value.
SAL_DLLPUBLIC rtlDigestError rtl_digest_get(rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Finalize a digest and retrieve the digest value.
SAL_DLLPUBLIC void rtl_digest_destroySHA1(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a SHA1 digest handle.
SAL_DLLPUBLIC void rtl_digest_destroySHA(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a SHA digest handle.
SAL_DLLPUBLIC rtlDigestError rtl_digest_SHA(const void *pData, sal_uInt32 nDatLen, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Evaluate a SHA digest value from given data.
SAL_DLLPUBLIC void rtl_digest_destroyMD2(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a MD2 digest handle.
__rtl_DigestError
Error Code enumeration.
Definition: digest.h:66
SAL_DLLPUBLIC rtlDigestError rtl_digest_updateMD2(rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C()
Update a MD2 digest with given data.
SAL_DLLPUBLIC rtlDigestError rtl_digest_updateHMAC_MD5(rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C()
Update a HMAC_MD5 digest with given data.
Definition: digest.h:55
SAL_DLLPUBLIC void rtl_digest_destroy(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a digest handle.
SAL_DLLPUBLIC rtlDigest rtl_digest_createSHA1(void) SAL_THROW_EXTERN_C()
Create a SHA1 digest handle.
SAL_DLLPUBLIC rtlDigestError rtl_digest_updateSHA(rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C()
Update a SHA digest with given data.
SAL_DLLPUBLIC rtlDigestError rtl_digest_init(rtlDigest Digest, const sal_uInt8 *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C()
Initialize a digest with given data.
SAL_DLLPUBLIC rtlDigest rtl_digest_createHMAC_SHA1(void) SAL_THROW_EXTERN_C()
Create a HMAC_SHA1 digest handle.
Definition: digest.h:53
SAL_DLLPUBLIC rtlDigest rtl_digest_createHMAC_MD5(void) SAL_THROW_EXTERN_C()
Create a HMAC_MD5 digest handle.
SAL_DLLPUBLIC rtlDigestError rtl_digest_getMD5(rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Finalize a MD5 digest and retrieve the digest value.
Definition: digest.h:73
SAL_DLLPUBLIC rtlDigestError rtl_digest_updateHMAC_SHA1(rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C()
Update a HMAC_SHA1 digest with given data.
Definition: digest.h:71
Definition: digest.h:69
SAL_DLLPUBLIC sal_uInt32 rtl_digest_queryLength(rtlDigest Digest) SAL_THROW_EXTERN_C()
Query the length of a given digest.
SAL_DLLPUBLIC rtlDigestError rtl_digest_getHMAC_MD5(rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Finalize a HMAC_MD5 digest and retrieve the digest value.
Definition: digest.h:74
Definition: digest.h:68
SAL_DLLPUBLIC void rtl_digest_destroyHMAC_SHA1(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a HMAC_SHA1 digest handle.
SAL_DLLPUBLIC rtlDigest rtl_digest_createMD2(void) SAL_THROW_EXTERN_C()
Create a MD2 digest handle.
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:370
Definition: digest.h:48
SAL_DLLPUBLIC rtlDigestAlgorithm rtl_digest_queryAlgorithm(rtlDigest Digest) SAL_THROW_EXTERN_C()
Query the algorithm of a given digest.
SAL_DLLPUBLIC rtlDigestError rtl_digest_updateMD5(rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C()
Update a MD5 digest with given data.
SAL_DLLPUBLIC rtlDigestError rtl_digest_getMD2(rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Finalize a MD2 digest and retrieve the digest value.
SAL_DLLPUBLIC void rtl_digest_destroyHMAC_MD5(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a HMAC_MD5 digest handle.
Definition: digest.h:49
enum __rtl_DigestError rtlDigestError
Error Code type.
Definition: digest.h:79
SAL_DLLPUBLIC rtlDigestError rtl_digest_rawMD5(rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Retrieve the raw (not finalized) MD5 digest value.
SAL_DLLPUBLIC rtlDigestError rtl_digest_PBKDF2(sal_uInt8 *pKeyData, sal_uInt32 nKeyLen, const sal_uInt8 *pPassData, sal_uInt32 nPassLen, const sal_uInt8 *pSaltData, sal_uInt32 nSaltLen, sal_uInt32 nCount) SAL_THROW_EXTERN_C()
Password-Based Key Derivation Function.
SAL_DLLPUBLIC rtlDigestError rtl_digest_SHA1(const void *pData, sal_uInt32 nDatLen, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Evaluate a SHA1 digest value from given data.