Get MbedTLS and its unit tests passing AARCH64

This commit is contained in:
Justine Tunney 2023-05-11 21:53:15 -07:00
parent 5e2f7f7ced
commit 4edbc98811
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
37 changed files with 632 additions and 725 deletions

View file

@ -273,6 +273,7 @@ int mbedtls_mpi_mul_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
return 0;
}
#ifdef __x86_64__
if (!IsTiny() && i == j) {
if (X->n < i * 2) {
if ((ret = mbedtls_mpi_grow(X, i * 2))) return ret;
@ -293,6 +294,7 @@ int mbedtls_mpi_mul_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
return 0;
}
}
#endif /* __x86_64__ */
mbedtls_mpi_init( &TA );
mbedtls_mpi_init( &TB );
@ -310,9 +312,8 @@ int mbedtls_mpi_mul_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
B = &TB;
}
if (!IsTiny() &&
i >= 16 && i == j && !(i & (i - 1)) &&
X86_HAVE(BMI2) && X86_HAVE(ADX) &&
(K = malloc(i * 4 * sizeof(*K)))) {
i >= 16 && i == j && !(i & (i - 1)) &&
(K = malloc(i * 4 * sizeof(*K)))) {
Karatsuba(X->p, A->p, B->p, i, K);
free(K);
} else {