00001 00009 /* 00010 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 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 * This file is part of mbed TLS (https://tls.mbed.org) 00053 * 00054 */ 00055 #ifndef MBEDTLS_ARC4_H 00056 #define MBEDTLS_ARC4_H 00057 00058 #if !defined(MBEDTLS_CONFIG_FILE) 00059 #include "config.h" 00060 #else 00061 #include MBEDTLS_CONFIG_FILE 00062 #endif 00063 00064 #include <stddef.h> 00065 00066 #define MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED -0x0019 00068 #if !defined(MBEDTLS_ARC4_ALT) 00069 // Regular implementation 00070 // 00071 00072 #ifdef __cplusplus 00073 extern "C" { 00074 #endif 00075 00083 typedef struct 00084 { 00085 int x; 00086 int y; 00087 unsigned char m[256]; 00088 } 00089 mbedtls_arc4_context; 00090 00101 void mbedtls_arc4_init( mbedtls_arc4_context *ctx ); 00102 00113 void mbedtls_arc4_free( mbedtls_arc4_context *ctx ); 00114 00127 void mbedtls_arc4_setup( mbedtls_arc4_context *ctx, const unsigned char *key, 00128 unsigned int keylen ); 00129 00145 int mbedtls_arc4_crypt( mbedtls_arc4_context *ctx, size_t length, const unsigned char *input, 00146 unsigned char *output ); 00147 00148 #ifdef __cplusplus 00149 } 00150 #endif 00151 00152 #else /* MBEDTLS_ARC4_ALT */ 00153 #include "arc4_alt.h" 00154 #endif /* MBEDTLS_ARC4_ALT */ 00155 00156 #ifdef __cplusplus 00157 extern "C" { 00158 #endif 00159 00170 int mbedtls_arc4_self_test( int verbose ); 00171 00172 #ifdef __cplusplus 00173 } 00174 #endif 00175 00176 #endif /* arc4.h */