LibreOffice: rtl/cipher.h Source File

LibreOffice LibreOffice 5.1 SDK C/C++ API Reference

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

cipher.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_CIPHER_H
21 #define INCLUDED_RTL_CIPHER_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 * rtlCipher interface.
35 *
36 *======================================================================*/
39 typedef void* rtlCipher;
40
41
45 enum __rtl_CipherAlgorithm
46 {
47 rtl_Cipher_AlgorithmBF,
48 rtl_Cipher_AlgorithmARCFOUR,
49 rtl_Cipher_AlgorithmInvalid,
50 rtl_Cipher_Algorithm_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
51 };
52
55 typedef enum __rtl_CipherAlgorithm rtlCipherAlgorithm;
56
57
61 enum __rtl_CipherMode
62 {
63 rtl_Cipher_ModeECB,
64 rtl_Cipher_ModeCBC,
65 rtl_Cipher_ModeStream,
66 rtl_Cipher_ModeInvalid,
67 rtl_Cipher_Mode_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
68 };
69
72 typedef enum __rtl_CipherMode rtlCipherMode;
73
74
78 enum __rtl_CipherDirection
79 {
80 rtl_Cipher_DirectionBoth,
81 rtl_Cipher_DirectionDecode,
82 rtl_Cipher_DirectionEncode,
83 rtl_Cipher_DirectionInvalid,
84 rtl_Cipher_Direction_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
85 };
86
89 typedef enum __rtl_CipherDirection rtlCipherDirection;
90
91
94 enum __rtl_CipherError
95 {
96 rtl_Cipher_E_None,
97 rtl_Cipher_E_Argument,
98 rtl_Cipher_E_Algorithm,
99 rtl_Cipher_E_Direction,
100 rtl_Cipher_E_Mode,
101 rtl_Cipher_E_BufferSize,
102 rtl_Cipher_E_Memory,
103 rtl_Cipher_E_Unknown,
104 rtl_Cipher_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
105 };
106
109 typedef enum __rtl_CipherError rtlCipherError;
110
111
120 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_create (
121 rtlCipherAlgorithm Algorithm,
122 rtlCipherMode Mode
123 ) SAL_THROW_EXTERN_C();
124
125
137 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_init (
138 rtlCipher Cipher,
139 rtlCipherDirection Direction,
140 const sal_uInt8 *pKeyData, sal_Size nKeyLen,
141 const sal_uInt8 *pArgData, sal_Size nArgLen
142 ) SAL_THROW_EXTERN_C();
143
144
156 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encode (
157 rtlCipher Cipher,
158 const void *pData, sal_Size nDatLen,
159 sal_uInt8 *pBuffer, sal_Size nBufLen
160 ) SAL_THROW_EXTERN_C();
161
162
174 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decode (
175 rtlCipher Cipher,
176 const void *pData, sal_Size nDatLen,
177 sal_uInt8 *pBuffer, sal_Size nBufLen
178 ) SAL_THROW_EXTERN_C();
179
180
185 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroy (
186 rtlCipher Cipher
187 ) SAL_THROW_EXTERN_C();
188
189
190 /*========================================================================
191 *
192 * rtl_cipherBF (Blowfish) interface.
193 *
194 *======================================================================*/
202 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_createBF (
203 rtlCipherMode Mode
204 ) SAL_THROW_EXTERN_C();
205
206
210 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_initBF (
211 rtlCipher Cipher,
212 rtlCipherDirection Direction,
213 const sal_uInt8 *pKeyData, sal_Size nKeyLen,
214 const sal_uInt8 *pArgData, sal_Size nArgLen
215 ) SAL_THROW_EXTERN_C();
216
217
221 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encodeBF (
222 rtlCipher Cipher,
223 const void *pData, sal_Size nDatLen,
224 sal_uInt8 *pBuffer, sal_Size nBufLen
225 ) SAL_THROW_EXTERN_C();
226
227
231 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decodeBF (
232 rtlCipher Cipher,
233 const void *pData, sal_Size nDatLen,
234 sal_uInt8 *pBuffer, sal_Size nBufLen
235 ) SAL_THROW_EXTERN_C();
236
237
241 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroyBF (
242 rtlCipher Cipher
243 ) SAL_THROW_EXTERN_C();
244
245
246 /*========================================================================
247 *
248 * rtl_cipherARCFOUR (RC4) interface.
249 *
250 *======================================================================*/
261 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_createARCFOUR (
262 rtlCipherMode Mode
263 ) SAL_THROW_EXTERN_C();
264
265
269 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_initARCFOUR (
270 rtlCipher Cipher,
271 rtlCipherDirection Direction,
272 const sal_uInt8 *pKeyData, sal_Size nKeyLen,
273 const sal_uInt8 *pArgData, sal_Size nArgLen
274 ) SAL_THROW_EXTERN_C();
275
276
280 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encodeARCFOUR (
281 rtlCipher Cipher,
282 const void *pData, sal_Size nDatLen,
283 sal_uInt8 *pBuffer, sal_Size nBufLen
284 ) SAL_THROW_EXTERN_C();
285
286
290 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR (
291 rtlCipher Cipher,
292 const void *pData, sal_Size nDatLen,
293 sal_uInt8 *pBuffer, sal_Size nBufLen
294 ) SAL_THROW_EXTERN_C();
295
296
300 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroyARCFOUR (
301 rtlCipher Cipher
302 ) SAL_THROW_EXTERN_C();
303
304
305 /*========================================================================
306 *
307 * The End.
308 *
309 *======================================================================*/
310
311 #ifdef __cplusplus
312 }
313 #endif
314
315 #endif /* ! INCLUDED_RTL_CIPHER_H */
316
317 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl_cipher_encodeBF
SAL_DLLPUBLIC rtlCipherError rtl_cipher_encodeBF(rtlCipher Cipher, const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C()
Encode a buffer under the Blowfish cipher algorithm.
rtl_Cipher_E_Memory
Definition: cipher.h:102
SAL_DLLPUBLIC
#define SAL_DLLPUBLIC
Definition: saldllapi.h:30
rtl_cipher_destroy
SAL_DLLPUBLIC void rtl_cipher_destroy(rtlCipher Cipher) SAL_THROW_EXTERN_C()
Destroy a cipher handle.
config.h
rtl_Cipher_E_Unknown
Definition: cipher.h:103
__rtl_CipherDirection
__rtl_CipherDirection
Cipher Direction enumeration.
Definition: cipher.h:78
rtl_cipher_destroyARCFOUR
SAL_DLLPUBLIC void rtl_cipher_destroyARCFOUR(rtlCipher Cipher) SAL_THROW_EXTERN_C()
Destroy a RC4 cipher handle.
rtl_Cipher_AlgorithmARCFOUR
Definition: cipher.h:48
rtl_cipher_encode
SAL_DLLPUBLIC rtlCipherError rtl_cipher_encode(rtlCipher Cipher, const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C()
Encode a buffer under a given cipher algorithm.
rtl_cipher_initBF
SAL_DLLPUBLIC rtlCipherError rtl_cipher_initBF(rtlCipher Cipher, rtlCipherDirection Direction, const sal_uInt8 *pKeyData, sal_Size nKeyLen, const sal_uInt8 *pArgData, sal_Size nArgLen) SAL_THROW_EXTERN_C()
Inititialize a Blowfish cipher for the given direction.
rtl_cipher_destroyBF
SAL_DLLPUBLIC void rtl_cipher_destroyBF(rtlCipher Cipher) SAL_THROW_EXTERN_C()
Destroy a Blowfish cipher handle.
rtl_Cipher_Direction_FORCE_EQUAL_SIZE
Definition: cipher.h:84
SAL_MAX_ENUM
#define SAL_MAX_ENUM
Definition: types.h:242
rtl_Cipher_ModeCBC
Definition: cipher.h:64
rtlCipherAlgorithm
enum __rtl_CipherAlgorithm rtlCipherAlgorithm
Cipher Algorithm type.
Definition: cipher.h:55
rtl_cipher_createBF
SAL_DLLPUBLIC rtlCipher rtl_cipher_createBF(rtlCipherMode Mode) SAL_THROW_EXTERN_C()
Create a Blowfish cipher handle for the given mode.
rtl_Cipher_ModeECB
Definition: cipher.h:63
rtlCipher
void * rtlCipher
Cipher Handle opaque type.
Definition: cipher.h:39
rtl_Cipher_Mode_FORCE_EQUAL_SIZE
Definition: cipher.h:67
rtl_cipher_createARCFOUR
SAL_DLLPUBLIC rtlCipher rtl_cipher_createARCFOUR(rtlCipherMode Mode) SAL_THROW_EXTERN_C()
Create a RC4 cipher handle for the given mode.
sal_uInt8
unsigned char sal_uInt8
Definition: types.h:54
rtlCipherDirection
enum __rtl_CipherDirection rtlCipherDirection
Cipher Direction type.
Definition: cipher.h:89
rtl_Cipher_E_Mode
Definition: cipher.h:100
rtl_Cipher_AlgorithmInvalid
Definition: cipher.h:49
rtl_Cipher_DirectionDecode
Definition: cipher.h:81
rtl_Cipher_ModeStream
Definition: cipher.h:65
__rtl_CipherAlgorithm
__rtl_CipherAlgorithm
Cipher Algorithm enumeration.
Definition: cipher.h:45
rtl_Cipher_E_BufferSize
Definition: cipher.h:101
rtl_cipher_decode
SAL_DLLPUBLIC rtlCipherError rtl_cipher_decode(rtlCipher Cipher, const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C()
Decode a buffer under a given cipher algorithm.
rtl_cipher_init
SAL_DLLPUBLIC rtlCipherError rtl_cipher_init(rtlCipher Cipher, rtlCipherDirection Direction, const sal_uInt8 *pKeyData, sal_Size nKeyLen, const sal_uInt8 *pArgData, sal_Size nArgLen) SAL_THROW_EXTERN_C()
Inititialize a cipher for the given direction.
rtl_Cipher_ModeInvalid
Definition: cipher.h:66
rtl_Cipher_DirectionBoth
Definition: cipher.h:80
rtl_cipher_decodeBF
SAL_DLLPUBLIC rtlCipherError rtl_cipher_decodeBF(rtlCipher Cipher, const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C()
Decode a buffer under the Blowfish cipher algorithm.
rtl_Cipher_Algorithm_FORCE_EQUAL_SIZE
Definition: cipher.h:50
rtl_cipher_encodeARCFOUR
SAL_DLLPUBLIC rtlCipherError rtl_cipher_encodeARCFOUR(rtlCipher Cipher, const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C()
Encode a buffer under the RC4 cipher algorithm.
rtl_Cipher_E_FORCE_EQUAL_SIZE
Definition: cipher.h:104
rtlCipherError
enum __rtl_CipherError rtlCipherError
Error Code type.
Definition: cipher.h:109
rtl_Cipher_E_Argument
Definition: cipher.h:97
rtl_Cipher_AlgorithmBF
Definition: cipher.h:47
rtl_cipher_initARCFOUR
SAL_DLLPUBLIC rtlCipherError rtl_cipher_initARCFOUR(rtlCipher Cipher, rtlCipherDirection Direction, const sal_uInt8 *pKeyData, sal_Size nKeyLen, const sal_uInt8 *pArgData, sal_Size nArgLen) SAL_THROW_EXTERN_C()
Inititialize a RC4 cipher for the given direction.
rtl_Cipher_DirectionInvalid
Definition: cipher.h:83
types.h
rtl_Cipher_E_Direction
Definition: cipher.h:99
rtl_cipher_decodeARCFOUR
SAL_DLLPUBLIC rtlCipherError rtl_cipher_decodeARCFOUR(rtlCipher Cipher, const void *pData, sal_Size nDatLen, sal_uInt8 *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C()
Decode a buffer under the RC4 cipher algorithm.
rtl_Cipher_E_Algorithm
Definition: cipher.h:98
rtl_cipher_create
SAL_DLLPUBLIC rtlCipher rtl_cipher_create(rtlCipherAlgorithm Algorithm, rtlCipherMode Mode) SAL_THROW_EXTERN_C()
Create a cipher handle for the given algorithm and mode.
rtlCipherMode
enum __rtl_CipherMode rtlCipherMode
Cipher Mode type.
Definition: cipher.h:72
__rtl_CipherMode
__rtl_CipherMode
Cipher Mode enumeration.
Definition: cipher.h:61
SAL_THROW_EXTERN_C
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:368
__rtl_CipherError
__rtl_CipherError
Error Code enumeration.
Definition: cipher.h:94
rtl_Cipher_DirectionEncode
Definition: cipher.h:82
rtl_Cipher_E_None
Definition: cipher.h:96
saldllapi.h