|
UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /* 00003 * This file is part of the LibreOffice project. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 * 00009 * This file incorporates work covered by the following license notice: 00010 * 00011 * Licensed to the Apache Software Foundation (ASF) under one or more 00012 * contributor license agreements. See the NOTICE file distributed 00013 * with this work for additional information regarding copyright 00014 * ownership. The ASF licenses this file to you under the Apache 00015 * License, Version 2.0 (the "License"); you may not use this file 00016 * except in compliance with the License. You may obtain a copy of 00017 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 00018 */ 00019 00020 #ifndef _RTL_CIPHER_H_ 00021 #define _RTL_CIPHER_H_ 00022 00023 #include "sal/config.h" 00024 00025 #include "sal/saldllapi.h" 00026 #include "sal/types.h" 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 /*======================================================================== 00033 * 00034 * rtlCipher interface. 00035 * 00036 *======================================================================*/ 00039 typedef void* rtlCipher; 00040 00041 00045 enum __rtl_CipherAlgorithm 00046 { 00047 rtl_Cipher_AlgorithmBF, 00048 rtl_Cipher_AlgorithmARCFOUR, 00049 rtl_Cipher_AlgorithmInvalid, 00050 rtl_Cipher_Algorithm_FORCE_EQUAL_SIZE = SAL_MAX_ENUM 00051 }; 00052 00055 typedef enum __rtl_CipherAlgorithm rtlCipherAlgorithm; 00056 00057 00061 enum __rtl_CipherMode 00062 { 00063 rtl_Cipher_ModeECB, 00064 rtl_Cipher_ModeCBC, 00065 rtl_Cipher_ModeStream, 00066 rtl_Cipher_ModeInvalid, 00067 rtl_Cipher_Mode_FORCE_EQUAL_SIZE = SAL_MAX_ENUM 00068 }; 00069 00072 typedef enum __rtl_CipherMode rtlCipherMode; 00073 00074 00078 enum __rtl_CipherDirection 00079 { 00080 rtl_Cipher_DirectionBoth, 00081 rtl_Cipher_DirectionDecode, 00082 rtl_Cipher_DirectionEncode, 00083 rtl_Cipher_DirectionInvalid, 00084 rtl_Cipher_Direction_FORCE_EQUAL_SIZE = SAL_MAX_ENUM 00085 }; 00086 00089 typedef enum __rtl_CipherDirection rtlCipherDirection; 00090 00091 00094 enum __rtl_CipherError 00095 { 00096 rtl_Cipher_E_None, 00097 rtl_Cipher_E_Argument, 00098 rtl_Cipher_E_Algorithm, 00099 rtl_Cipher_E_Direction, 00100 rtl_Cipher_E_Mode, 00101 rtl_Cipher_E_BufferSize, 00102 rtl_Cipher_E_Memory, 00103 rtl_Cipher_E_Unknown, 00104 rtl_Cipher_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM 00105 }; 00106 00109 typedef enum __rtl_CipherError rtlCipherError; 00110 00111 00120 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_create ( 00121 rtlCipherAlgorithm Algorithm, 00122 rtlCipherMode Mode 00123 ) SAL_THROW_EXTERN_C(); 00124 00125 00137 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_init ( 00138 rtlCipher Cipher, 00139 rtlCipherDirection Direction, 00140 const sal_uInt8 *pKeyData, sal_Size nKeyLen, 00141 const sal_uInt8 *pArgData, sal_Size nArgLen 00142 ) SAL_THROW_EXTERN_C(); 00143 00144 00156 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encode ( 00157 rtlCipher Cipher, 00158 const void *pData, sal_Size nDatLen, 00159 sal_uInt8 *pBuffer, sal_Size nBufLen 00160 ) SAL_THROW_EXTERN_C(); 00161 00162 00174 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decode ( 00175 rtlCipher Cipher, 00176 const void *pData, sal_Size nDatLen, 00177 sal_uInt8 *pBuffer, sal_Size nBufLen 00178 ) SAL_THROW_EXTERN_C(); 00179 00180 00185 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroy ( 00186 rtlCipher Cipher 00187 ) SAL_THROW_EXTERN_C(); 00188 00189 00190 /*======================================================================== 00191 * 00192 * rtl_cipherBF (Blowfish) interface. 00193 * 00194 *======================================================================*/ 00201 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_createBF ( 00202 rtlCipherMode Mode 00203 ) SAL_THROW_EXTERN_C(); 00204 00205 00209 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_initBF ( 00210 rtlCipher Cipher, 00211 rtlCipherDirection Direction, 00212 const sal_uInt8 *pKeyData, sal_Size nKeyLen, 00213 const sal_uInt8 *pArgData, sal_Size nArgLen 00214 ) SAL_THROW_EXTERN_C(); 00215 00216 00220 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encodeBF ( 00221 rtlCipher Cipher, 00222 const void *pData, sal_Size nDatLen, 00223 sal_uInt8 *pBuffer, sal_Size nBufLen 00224 ) SAL_THROW_EXTERN_C(); 00225 00226 00230 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decodeBF ( 00231 rtlCipher Cipher, 00232 const void *pData, sal_Size nDatLen, 00233 sal_uInt8 *pBuffer, sal_Size nBufLen 00234 ) SAL_THROW_EXTERN_C(); 00235 00236 00240 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroyBF ( 00241 rtlCipher Cipher 00242 ) SAL_THROW_EXTERN_C(); 00243 00244 00245 /*======================================================================== 00246 * 00247 * rtl_cipherARCFOUR (RC4) interface. 00248 * 00249 *======================================================================*/ 00259 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_createARCFOUR ( 00260 rtlCipherMode Mode 00261 ) SAL_THROW_EXTERN_C(); 00262 00263 00267 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_initARCFOUR ( 00268 rtlCipher Cipher, 00269 rtlCipherDirection Direction, 00270 const sal_uInt8 *pKeyData, sal_Size nKeyLen, 00271 const sal_uInt8 *pArgData, sal_Size nArgLen 00272 ) SAL_THROW_EXTERN_C(); 00273 00274 00278 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encodeARCFOUR ( 00279 rtlCipher Cipher, 00280 const void *pData, sal_Size nDatLen, 00281 sal_uInt8 *pBuffer, sal_Size nBufLen 00282 ) SAL_THROW_EXTERN_C(); 00283 00284 00288 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR ( 00289 rtlCipher Cipher, 00290 const void *pData, sal_Size nDatLen, 00291 sal_uInt8 *pBuffer, sal_Size nBufLen 00292 ) SAL_THROW_EXTERN_C(); 00293 00294 00298 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroyARCFOUR ( 00299 rtlCipher Cipher 00300 ) SAL_THROW_EXTERN_C(); 00301 00302 00303 /*======================================================================== 00304 * 00305 * The End. 00306 * 00307 *======================================================================*/ 00308 00309 #ifdef __cplusplus 00310 } 00311 #endif 00312 00313 #endif /* !_RTL_CIPHER_H_ */ 00314 00315 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1.7.3