LibreOffice: rtl/cipher.h Source File

LibreOffice LibreOffice 25.8 SDK C/C++ API Reference

Loading...
Searching...
No Matches
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/*
21 * This file is part of LibreOffice published API.
22 */
23
24#ifndef INCLUDED_RTL_CIPHER_H
25#define INCLUDED_RTL_CIPHER_H
26
27#include "sal/config.h"
28
29#include "sal/saldllapi.h"
30#include "sal/types.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
38 typedef void* rtlCipher;
39
43 enum __rtl_CipherAlgorithm
44{
45 rtl_Cipher_AlgorithmBF,
46 rtl_Cipher_AlgorithmARCFOUR,
47 rtl_Cipher_AlgorithmInvalid,
48 rtl_Cipher_Algorithm_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
49};
50
53 typedef enum __rtl_CipherAlgorithm rtlCipherAlgorithm;
54
58 enum __rtl_CipherMode
59{
60 rtl_Cipher_ModeECB,
61 rtl_Cipher_ModeCBC,
62 rtl_Cipher_ModeStream,
63 rtl_Cipher_ModeInvalid,
64 rtl_Cipher_Mode_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
65};
66
69 typedef enum __rtl_CipherMode rtlCipherMode;
70
74 enum __rtl_CipherDirection
75{
76 rtl_Cipher_DirectionBoth,
77 rtl_Cipher_DirectionDecode,
78 rtl_Cipher_DirectionEncode,
79 rtl_Cipher_DirectionInvalid,
80 rtl_Cipher_Direction_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
81};
82
85 typedef enum __rtl_CipherDirection rtlCipherDirection;
86
87
90 enum __rtl_CipherError
91{
92 rtl_Cipher_E_None,
93 rtl_Cipher_E_Argument,
94 rtl_Cipher_E_Algorithm,
95 rtl_Cipher_E_Direction,
96 rtl_Cipher_E_Mode,
97 rtl_Cipher_E_BufferSize,
98 rtl_Cipher_E_Memory,
99 rtl_Cipher_E_Unknown,
100 rtl_Cipher_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
101};
102
105 typedef enum __rtl_CipherError rtlCipherError;
106
107
116 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_create (
117 rtlCipherAlgorithm Algorithm,
118 rtlCipherMode Mode
119) SAL_THROW_EXTERN_C();
120
132 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_init (
133 rtlCipher Cipher,
134 rtlCipherDirection Direction,
135 const sal_uInt8 *pKeyData, sal_Size nKeyLen,
136 const sal_uInt8 *pArgData, sal_Size nArgLen
137) SAL_THROW_EXTERN_C();
138
150 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encode (
151 rtlCipher Cipher,
152 const void *pData, sal_Size nDatLen,
153 sal_uInt8 *pBuffer, sal_Size nBufLen
154) SAL_THROW_EXTERN_C();
155
167 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decode (
168 rtlCipher Cipher,
169 const void *pData, sal_Size nDatLen,
170 sal_uInt8 *pBuffer, sal_Size nBufLen
171) SAL_THROW_EXTERN_C();
172
179 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroy (
180 rtlCipher Cipher
181) SAL_THROW_EXTERN_C();
182
190 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_createBF (
191 rtlCipherMode Mode
192) SAL_THROW_EXTERN_C();
193
197 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_initBF (
198 rtlCipher Cipher,
199 rtlCipherDirection Direction,
200 const sal_uInt8 *pKeyData, sal_Size nKeyLen,
201 const sal_uInt8 *pArgData, sal_Size nArgLen
202) SAL_THROW_EXTERN_C();
203
207 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encodeBF (
208 rtlCipher Cipher,
209 const void *pData, sal_Size nDatLen,
210 sal_uInt8 *pBuffer, sal_Size nBufLen
211) SAL_THROW_EXTERN_C();
212
216 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decodeBF (
217 rtlCipher Cipher,
218 const void *pData, sal_Size nDatLen,
219 sal_uInt8 *pBuffer, sal_Size nBufLen
220) SAL_THROW_EXTERN_C();
221
225 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroyBF (
226 rtlCipher Cipher
227) SAL_THROW_EXTERN_C();
228
239 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_createARCFOUR (
240 rtlCipherMode Mode
241) SAL_THROW_EXTERN_C();
242
246 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_initARCFOUR (
247 rtlCipher Cipher,
248 rtlCipherDirection Direction,
249 const sal_uInt8 *pKeyData, sal_Size nKeyLen,
250 const sal_uInt8 *pArgData, sal_Size nArgLen
251) SAL_THROW_EXTERN_C();
252
256 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encodeARCFOUR (
257 rtlCipher Cipher,
258 const void *pData, sal_Size nDatLen,
259 sal_uInt8 *pBuffer, sal_Size nBufLen
260) SAL_THROW_EXTERN_C();
261
265 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR (
266 rtlCipher Cipher,
267 const void *pData, sal_Size nDatLen,
268 sal_uInt8 *pBuffer, sal_Size nBufLen
269) SAL_THROW_EXTERN_C();
270
274 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroyARCFOUR (
275 rtlCipher Cipher
276) SAL_THROW_EXTERN_C();
277
278#ifdef __cplusplus
279}
280#endif
281
282#endif /* ! INCLUDED_RTL_CIPHER_H */
283
284/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
saldllapi.h
SAL_DLLPUBLIC
#define SAL_DLLPUBLIC
Definition saldllapi.h:34
config.h
types.h
SAL_MAX_ENUM
#define SAL_MAX_ENUM
Definition types.h:205
sal_uInt8
unsigned char sal_uInt8
Definition types.h:44
SAL_THROW_EXTERN_C
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition types.h:352
__rtl_CipherMode
__rtl_CipherMode
Cipher Mode enumeration.
Definition cipher.h:59
rtl_Cipher_ModeStream
@ rtl_Cipher_ModeStream
Definition cipher.h:62
rtl_Cipher_ModeCBC
@ rtl_Cipher_ModeCBC
Definition cipher.h:61
rtl_Cipher_ModeInvalid
@ rtl_Cipher_ModeInvalid
Definition cipher.h:63
rtl_Cipher_ModeECB
@ rtl_Cipher_ModeECB
Definition cipher.h:60
rtl_Cipher_Mode_FORCE_EQUAL_SIZE
@ rtl_Cipher_Mode_FORCE_EQUAL_SIZE
Definition cipher.h:64
rtl_cipher_createARCFOUR
SAL_DLLPUBLIC rtlCipher rtl_cipher_createARCFOUR(rtlCipherMode Mode) SAL_THROW_EXTERN_C()
Create a RC4 cipher handle for the given mode.
rtlCipherAlgorithm
enum __rtl_CipherAlgorithm rtlCipherAlgorithm
Cipher Algorithm type.
Definition cipher.h:53
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.
rtlCipherDirection
enum __rtl_CipherDirection rtlCipherDirection
Cipher Direction type.
Definition cipher.h:85
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_destroyBF
SAL_DLLPUBLIC void rtl_cipher_destroyBF(rtlCipher Cipher) SAL_THROW_EXTERN_C()
Destroy a Blowfish cipher handle.
__rtl_CipherDirection
__rtl_CipherDirection
Cipher Direction enumeration.
Definition cipher.h:75
rtl_Cipher_DirectionEncode
@ rtl_Cipher_DirectionEncode
Definition cipher.h:78
rtl_Cipher_DirectionBoth
@ rtl_Cipher_DirectionBoth
Definition cipher.h:76
rtl_Cipher_DirectionDecode
@ rtl_Cipher_DirectionDecode
Definition cipher.h:77
rtl_Cipher_Direction_FORCE_EQUAL_SIZE
@ rtl_Cipher_Direction_FORCE_EQUAL_SIZE
Definition cipher.h:80
rtl_Cipher_DirectionInvalid
@ rtl_Cipher_DirectionInvalid
Definition cipher.h:79
rtl_cipher_destroy
SAL_DLLPUBLIC void rtl_cipher_destroy(rtlCipher Cipher) SAL_THROW_EXTERN_C()
Destroy a cipher handle.
rtlCipher
void * rtlCipher
Cipher Handle opaque type.
Definition cipher.h:38
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()
Initialize a Blowfish cipher for the given direction.
rtlCipherError
enum __rtl_CipherError rtlCipherError
Error Code type.
Definition cipher.h:105
rtl_cipher_destroyARCFOUR
SAL_DLLPUBLIC void rtl_cipher_destroyARCFOUR(rtlCipher Cipher) SAL_THROW_EXTERN_C()
Destroy a RC4 cipher handle.
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.
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()
Initialize a RC4 cipher for the given direction.
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_CipherError
__rtl_CipherError
Error Code enumeration.
Definition cipher.h:91
rtl_Cipher_E_Unknown
@ rtl_Cipher_E_Unknown
Definition cipher.h:99
rtl_Cipher_E_Algorithm
@ rtl_Cipher_E_Algorithm
Definition cipher.h:94
rtl_Cipher_E_Direction
@ rtl_Cipher_E_Direction
Definition cipher.h:95
rtl_Cipher_E_None
@ rtl_Cipher_E_None
Definition cipher.h:92
rtl_Cipher_E_Mode
@ rtl_Cipher_E_Mode
Definition cipher.h:96
rtl_Cipher_E_BufferSize
@ rtl_Cipher_E_BufferSize
Definition cipher.h:97
rtl_Cipher_E_Argument
@ rtl_Cipher_E_Argument
Definition cipher.h:93
rtl_Cipher_E_Memory
@ rtl_Cipher_E_Memory
Definition cipher.h:98
rtl_Cipher_E_FORCE_EQUAL_SIZE
@ rtl_Cipher_E_FORCE_EQUAL_SIZE
Definition cipher.h:100
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_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_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_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_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()
Initialize a cipher for the given direction.
__rtl_CipherAlgorithm
__rtl_CipherAlgorithm
Cipher Algorithm enumeration.
Definition cipher.h:44
rtl_Cipher_AlgorithmInvalid
@ rtl_Cipher_AlgorithmInvalid
Definition cipher.h:47
rtl_Cipher_AlgorithmARCFOUR
@ rtl_Cipher_AlgorithmARCFOUR
Definition cipher.h:46
rtl_Cipher_Algorithm_FORCE_EQUAL_SIZE
@ rtl_Cipher_Algorithm_FORCE_EQUAL_SIZE
Definition cipher.h:48
rtl_Cipher_AlgorithmBF
@ rtl_Cipher_AlgorithmBF
Definition cipher.h:45
rtlCipherMode
enum __rtl_CipherMode rtlCipherMode
Cipher Mode type.
Definition cipher.h:69