Fix warnings

This change fixes Cosmopolitan so it has fewer opinions about compiler
warnings. The whole repository had to be cleaned up to be buildable in
-Werror -Wall mode. This lets us benefit from things like strict const
checking. Some actual bugs might have been caught too.
This commit is contained in:
Justine Tunney 2023-09-01 20:49:13 -07:00
parent e2b3c3618e
commit 0d748ad58e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
571 changed files with 1306 additions and 1888 deletions

View file

@ -130,7 +130,6 @@ int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
*/
void mbedtls_aesni_gcm_mult( unsigned char a[16], const uint64_t b[2] )
{
size_t i;
uint64_t aa _Vector_size(16) forcealign(16);
uint64_t bb _Vector_size(16) forcealign(16);

View file

@ -15,8 +15,8 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/base64.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/platform.h"
@ -127,8 +127,8 @@ static inline unsigned char mbedtls_base64_table_lookup( const unsigned char * c
int mbedtls_base64_encode( unsigned char *dst, size_t dlen, size_t *olen,
const unsigned char *src, size_t slen )
{
size_t n;
unsigned w;
size_t i, n;
unsigned char *q;
const unsigned char *p, *pe;
if( !slen ) {

View file

@ -26,7 +26,7 @@
#include "third_party/mbedtls/profile.h"
/* clang-format off */
void Mul(uint64_t *c, uint64_t *A, unsigned n, uint64_t *B, unsigned m)
void Mul(uint64_t *c, const uint64_t *A, unsigned n, const uint64_t *B, unsigned m)
{
if (!m--) return;
mbedtls_platform_zeroize(c, m * ciL);
@ -41,8 +41,8 @@ void Mul(uint64_t *c, uint64_t *A, unsigned n, uint64_t *B, unsigned m)
void mbedtls_mpi_mul_hlp1(size_t n, const uint64_t *s, uint64_t *d, uint64_t b)
{
size_t i;
uint64_t c;
uint128_t x;
uint64_t c, t, t1, t2;
i = c = 0;
#if defined(__x86_64__) && !defined(__STRICT_ANSI__)
if( X86_HAVE(BMI2) )
@ -113,7 +113,7 @@ void mbedtls_mpi_mul_hlp1(size_t n, const uint64_t *s, uint64_t *d, uint64_t b)
/**
* Computes inner loop of multiplication algorithm.
*/
void mbedtls_mpi_mul_hlp(size_t n, uint64_t *s, uint64_t *d, uint64_t b)
void mbedtls_mpi_mul_hlp(size_t n, const uint64_t *s, uint64_t *d, uint64_t b)
{
size_t i;
uint128_t x;
@ -241,9 +241,10 @@ int mbedtls_mpi_mul_int(mbedtls_mpi *X, const mbedtls_mpi *A,
int mbedtls_mpi_mul_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
const mbedtls_mpi *B)
{
int i, j, t, k, ret;
int i, j, t, ret;
mbedtls_mpi TA, TB;
mbedtls_mpi_uint *K;
mbedtls_mpi TA, TB, *T;
const mbedtls_mpi *T;
MPI_VALIDATE_RET(X);
MPI_VALIDATE_RET(A);
MPI_VALIDATE_RET(B);

View file

@ -438,7 +438,7 @@ cleanup:
*/
size_t mbedtls_mpi_lsb( const mbedtls_mpi *X )
{
size_t i, j, count = 0;
size_t i, count = 0;
MBEDTLS_INTERNAL_VALIDATE_RET(X, 0);
for( i = 0; i < X->n; i++ )
{
@ -1279,6 +1279,8 @@ forceinline mbedtls_mpi_uint mpi_sub_hlp(mbedtls_mpi_uint *d,
size_t i;
unsigned char cf;
mbedtls_mpi_uint c, x;
(void)x;
(void)cf;
cf = c = i = 0;
#if defined(__x86_64__) && !defined(__STRICT_ANSI__)
if (!n) return 0;
@ -1679,7 +1681,7 @@ int mbedtls_mpi_div_mpi(mbedtls_mpi *Q, mbedtls_mpi *R, const mbedtls_mpi *A,
const mbedtls_mpi *B)
{
int ret = MBEDTLS_ERR_THIS_CORRUPTION;
size_t i, n, t, k, Xn, Yn;
size_t i, n, t, k;
mbedtls_mpi X, Y, Z, T1, T2;
mbedtls_mpi_uint TP2[3];
MPI_VALIDATE_RET(A);

View file

@ -9,8 +9,8 @@ COSMOPOLITAN_C_START_
#define MPI_VALIDATE(cond) MBEDTLS_INTERNAL_VALIDATE(cond)
#define ciL (sizeof(mbedtls_mpi_uint)) /* chars in limb */
#define biL (ciL << 3) /* bits in limb */
#define biH (ciL << 2) /* half limb size */
#define biL (ciL << 3) /* bits in limb */
#define biH (ciL << 2) /* half limb size */
#define MPI_SIZE_T_MAX ((size_t)-1) /* SIZE_T_MAX is not standard */
@ -30,9 +30,9 @@ void Mul4x4Adx(uint64_t[8], const uint64_t[4], const uint64_t[4]);
void Mul6x6Adx(uint64_t[12], const uint64_t[6], const uint64_t[6]);
void Mul8x8Adx(uint64_t[16], const uint64_t[8], const uint64_t[8]);
void Mul4x4Pure(uint64_t[16], const uint64_t[8], const uint64_t[8]);
void Mul(uint64_t *, uint64_t *, unsigned, uint64_t *, unsigned);
void Mul(uint64_t *, const uint64_t *, unsigned, const uint64_t *, unsigned);
void Karatsuba(uint64_t *, uint64_t *, uint64_t *, size_t, uint64_t *);
void mbedtls_mpi_mul_hlp(size_t, uint64_t *, uint64_t *, uint64_t);
void mbedtls_mpi_mul_hlp(size_t, const uint64_t *, uint64_t *, uint64_t);
void mbedtls_mpi_mul_hlp1(size_t, const uint64_t *, uint64_t *, uint64_t);
COSMOPOLITAN_C_END_

View file

@ -70,14 +70,13 @@ static inline void shld(mbedtls_mpi_uint *p, size_t n, size_t m, char k)
int mbedtls_mpi_shift_l(mbedtls_mpi *X, size_t k)
{
int r;
size_t b, n, m, l, z;
size_t b, n, m, l;
MPI_VALIDATE_RET(X);
l = mbedtls_mpi_bitlen(X);
b = l + k;
n = BITS_TO_LIMBS(b);
m = k / biL;
k = k % biL;
z = X->n;
if (n > X->n && (r = mbedtls_mpi_grow(X, n)))
return r;
if (k)
@ -102,7 +101,6 @@ void ShiftRightPure(mbedtls_mpi_uint *p, size_t n, unsigned char k) {
int mbedtls_mpi_shift_r(mbedtls_mpi *X, size_t k)
{
size_t n;
mbedtls_mpi_uint x, y;
MPI_VALIDATE_RET(X);
k = MIN(k, X->n * biL);
n = k / biL;

View file

@ -15,8 +15,8 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/str/str.h"
#include "third_party/mbedtls/ecdh_everest.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/everest.h"
#if defined(MBEDTLS_ECDH_C) && defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
#define KEYSIZE 32
@ -156,7 +156,6 @@ int mbedtls_everest_get_params(mbedtls_ecdh_context_everest *ctx,
mbedtls_everest_ecdh_side side)
{
size_t olen = 0;
mbedtls_everest_ecdh_side s;
switch (side)
{
case MBEDTLS_EVEREST_ECDH_THEIRS:

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "third_party/mbedtls/ecp.h"
#include "libc/intrin/strace.internal.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
@ -26,7 +27,6 @@
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/config.h"
#include "third_party/mbedtls/ctr_drbg.h"
#include "third_party/mbedtls/ecp.h"
#include "third_party/mbedtls/ecp_internal.h"
#include "third_party/mbedtls/error.h"
#include "third_party/mbedtls/hmac_drbg.h"
@ -1737,9 +1737,9 @@ static int ecp_add_mixed( const mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
/*
* Trivial cases: P == 0 or Q == 0 (case 1)
*/
if( mbedtls_ecp_is_zero( P ) )
if( mbedtls_ecp_is_zero( (void *)P ) )
return( mbedtls_ecp_copy( R, Q ) );
if( Q->Z.p && mbedtls_ecp_is_zero( Q ) )
if( Q->Z.p && mbedtls_ecp_is_zero( (void *)Q ) )
return( mbedtls_ecp_copy( R, P ) );
/*
* Make sure Q coordinates are normalized

View file

@ -38,7 +38,7 @@ static bool
mbedtls_p256_gte( uint64_t p[5] )
{
return( (((int64_t)p[4] > 0) |
(!p[4] &
((!p[4]) &
((p[3] > 0xffffffff00000001) |
((p[3] == 0xffffffff00000001) &
((p[2] > 0x0000000000000000) |

View file

@ -39,7 +39,7 @@ static bool
mbedtls_p384_gte( uint64_t p[7] )
{
return( (((int64_t)p[6] > 0) |
(!p[6] &
((!p[6]) &
((p[5] > 0xffffffffffffffff) |
((p[5] == 0xffffffffffffffff) &
((p[4] > 0xffffffffffffffff) |
@ -189,13 +189,11 @@ mbedtls_p384_mul( uint64_t X[12],
void *f = 0;
if( A == X )
{
A = memcpy( malloc( 6 * 8 ), A, 6 * 8 );
f = A;
A = f = memcpy( malloc( 6 * 8 ), A, 6 * 8 );
}
else if( B == X )
{
B = memcpy( malloc( 6 * 8 ), B, 6 * 8 );
f = B;
B = f = memcpy( malloc( 6 * 8 ), B, 6 * 8 );
}
Mul( X, A, n, B, m );
mbedtls_platform_zeroize( X + n + m, (12 - n - m) * 8 );
@ -417,7 +415,7 @@ int mbedtls_p384_double_jac( const mbedtls_ecp_group *G,
if( IsAsan() ) __asan_verify( P, sizeof( *P ) );
if( IsAsan() ) __asan_verify( R, sizeof( *R ) );
if( ( ret = mbedtls_p384_dim( R ) ) ) return( ret );
if( ( ret = mbedtls_p384_dim( P ) ) ) return( ret );
if( ( ret = mbedtls_p384_dim( (void *)P ) ) ) return( ret );
mbedtls_platform_zeroize( T, sizeof( T ) );
mbedtls_p384_mul( T[1], P->Z.p, 6, P->Z.p, 6 );
mbedtls_p384_add( T[2], P->X.p, T[1] );

View file

@ -33,10 +33,10 @@ static void mbedtls_mpi_shift_l_mod_p256( const mbedtls_ecp_group *G,
X->p[0] = X->p[0] << 1;
if( (X->p[4] ||
X->p[3] > G->P.p[3] ||
(X->p[3] == G->P.p[3] &&
X->p[2] > G->P.p[2] ||
(X->p[2] == G->P.p[2] &&
X->p[0] > G->P.p[0] ||
((X->p[3] == G->P.p[3] &&
X->p[2] > G->P.p[2]) ||
((X->p[2] == G->P.p[2] &&
X->p[0] > G->P.p[0]) ||
(X->p[0] == G->P.p[0])))) )
{
SBB(X->p[0], X->p[0], G->P.p[0], 0, c);
@ -63,14 +63,14 @@ static void mbedtls_mpi_shift_l_mod_p384( const mbedtls_ecp_group *G,
X->p[0] = X->p[0] << 1;
if( (X->p[6] ||
X->p[5] > G->P.p[5] ||
(X->p[5] == G->P.p[5] &&
X->p[4] > G->P.p[4] ||
(X->p[4] == G->P.p[4] &&
X->p[3] > G->P.p[3] ||
(X->p[3] == G->P.p[3] &&
X->p[2] > G->P.p[2] ||
(X->p[2] == G->P.p[2] &&
X->p[0] > G->P.p[0] ||
((X->p[5] == G->P.p[5] &&
X->p[4] > G->P.p[4]) ||
((X->p[4] == G->P.p[4] &&
X->p[3] > G->P.p[3]) ||
((X->p[3] == G->P.p[3] &&
X->p[2] > G->P.p[2]) ||
((X->p[2] == G->P.p[2] &&
X->p[0] > G->P.p[0]) ||
(X->p[0] == G->P.p[0])))))) )
{
SBB(X->p[0], X->p[0], G->P.p[0], 0, c);

View file

@ -171,7 +171,7 @@ static void HaclEcPointSwap(uint64_t a[2][5], uint64_t b[2][5], uint64_t m) {
}
}
static void HaclEcFormatFexpand(uint64_t o[5], uint8_t p[32]) {
static void HaclEcFormatFexpand(uint64_t o[5], const uint8_t p[32]) {
o[0] = READ64LE(p + 000) >> 00 & 0x7ffffffffffff;
o[1] = READ64LE(p + 006) >> 03 & 0x7ffffffffffff;
o[2] = READ64LE(p + 014) >> 06 & 0x7ffffffffffff;

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "third_party/mbedtls/gcm.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/likely.h"
#include "libc/log/log.h"
@ -27,7 +28,6 @@
#include "third_party/mbedtls/common.h"
#include "third_party/mbedtls/endian.h"
#include "third_party/mbedtls/error.h"
#include "third_party/mbedtls/gcm.h"
#include "third_party/mbedtls/platform.h"
asm(".ident\t\"\\n\\n\
@ -102,7 +102,6 @@ void mbedtls_gcm_init( mbedtls_gcm_context *ctx )
static int gcm_gen_table( mbedtls_gcm_context *ctx )
{
int ret, i, j;
uint64_t hi, lo;
uint64_t vl, vh;
unsigned char h[16];
size_t olen = 0;

View file

@ -24,7 +24,6 @@
#include "third_party/mbedtls/platform.h"
forceinline int Cmp(uint64_t *a, uint64_t *b, size_t n) {
size_t i;
uint64_t x, y;
while (n--) {
x = a[n];
@ -38,8 +37,9 @@ forceinline int Cmp(uint64_t *a, uint64_t *b, size_t n) {
forceinline bool Sub(uint64_t *C, uint64_t *A, uint64_t *B, size_t n) {
bool cf;
uint64_t c, i;
uint64_t i;
#ifdef __x86_64__
uint64_t c;
asm volatile("xor\t%1,%1\n\t"
".align\t16\n1:\t"
"mov\t(%5,%3,8),%1\n\t"
@ -52,7 +52,7 @@ forceinline bool Sub(uint64_t *C, uint64_t *A, uint64_t *B, size_t n) {
: "r"(C), "r"(A), "r"(B), "3"(0)
: "cc", "memory");
#else
for (cf = false, c = i = 0; i < n; ++i) {
for (cf = false, i = 0; i < n; ++i) {
SBB(C[i], A[i], B[i], cf, cf);
}
#endif
@ -61,8 +61,9 @@ forceinline bool Sub(uint64_t *C, uint64_t *A, uint64_t *B, size_t n) {
forceinline bool Add(uint64_t *C, uint64_t *A, uint64_t *B, size_t n) {
bool cf;
uint64_t c, i;
uint64_t i;
#ifdef __x86_64__
uint64_t c;
asm volatile("xor\t%1,%1\n\t"
".align\t16\n1:\t"
"mov\t(%5,%3,8),%1\n\t"
@ -75,7 +76,7 @@ forceinline bool Add(uint64_t *C, uint64_t *A, uint64_t *B, size_t n) {
: "r"(C), "r"(A), "r"(B), "3"(0)
: "cc", "memory");
#else
for (cf = false, c = i = 0; i < n; ++i) {
for (cf = false, i = 0; i < n; ++i) {
ADC(C[i], A[i], B[i], cf, cf);
}
#endif
@ -89,10 +90,8 @@ forceinline bool Add(uint64_t *C, uint64_t *A, uint64_t *B, size_t n) {
* For 16384 bit numbers it's thrice as fast.
*/
void Karatsuba(uint64_t *C, uint64_t *A, uint64_t *B, size_t n, uint64_t *K) {
int q, r;
size_t i;
uint64_t c, t;
uint64_t *x, *y;
if (n == 8) {
#ifdef __x86_64__
if (X86_HAVE(BMI2) && X86_HAVE(ADX)) {

View file

@ -16,6 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "third_party/mbedtls/san.h"
#include "libc/intrin/bits.h"
#include "libc/sock/sock.h"
#include "libc/sysv/consts/af.h"
@ -23,7 +24,6 @@
#include "third_party/mbedtls/asn1write.h"
#include "third_party/mbedtls/oid.h"
#include "third_party/mbedtls/platform.h"
#include "third_party/mbedtls/san.h"
#include "third_party/mbedtls/x509_crt.h"
/**
@ -33,9 +33,10 @@
*/
int mbedtls_x509write_crt_set_subject_alternative_name(
mbedtls_x509write_cert *ctx, const struct mbedtls_san *san, size_t sanlen) {
int ret, a, b, c;
int ret;
const unsigned char *item;
size_t i, len, cap, itemlen;
unsigned char *pc, *buf, *item, ip4[4];
unsigned char *pc, *buf, ip4[4];
if (!sanlen) return 0;
cap = sanlen * (253 + 5 + 1) + 5 + 1;
if (!(buf = mbedtls_calloc(1, cap))) return MBEDTLS_ERR_ASN1_ALLOC_FAILED;

View file

@ -43,16 +43,18 @@
* @see FIPS 186-3 §D.2.3
*/
void secp256r1(uint64_t p[8]) {
int r;
char o;
signed char E;
uint64_t A, B, C, D, a, b, c, d, e;
uint64_t A, B, C, D, b, c, d;
A = Q(0);
B = Q(2);
C = Q(4);
D = Q(6);
E = 0;
#if !defined(__x86_64__) || defined(__STRICT_ANSI__)
(void)b;
(void)c;
(void)d;
ADC(B, B, H(Q(10)) << 1, 0, o);
ADC(C, C, Q(12) << 1 | Q(10) >> 63, o, o);
ADC(D, D, Q(14) << 1 | Q(12) >> 63, o, o);
@ -92,6 +94,7 @@ void secp256r1(uint64_t p[8]) {
SBB(D, D, H(Q(12)), o, o);
E -= o;
#else
(void)o;
asm volatile(/* x += 2 × ( A₁₅ ‖ A₁₄ ‖ A₁₃ ‖ A₁₂ ‖ A₁₁ ‖ 0 ‖ 0 ‖ 0 ) */
"mov\t11*4(%8),%k5\n\t"
"mov\t12*4(%8),%6\n\t"

View file

@ -112,6 +112,7 @@ void secp384r1(uint64_t p[12]) {
SBB(F, F, 0, o, o);
G -= o;
#else
(void)o;
asm volatile(/* S₁ = (0 ‖0 ‖0 ‖0 ‖0 ‖A₂₃‖A₂₂‖A₂₁‖0 ‖0 ‖0 ‖0 ) */
"mov\t21*4(%9),%7\n\t"
"mov\t23*4(%9),%k8\n\t"

View file

@ -380,8 +380,8 @@ int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx,
size_t ilen )
{
int ret = MBEDTLS_ERR_THIS_CORRUPTION;
size_t fill;
uint32_t left;
size_t n, fill;
SHA1_VALIDATE_RET( ctx != NULL );
SHA1_VALIDATE_RET( ilen == 0 || input != NULL );

View file

@ -25,9 +25,9 @@ typedef uint64_t xmm_t __attribute__((__vector_size__(16), __aligned__(1)));
void ShiftRightAvx(uint64_t *p, size_t n, unsigned char k) {
uint64_t p1;
xmm_t o0, o1;
xmm_t i0, i1;
xmm_t cv = {0};
xmm_t i0, i1, i2, i3;
xmm_t o0, o1, o2, o3;
MBEDTLS_ASSERT(!(k & ~63));
p1 = n > 1 ? p[1] : 0;
while (n >= 4) {

View file

@ -1253,8 +1253,6 @@ MBEDTLS_STATIC_TESTABLE int mbedtls_ssl_cf_hmac(
const unsigned char * const okey = ikey + block_size;
const size_t hash_size = mbedtls_md_get_size( ctx->md_info );
unsigned char aux_out[MBEDTLS_MD_MAX_SIZE];
size_t offset;
int ret = MBEDTLS_ERR_THIS_CORRUPTION;
#define MD_CHK( func_call ) \

View file

@ -2808,7 +2808,7 @@ static void ssl_calc_finished_tls_sha384(
{
int len = 12;
const char *sender;
unsigned char padbuf[48];
unsigned char padbuf[64];
mbedtls_sha512_context sha512;
mbedtls_ssl_session *session = ssl->session_negotiate;
if( !session )

View file

@ -78,7 +78,6 @@ int option_verbose = 1;
mbedtls_test_info_t mbedtls_test_info;
int mbedtls_test_platform_setup(void) {
char *p;
int ret = 0;
static char mybuf[2][BUFSIZ];
ShowCrashReports();
@ -132,8 +131,7 @@ int mbedtls_hardware_poll(void *wut, unsigned char *p, size_t n, size_t *olen) {
}
int mbedtls_test_write(const char *fmt, ...) {
int i, n;
char *p;
int n;
va_list va;
va_start(va, fmt);
if (option_verbose) {

View file

@ -59,14 +59,6 @@ TEST(secp384r1, testIsTheSame) {
TEST(secp384r1, needsDownwardCorrection) {
int i;
uint64_t P[6] = {
0x00000000ffffffff, //
0xffffffff00000000, //
0xfffffffffffffffe, //
0xffffffffffffffff, //
0xffffffffffffffff, //
0xffffffffffffffff, //
};
uint64_t X[12] = {
0xffffffffffffffff, //
0xffffffffffffffff, //

View file

@ -512,6 +512,8 @@ void test_aes_check_params( )
const int valid_mode = MBEDTLS_AES_ENCRYPT;
const int invalid_mode = 42;
(void)size;
TEST_INVALID_PARAM( mbedtls_aes_init( NULL ) );
#if defined(MBEDTLS_CIPHER_MODE_XTS)
TEST_INVALID_PARAM( mbedtls_aes_xts_init( NULL ) );

View file

@ -502,6 +502,8 @@ void test_aes_check_params( )
const int valid_mode = MBEDTLS_AES_ENCRYPT;
const int invalid_mode = 42;
(void)size;
TEST_INVALID_PARAM( mbedtls_aes_init( NULL ) );
#if defined(MBEDTLS_CIPHER_MODE_XTS)
TEST_INVALID_PARAM( mbedtls_aes_xts_init( NULL ) );

View file

@ -501,6 +501,8 @@ void test_aes_check_params( )
size_t size;
const int valid_mode = MBEDTLS_AES_ENCRYPT;
const int invalid_mode = 42;
(void)size;
TEST_INVALID_PARAM( mbedtls_aes_init( NULL ) );
#if defined(MBEDTLS_CIPHER_MODE_XTS)

View file

@ -502,6 +502,8 @@ void test_aes_check_params( )
const int valid_mode = MBEDTLS_AES_ENCRYPT;
const int invalid_mode = 42;
(void)size;
TEST_INVALID_PARAM( mbedtls_aes_init( NULL ) );
#if defined(MBEDTLS_CIPHER_MODE_XTS)
TEST_INVALID_PARAM( mbedtls_aes_xts_init( NULL ) );

View file

@ -502,6 +502,8 @@ void test_aes_check_params( )
const int valid_mode = MBEDTLS_AES_ENCRYPT;
const int invalid_mode = 42;
(void)size;
TEST_INVALID_PARAM( mbedtls_aes_init( NULL ) );
#if defined(MBEDTLS_CIPHER_MODE_XTS)
TEST_INVALID_PARAM( mbedtls_aes_xts_init( NULL ) );

View file

@ -502,6 +502,8 @@ void test_aes_check_params( )
const int valid_mode = MBEDTLS_AES_ENCRYPT;
const int invalid_mode = 42;
(void)size;
TEST_INVALID_PARAM( mbedtls_aes_init( NULL ) );
#if defined(MBEDTLS_CIPHER_MODE_XTS)
TEST_INVALID_PARAM( mbedtls_aes_xts_init( NULL ) );