LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
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 /*
21  * This file is part of LibreOffice published API.
22  */
23 
24 #ifndef INCLUDED_RTL_DIGEST_H
25 #define INCLUDED_RTL_DIGEST_H
26 
27 #include "sal/config.h"
28 
29 #include "sal/saldllapi.h"
30 #include "sal/types.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
38 typedef void* rtlDigest;
39 
40 
45 {
50 
53 
56 };
57 
61 
62 
66 {
74 };
75 
79 
80 
88  rtlDigestAlgorithm Algorithm
90 
91 
96 SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroy (
97  rtlDigest Digest
99 
100 
106  rtlDigest Digest
108 
109 
114 SAL_DLLPUBLIC sal_uInt32 SAL_CALL rtl_digest_queryLength (
115  rtlDigest Digest
117 
118 
127  rtlDigest Digest,
128  const sal_uInt8 *pData, sal_uInt32 nDatLen
130 
131 
140  rtlDigest Digest,
141  const void *pData, sal_uInt32 nDatLen
143 
144 
158  rtlDigest Digest,
159  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
161 
162 #define RTL_DIGEST_LENGTH_MD2 16
163 
173 
174 
178 SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroyMD2 (
179  rtlDigest Digest
181 
186  rtlDigest Digest,
187  const void *pData, sal_uInt32 nDatLen
189 
194  rtlDigest Digest,
195  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
197 
214  const void *pData, sal_uInt32 nDatLen,
215  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
217 
218 #define RTL_DIGEST_LENGTH_MD5 16
219 
229 
233 SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroyMD5 (
234  rtlDigest Digest
236 
241  rtlDigest Digest,
242  const void *pData, sal_uInt32 nDatLen
244 
249  rtlDigest Digest,
250  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
252 
262  rtlDigest Digest,
263  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
265 
282  const void *pData, sal_uInt32 nDatLen,
283  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
285 
286 #define RTL_DIGEST_LENGTH_SHA 20
287 
300 
308 SAL_DLLPUBLIC void SAL_CALL rtl_digest_destroySHA (
309  rtlDigest Digest
311 
312 
321  rtlDigest Digest,
322  const void *pData, sal_uInt32 nDatLen
324 
333  rtlDigest Digest,
334  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
336 
356  const void *pData, sal_uInt32 nDatLen,
357  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
359 
360 /*========================================================================
361  *
362  * rtl_digest_SHA1 interface.
363  *
364  *======================================================================*/
365 #define RTL_DIGEST_LENGTH_SHA1 20
366 
379 
388  rtlDigest Digest
390 
399  rtlDigest Digest,
400  const void *pData, sal_uInt32 nDatLen
402 
411  rtlDigest Digest,
412  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
414 
434  const void *pData, sal_uInt32 nDatLen,
435  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
437 
438 #define RTL_DIGEST_LENGTH_HMAC_MD5 RTL_DIGEST_LENGTH_MD5
439 
450 
455  rtlDigest Digest
457 
468  rtlDigest Digest,
469  const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen
471 
476  rtlDigest Digest,
477  const void *pData, sal_uInt32 nDatLen
479 
484  rtlDigest Digest,
485  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
487 
507  const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen,
508  const void *pData, sal_uInt32 nDatLen,
509  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
511 
512 #define RTL_DIGEST_LENGTH_HMAC_SHA1 RTL_DIGEST_LENGTH_SHA1
513 
528 
537  rtlDigest Digest
539 
554  rtlDigest Digest,
555  const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen
557 
566  rtlDigest Digest,
567  const void *pData, sal_uInt32 nDatLen
569 
578  rtlDigest Digest,
579  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
581 
604  const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen,
605  const void *pData, sal_uInt32 nDatLen,
606  sal_uInt8 *pBuffer, sal_uInt32 nBufLen
608 
631  sal_uInt8 *pKeyData , sal_uInt32 nKeyLen,
632  const sal_uInt8 *pPassData, sal_uInt32 nPassLen,
633  const sal_uInt8 *pSaltData, sal_uInt32 nSaltLen,
634  sal_uInt32 nCount
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_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.
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:334
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.
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.
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.
enum __rtl_DigestAlgorithm rtlDigestAlgorithm
Digest Algorithm type.
Definition: digest.h:60
Definition: digest.h:54
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.
#define SAL_DLLPUBLIC
Definition: saldllapi.h:34
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_updateHMAC_SHA1(rtlDigest Digest, const void *pData, sal_uInt32 nDatLen) SAL_THROW_EXTERN_C()
Update a HMAC_SHA1 digest with given data.
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 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 sal_uInt32 rtl_digest_queryLength(rtlDigest Digest) SAL_THROW_EXTERN_C()
Query the length of a given digest.
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_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.
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 void rtl_digest_destroyMD2(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a MD2 digest handle.
SAL_DLLPUBLIC rtlDigest rtl_digest_createSHA1(void) SAL_THROW_EXTERN_C()
Create a SHA1 digest handle.
SAL_DLLPUBLIC rtlDigest rtl_digest_createMD2(void) SAL_THROW_EXTERN_C()
Create a MD2 digest handle.
Definition: digest.h:51
SAL_DLLPUBLIC rtlDigest rtl_digest_createMD5(void) SAL_THROW_EXTERN_C()
Create a MD5 digest handle.
Definition: digest.h:68
Definition: digest.h:52
Definition: digest.h:46
Definition: digest.h:69
SAL_DLLPUBLIC void rtl_digest_destroySHA(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a SHA digest handle.
SAL_DLLPUBLIC rtlDigest rtl_digest_createHMAC_MD5(void) SAL_THROW_EXTERN_C()
Create a HMAC_MD5 digest handle.
Definition: digest.h:72
Definition: digest.h:71
Definition: digest.h:73
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.
SAL_DLLPUBLIC rtlDigest rtl_digest_create(rtlDigestAlgorithm Algorithm) SAL_THROW_EXTERN_C()
Create a digest handle for the given algorithm.
Definition: digest.h:48
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_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.
SAL_DLLPUBLIC void rtl_digest_destroy(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a digest handle.
Definition: digest.h:67
Definition: digest.h:70
SAL_DLLPUBLIC void rtl_digest_destroyMD5(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a MD5 digest handle.
__rtl_DigestError
Error Code enumeration.
Definition: digest.h:65
enum __rtl_DigestError rtlDigestError
Error Code type.
Definition: digest.h:78
SAL_DLLPUBLIC void rtl_digest_destroySHA1(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a SHA1 digest handle.
SAL_DLLPUBLIC void rtl_digest_destroyHMAC_MD5(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a HMAC_MD5 digest handle.
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_getSHA(rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Finalize a SHA digest and retrieve the digest value.
Definition: digest.h:49
SAL_DLLPUBLIC void rtl_digest_destroyHMAC_SHA1(rtlDigest Digest) SAL_THROW_EXTERN_C()
Destroy a HMAC_SHA1 digest handle.
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.
__rtl_DigestAlgorithm
Digest Algorithm enumeration.
Definition: digest.h:44
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 rtlDigest rtl_digest_createSHA(void) SAL_THROW_EXTERN_C()
Create a SHA digest handle.
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_createHMAC_SHA1(void) SAL_THROW_EXTERN_C()
Create a HMAC_SHA1 digest handle.
#define SAL_MAX_ENUM
Definition: types.h:205
void * rtlDigest
Digest Handle opaque type.
Definition: digest.h:38
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 rtlDigestAlgorithm rtl_digest_queryAlgorithm(rtlDigest Digest) SAL_THROW_EXTERN_C()
Query the algorithm of a given digest.
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.
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_getMD5(rtlDigest Digest, sal_uInt8 *pBuffer, sal_uInt32 nBufLen) SAL_THROW_EXTERN_C()
Finalize a MD5 digest and retrieve the digest value.
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.
Definition: digest.h:47
unsigned char sal_uInt8
Definition: types.h:44