Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.

Commit b927cd0

Browse files
committed
Update to mbed-5.15 + arduino patches
1 parent cc80ac1 commit b927cd0

File tree

100 files changed

+34680
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+34680
-121
lines changed

cores/arduino/mbed/drivers/AnalogIn.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ class AnalogIn {
8080
*/
8181
AnalogIn(PinName pin);
8282

83+
84+
/** Reconfigure the adc object using the given configuration
85+
*
86+
* @param config reference to structure which holds AnalogIn configuration
87+
*/
88+
void configure(const analogin_config_t &config);
89+
8390
/** Read the input voltage, represented as a float in the range [0.0, 1.0]
8491
*
8592
* @returns A floating-point value representing the current input voltage, measured as a percentage

cores/arduino/mbed/features/mbedtls/inc/mbedtls/aes.h

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/**
2+
* \file aesni.h
3+
*
4+
* \brief AES-NI for hardware AES acceleration on some Intel processors
5+
*
6+
* \warning These functions are only for internal use by other library
7+
* functions; you must not call them directly.
8+
*/
9+
/*
10+
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
11+
* SPDX-License-Identifier: Apache-2.0
12+
*
13+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
14+
* not use this file except in compliance with the License.
15+
* You may obtain a copy of the License at
16+
*
17+
* http://www.apache.org/licenses/LICENSE-2.0
18+
*
19+
* Unless required by applicable law or agreed to in writing, software
20+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
21+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22+
* See the License for the specific language governing permissions and
23+
* limitations under the License.
24+
*
25+
* This file is part of mbed TLS (https://tls.mbed.org)
26+
*/
27+
#ifndef MBEDTLS_AESNI_H
28+
#define MBEDTLS_AESNI_H
29+
30+
#if !defined(MBEDTLS_CONFIG_FILE)
31+
#include "mbedtls/config.h"
32+
#else
33+
#include MBEDTLS_CONFIG_FILE
34+
#endif
35+
36+
#include "mbedtls/aes.h"
37+
38+
#define MBEDTLS_AESNI_AES 0x02000000u
39+
#define MBEDTLS_AESNI_CLMUL 0x00000002u
40+
41+
#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && \
42+
( defined(__amd64__) || defined(__x86_64__) ) && \
43+
! defined(MBEDTLS_HAVE_X86_64)
44+
#define MBEDTLS_HAVE_X86_64
45+
#endif
46+
47+
#if defined(MBEDTLS_HAVE_X86_64)
48+
49+
#ifdef __cplusplus
50+
extern "C" {
51+
#endif
52+
53+
/**
54+
* \brief Internal function to detect the AES-NI feature in CPUs.
55+
*
56+
* \note This function is only for internal use by other library
57+
* functions; you must not call it directly.
58+
*
59+
* \param what The feature to detect
60+
* (MBEDTLS_AESNI_AES or MBEDTLS_AESNI_CLMUL)
61+
*
62+
* \return 1 if CPU has support for the feature, 0 otherwise
63+
*/
64+
int mbedtls_aesni_has_support( unsigned int what );
65+
66+
/**
67+
* \brief Internal AES-NI AES-ECB block encryption and decryption
68+
*
69+
* \note This function is only for internal use by other library
70+
* functions; you must not call it directly.
71+
*
72+
* \param ctx AES context
73+
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
74+
* \param input 16-byte input block
75+
* \param output 16-byte output block
76+
*
77+
* \return 0 on success (cannot fail)
78+
*/
79+
int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
80+
int mode,
81+
const unsigned char input[16],
82+
unsigned char output[16] );
83+
84+
/**
85+
* \brief Internal GCM multiplication: c = a * b in GF(2^128)
86+
*
87+
* \note This function is only for internal use by other library
88+
* functions; you must not call it directly.
89+
*
90+
* \param c Result
91+
* \param a First operand
92+
* \param b Second operand
93+
*
94+
* \note Both operands and result are bit strings interpreted as
95+
* elements of GF(2^128) as per the GCM spec.
96+
*/
97+
void mbedtls_aesni_gcm_mult( unsigned char c[16],
98+
const unsigned char a[16],
99+
const unsigned char b[16] );
100+
101+
/**
102+
* \brief Internal round key inversion. This function computes
103+
* decryption round keys from the encryption round keys.
104+
*
105+
* \note This function is only for internal use by other library
106+
* functions; you must not call it directly.
107+
*
108+
* \param invkey Round keys for the equivalent inverse cipher
109+
* \param fwdkey Original round keys (for encryption)
110+
* \param nr Number of rounds (that is, number of round keys minus one)
111+
*/
112+
void mbedtls_aesni_inverse_key( unsigned char *invkey,
113+
const unsigned char *fwdkey,
114+
int nr );
115+
116+
/**
117+
* \brief Internal key expansion for encryption
118+
*
119+
* \note This function is only for internal use by other library
120+
* functions; you must not call it directly.
121+
*
122+
* \param rk Destination buffer where the round keys are written
123+
* \param key Encryption key
124+
* \param bits Key size in bits (must be 128, 192 or 256)
125+
*
126+
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
127+
*/
128+
int mbedtls_aesni_setkey_enc( unsigned char *rk,
129+
const unsigned char *key,
130+
size_t bits );
131+
132+
#ifdef __cplusplus
133+
}
134+
#endif
135+
136+
#endif /* MBEDTLS_HAVE_X86_64 */
137+
138+
#endif /* MBEDTLS_AESNI_H */
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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: Apache-2.0
12+
*
13+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
14+
* not use this file except in compliance with the License.
15+
* You may obtain a copy of the License at
16+
*
17+
* http://www.apache.org/licenses/LICENSE-2.0
18+
*
19+
* Unless required by applicable law or agreed to in writing, software
20+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
21+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22+
* See the License for the specific language governing permissions and
23+
* limitations under the License.
24+
*
25+
* This file is part of mbed TLS (https://tls.mbed.org)
26+
*
27+
*/
28+
#ifndef MBEDTLS_ARC4_H
29+
#define MBEDTLS_ARC4_H
30+
31+
#if !defined(MBEDTLS_CONFIG_FILE)
32+
#include "mbedtls/config.h"
33+
#else
34+
#include MBEDTLS_CONFIG_FILE
35+
#endif
36+
37+
#include <stddef.h>
38+
39+
/* MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED is deprecated and should not be used. */
40+
#define MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED -0x0019 /**< ARC4 hardware accelerator failed. */
41+
42+
#ifdef __cplusplus
43+
extern "C" {
44+
#endif
45+
46+
#if !defined(MBEDTLS_ARC4_ALT)
47+
// Regular implementation
48+
//
49+
50+
/**
51+
* \brief ARC4 context structure
52+
*
53+
* \warning ARC4 is considered a weak cipher and its use constitutes a
54+
* security risk. We recommend considering stronger ciphers instead.
55+
*
56+
*/
57+
typedef struct mbedtls_arc4_context
58+
{
59+
int x; /*!< permutation index */
60+
int y; /*!< permutation index */
61+
unsigned char m[256]; /*!< permutation table */
62+
}
63+
mbedtls_arc4_context;
64+
65+
#else /* MBEDTLS_ARC4_ALT */
66+
#include "arc4_alt.h"
67+
#endif /* MBEDTLS_ARC4_ALT */
68+
69+
/**
70+
* \brief Initialize ARC4 context
71+
*
72+
* \param ctx ARC4 context to be initialized
73+
*
74+
* \warning ARC4 is considered a weak cipher and its use constitutes a
75+
* security risk. We recommend considering stronger ciphers
76+
* instead.
77+
*
78+
*/
79+
void mbedtls_arc4_init( mbedtls_arc4_context *ctx );
80+
81+
/**
82+
* \brief Clear ARC4 context
83+
*
84+
* \param ctx ARC4 context to be cleared
85+
*
86+
* \warning ARC4 is considered a weak cipher and its use constitutes a
87+
* security risk. We recommend considering stronger ciphers
88+
* instead.
89+
*
90+
*/
91+
void mbedtls_arc4_free( mbedtls_arc4_context *ctx );
92+
93+
/**
94+
* \brief ARC4 key schedule
95+
*
96+
* \param ctx ARC4 context to be setup
97+
* \param key the secret key
98+
* \param keylen length of the key, in bytes
99+
*
100+
* \warning ARC4 is considered a weak cipher and its use constitutes a
101+
* security risk. We recommend considering stronger ciphers
102+
* instead.
103+
*
104+
*/
105+
void mbedtls_arc4_setup( mbedtls_arc4_context *ctx, const unsigned char *key,
106+
unsigned int keylen );
107+
108+
/**
109+
* \brief ARC4 cipher function
110+
*
111+
* \param ctx ARC4 context
112+
* \param length length of the input data
113+
* \param input buffer holding the input data
114+
* \param output buffer for the output data
115+
*
116+
* \return 0 if successful
117+
*
118+
* \warning ARC4 is considered a weak cipher and its use constitutes a
119+
* security risk. We recommend considering stronger ciphers
120+
* instead.
121+
*
122+
*/
123+
int mbedtls_arc4_crypt( mbedtls_arc4_context *ctx, size_t length, const unsigned char *input,
124+
unsigned char *output );
125+
126+
#if defined(MBEDTLS_SELF_TEST)
127+
128+
/**
129+
* \brief Checkup routine
130+
*
131+
* \return 0 if successful, or 1 if the test failed
132+
*
133+
* \warning ARC4 is considered a weak cipher and its use constitutes a
134+
* security risk. We recommend considering stronger ciphers
135+
* instead.
136+
*
137+
*/
138+
int mbedtls_arc4_self_test( int verbose );
139+
140+
#endif /* MBEDTLS_SELF_TEST */
141+
142+
#ifdef __cplusplus
143+
}
144+
#endif
145+
146+
#endif /* arc4.h */

0 commit comments

Comments
 (0)