]> cvs.zerfleddert.de Git - proxmark3-svn/blame_incremental - common/mbedtls/arc4.h
add: 'hf mf personalize' (personalize UID on Mifare Classic EV1 7byte UID cards)
[proxmark3-svn] / common / mbedtls / arc4.h
... / ...
CommitLineData
1/**
2 * \file arc4.h
3 *
4 * \brief The ARCFOUR stream cipher
5 *
6 * \warning ARC4 is considered a weak cipher and its use constitutes a
7 * security risk. We recommend considering stronger ciphers instead.
8 */
9/*
10 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
11 * SPDX-License-Identifier: GPL-2.0
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 *
27 * This file is part of mbed TLS (https://tls.mbed.org)
28 *
29 */
30#ifndef MBEDTLS_ARC4_H
31#define MBEDTLS_ARC4_H
32
33#if !defined(MBEDTLS_CONFIG_FILE)
34#include "config.h"
35#else
36#include MBEDTLS_CONFIG_FILE
37#endif
38
39#include <stddef.h>
40
41#define MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED -0x0019 /**< ARC4 hardware accelerator failed. */
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47#if !defined(MBEDTLS_ARC4_ALT)
48// Regular implementation
49//
50
51/**
52 * \brief ARC4 context structure
53 *
54 * \warning ARC4 is considered a weak cipher and its use constitutes a
55 * security risk. We recommend considering stronger ciphers instead.
56 *
57 */
58typedef struct mbedtls_arc4_context
59{
60 int x; /*!< permutation index */
61 int y; /*!< permutation index */
62 unsigned char m[256]; /*!< permutation table */
63}
64mbedtls_arc4_context;
65
66#else /* MBEDTLS_ARC4_ALT */
67#include "arc4_alt.h"
68#endif /* MBEDTLS_ARC4_ALT */
69
70/**
71 * \brief Initialize ARC4 context
72 *
73 * \param ctx ARC4 context to be initialized
74 *
75 * \warning ARC4 is considered a weak cipher and its use constitutes a
76 * security risk. We recommend considering stronger ciphers
77 * instead.
78 *
79 */
80void mbedtls_arc4_init( mbedtls_arc4_context *ctx );
81
82/**
83 * \brief Clear ARC4 context
84 *
85 * \param ctx ARC4 context to be cleared
86 *
87 * \warning ARC4 is considered a weak cipher and its use constitutes a
88 * security risk. We recommend considering stronger ciphers
89 * instead.
90 *
91 */
92void mbedtls_arc4_free( mbedtls_arc4_context *ctx );
93
94/**
95 * \brief ARC4 key schedule
96 *
97 * \param ctx ARC4 context to be setup
98 * \param key the secret key
99 * \param keylen length of the key, in bytes
100 *
101 * \warning ARC4 is considered a weak cipher and its use constitutes a
102 * security risk. We recommend considering stronger ciphers
103 * instead.
104 *
105 */
106void mbedtls_arc4_setup( mbedtls_arc4_context *ctx, const unsigned char *key,
107 unsigned int keylen );
108
109/**
110 * \brief ARC4 cipher function
111 *
112 * \param ctx ARC4 context
113 * \param length length of the input data
114 * \param input buffer holding the input data
115 * \param output buffer for the output data
116 *
117 * \return 0 if successful
118 *
119 * \warning ARC4 is considered a weak cipher and its use constitutes a
120 * security risk. We recommend considering stronger ciphers
121 * instead.
122 *
123 */
124int mbedtls_arc4_crypt( mbedtls_arc4_context *ctx, size_t length, const unsigned char *input,
125 unsigned char *output );
126
127/**
128 * \brief Checkup routine
129 *
130 * \return 0 if successful, or 1 if the test failed
131 *
132 * \warning ARC4 is considered a weak cipher and its use constitutes a
133 * security risk. We recommend considering stronger ciphers
134 * instead.
135 *
136 */
137int mbedtls_arc4_self_test( int verbose );
138
139#ifdef __cplusplus
140}
141#endif
142
143#endif /* arc4.h */
Impressum, Datenschutz