00001 00009 /* 00010 * Copyright The Mbed TLS Contributors 00011 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 00012 * 00013 * This file is provided under the Apache License 2.0, or the 00014 * GNU General Public License v2.0 or later. 00015 * 00016 * ********** 00017 * Apache License 2.0: 00018 * 00019 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00020 * not use this file except in compliance with the License. 00021 * You may obtain a copy of the License at 00022 * 00023 * http://www.apache.org/licenses/LICENSE-2.0 00024 * 00025 * Unless required by applicable law or agreed to in writing, software 00026 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00027 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00028 * See the License for the specific language governing permissions and 00029 * limitations under the License. 00030 * 00031 * ********** 00032 * 00033 * ********** 00034 * GNU General Public License v2.0 or later: 00035 * 00036 * This program is free software; you can redistribute it and/or modify 00037 * it under the terms of the GNU General Public License as published by 00038 * the Free Software Foundation; either version 2 of the License, or 00039 * (at your option) any later version. 00040 * 00041 * This program is distributed in the hope that it will be useful, 00042 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00043 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00044 * GNU General Public License for more details. 00045 * 00046 * You should have received a copy of the GNU General Public License along 00047 * with this program; if not, write to the Free Software Foundation, Inc., 00048 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00049 * 00050 * ********** 00051 * 00052 */ 00053 #ifndef MBEDTLS_ARC4_H 00054 #define MBEDTLS_ARC4_H 00055 00056 #if !defined(MBEDTLS_CONFIG_FILE) 00057 #include "config.h" 00058 #else 00059 #include MBEDTLS_CONFIG_FILE 00060 #endif 00061 00062 #include <stddef.h> 00063 00064 #define MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED -0x0019 00066 #if !defined(MBEDTLS_ARC4_ALT) 00067 // Regular implementation 00068 // 00069 00070 #ifdef __cplusplus 00071 extern "C" { 00072 #endif 00073 00081 typedef struct 00082 { 00083 int x; 00084 int y; 00085 unsigned char m[256]; 00086 } 00087 mbedtls_arc4_context; 00088 00099 void mbedtls_arc4_init( mbedtls_arc4_context *ctx ); 00100 00111 void mbedtls_arc4_free( mbedtls_arc4_context *ctx ); 00112 00125 void mbedtls_arc4_setup( mbedtls_arc4_context *ctx, const unsigned char *key, 00126 unsigned int keylen ); 00127 00143 int mbedtls_arc4_crypt( mbedtls_arc4_context *ctx, size_t length, const unsigned char *input, 00144 unsigned char *output ); 00145 00146 #ifdef __cplusplus 00147 } 00148 #endif 00149 00150 #else /* MBEDTLS_ARC4_ALT */ 00151 #include "arc4_alt.h" 00152 #endif /* MBEDTLS_ARC4_ALT */ 00153 00154 #ifdef __cplusplus 00155 extern "C" { 00156 #endif 00157 00168 int mbedtls_arc4_self_test( int verbose ); 00169 00170 #ifdef __cplusplus 00171 } 00172 #endif 00173 00174 #endif /* arc4.h */