|
@@ -391,7 +391,7 @@ extern sp_digit sp_2048_sub_in_place_16(sp_digit* a, const sp_digit* b);
|
|
|
* Given m must be 2048 bits, just need to subtract.
|
|
|
*
|
|
|
* r A single precision number.
|
|
|
- * m A signle precision number.
|
|
|
+ * m A single precision number.
|
|
|
*/
|
|
|
static void sp_2048_mont_norm_16(sp_digit* r, const sp_digit* m)
|
|
|
{
|
|
@@ -841,7 +841,7 @@ static int sp_2048_mod_exp_avx2_16(sp_digit* r, const sp_digit* a, const sp_digi
|
|
|
* Given m must be 2048 bits, just need to subtract.
|
|
|
*
|
|
|
* r A single precision number.
|
|
|
- * m A signle precision number.
|
|
|
+ * m A single precision number.
|
|
|
*/
|
|
|
static void sp_2048_mont_norm_32(sp_digit* r, const sp_digit* m)
|
|
|
{
|
|
@@ -1768,7 +1768,7 @@ static int sp_2048_to_mp(const sp_digit* a, mp_int* r)
|
|
|
* exp Exponent. MP integer.
|
|
|
* mod Modulus. MP integer.
|
|
|
* res Result. MP integer.
|
|
|
- * returs 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
+ * returns 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
* and MEMORY_E if memory allocation fails.
|
|
|
*/
|
|
|
int sp_ModExp_2048(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|
@@ -2034,7 +2034,7 @@ static int sp_2048_mod_exp_2_32(sp_digit* r, const sp_digit* e, int bits,
|
|
|
* out Buffer to hold big-endian bytes of exponentiation result.
|
|
|
* Must be at least 256 bytes long.
|
|
|
* outLen Length, in bytes, of exponentiation result.
|
|
|
- * returs 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
+ * returns 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
* and MEMORY_E if memory allocation fails.
|
|
|
*/
|
|
|
int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
|
|
@@ -2099,7 +2099,7 @@ int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
|
|
|
* exp Exponent. MP integer.
|
|
|
* mod Modulus. MP integer.
|
|
|
* res Result. MP integer.
|
|
|
- * returs 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
+ * returns 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
* and MEMORY_E if memory allocation fails.
|
|
|
*/
|
|
|
int sp_ModExp_1024(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|
@@ -2487,7 +2487,7 @@ extern sp_digit sp_3072_sub_in_place_24(sp_digit* a, const sp_digit* b);
|
|
|
* Given m must be 3072 bits, just need to subtract.
|
|
|
*
|
|
|
* r A single precision number.
|
|
|
- * m A signle precision number.
|
|
|
+ * m A single precision number.
|
|
|
*/
|
|
|
static void sp_3072_mont_norm_24(sp_digit* r, const sp_digit* m)
|
|
|
{
|
|
@@ -2937,7 +2937,7 @@ static int sp_3072_mod_exp_avx2_24(sp_digit* r, const sp_digit* a, const sp_digi
|
|
|
* Given m must be 3072 bits, just need to subtract.
|
|
|
*
|
|
|
* r A single precision number.
|
|
|
- * m A signle precision number.
|
|
|
+ * m A single precision number.
|
|
|
*/
|
|
|
static void sp_3072_mont_norm_48(sp_digit* r, const sp_digit* m)
|
|
|
{
|
|
@@ -3864,7 +3864,7 @@ static int sp_3072_to_mp(const sp_digit* a, mp_int* r)
|
|
|
* exp Exponent. MP integer.
|
|
|
* mod Modulus. MP integer.
|
|
|
* res Result. MP integer.
|
|
|
- * returs 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
+ * returns 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
* and MEMORY_E if memory allocation fails.
|
|
|
*/
|
|
|
int sp_ModExp_3072(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|
@@ -4130,7 +4130,7 @@ static int sp_3072_mod_exp_2_48(sp_digit* r, const sp_digit* e, int bits,
|
|
|
* out Buffer to hold big-endian bytes of exponentiation result.
|
|
|
* Must be at least 384 bytes long.
|
|
|
* outLen Length, in bytes, of exponentiation result.
|
|
|
- * returs 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
+ * returns 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
* and MEMORY_E if memory allocation fails.
|
|
|
*/
|
|
|
int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
|
|
@@ -4195,7 +4195,7 @@ int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
|
|
|
* exp Exponent. MP integer.
|
|
|
* mod Modulus. MP integer.
|
|
|
* res Result. MP integer.
|
|
|
- * returs 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
+ * returns 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
* and MEMORY_E if memory allocation fails.
|
|
|
*/
|
|
|
int sp_ModExp_1536(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|
@@ -4544,7 +4544,7 @@ extern void sp_4096_mul_d_64(sp_digit* r, const sp_digit* a, sp_digit b);
|
|
|
* Given m must be 4096 bits, just need to subtract.
|
|
|
*
|
|
|
* r A single precision number.
|
|
|
- * m A signle precision number.
|
|
|
+ * m A single precision number.
|
|
|
*/
|
|
|
static void sp_4096_mont_norm_64(sp_digit* r, const sp_digit* m)
|
|
|
{
|
|
@@ -5471,7 +5471,7 @@ static int sp_4096_to_mp(const sp_digit* a, mp_int* r)
|
|
|
* exp Exponent. MP integer.
|
|
|
* mod Modulus. MP integer.
|
|
|
* res Result. MP integer.
|
|
|
- * returs 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
+ * returns 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
* and MEMORY_E if memory allocation fails.
|
|
|
*/
|
|
|
int sp_ModExp_4096(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|
@@ -5737,7 +5737,7 @@ static int sp_4096_mod_exp_2_64(sp_digit* r, const sp_digit* e, int bits,
|
|
|
* out Buffer to hold big-endian bytes of exponentiation result.
|
|
|
* Must be at least 512 bytes long.
|
|
|
* outLen Length, in bytes, of exponentiation result.
|
|
|
- * returs 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
+ * returns 0 on success, MP_READ_E if there are too many bytes in an array
|
|
|
* and MEMORY_E if memory allocation fails.
|
|
|
*/
|
|
|
int sp_DhExp_4096(mp_int* base, const byte* exp, word32 expLen,
|
|
@@ -6288,10 +6288,10 @@ static void sp_256_mont_inv_4(sp_digit* r, const sp_digit* a, sp_digit* td)
|
|
|
#endif /* WOLFSSL_SP_SMALL */
|
|
|
}
|
|
|
|
|
|
-/* Map the Montgomery form projective co-ordinate point to an affine point.
|
|
|
+/* Map the Montgomery form projective coordinate point to an affine point.
|
|
|
*
|
|
|
- * r Resulting affine co-ordinate point.
|
|
|
- * p Montgomery form projective co-ordinate point.
|
|
|
+ * r Resulting affine coordinate point.
|
|
|
+ * p Montgomery form projective coordinate point.
|
|
|
* t Temporary ordinate data.
|
|
|
*/
|
|
|
static void sp_256_map_4(sp_point* r, const sp_point* p, sp_digit* t)
|
|
@@ -6360,7 +6360,7 @@ static void sp_256_proj_point_dbl_4(sp_point* r, const sp_point* p, sp_digit* t)
|
|
|
x = rp[p->infinity]->x;
|
|
|
y = rp[p->infinity]->y;
|
|
|
z = rp[p->infinity]->z;
|
|
|
- /* Put point to double into result - good for infinty. */
|
|
|
+ /* Put point to double into result - good for infinity. */
|
|
|
if (r != p) {
|
|
|
for (i=0; i<4; i++) {
|
|
|
r->x[i] = p->x[i];
|
|
@@ -6505,7 +6505,7 @@ static int sp_256_cmp_equal_4(const sp_digit* a, const sp_digit* b)
|
|
|
/* Add two Montgomery form projective points.
|
|
|
*
|
|
|
* r Result of addition.
|
|
|
- * p Frist point to add.
|
|
|
+ * p First point to add.
|
|
|
* q Second point to add.
|
|
|
* t Temporary ordinate data.
|
|
|
*/
|
|
@@ -6669,7 +6669,7 @@ static void sp_256_proj_point_dbl_n_store_4(sp_point* r, const sp_point* p,
|
|
|
*
|
|
|
* ra Result of addition.
|
|
|
* rs Result of subtraction.
|
|
|
- * p Frist point to add.
|
|
|
+ * p First point to add.
|
|
|
* q Second point to add.
|
|
|
* t Temporary ordinate data.
|
|
|
*/
|
|
@@ -6773,7 +6773,7 @@ static const uint8_t recode_neg_4_6[66] = {
|
|
|
* subtraction.
|
|
|
*
|
|
|
* k Scalar to multiply by.
|
|
|
- * v Vector of operations to peform.
|
|
|
+ * v Vector of operations to perform.
|
|
|
*/
|
|
|
static void sp_256_ecc_recode_6_4(const sp_digit* k, ecc_recode* v)
|
|
|
{
|
|
@@ -6814,7 +6814,7 @@ static void sp_256_ecc_recode_6_4(const sp_digit* k, ecc_recode* v)
|
|
|
}
|
|
|
|
|
|
/* Multiply the point by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* g Point to multiply.
|
|
@@ -7029,10 +7029,10 @@ static void sp_256_mont_inv_avx2_4(sp_digit* r, const sp_digit* a, sp_digit* td)
|
|
|
#endif /* WOLFSSL_SP_SMALL */
|
|
|
}
|
|
|
|
|
|
-/* Map the Montgomery form projective co-ordinate point to an affine point.
|
|
|
+/* Map the Montgomery form projective coordinate point to an affine point.
|
|
|
*
|
|
|
- * r Resulting affine co-ordinate point.
|
|
|
- * p Montgomery form projective co-ordinate point.
|
|
|
+ * r Resulting affine coordinate point.
|
|
|
+ * p Montgomery form projective coordinate point.
|
|
|
* t Temporary ordinate data.
|
|
|
*/
|
|
|
static void sp_256_map_avx2_4(sp_point* r, const sp_point* p, sp_digit* t)
|
|
@@ -7096,7 +7096,7 @@ static void sp_256_proj_point_dbl_avx2_4(sp_point* r, const sp_point* p, sp_digi
|
|
|
x = rp[p->infinity]->x;
|
|
|
y = rp[p->infinity]->y;
|
|
|
z = rp[p->infinity]->z;
|
|
|
- /* Put point to double into result - good for infinty. */
|
|
|
+ /* Put point to double into result - good for infinity. */
|
|
|
if (r != p) {
|
|
|
for (i=0; i<4; i++) {
|
|
|
r->x[i] = p->x[i];
|
|
@@ -7229,7 +7229,7 @@ static void sp_256_proj_point_dbl_n_avx2_4(sp_point* r, const sp_point* p, int n
|
|
|
/* Add two Montgomery form projective points.
|
|
|
*
|
|
|
* r Result of addition.
|
|
|
- * p Frist point to add.
|
|
|
+ * p First point to add.
|
|
|
* q Second point to add.
|
|
|
* t Temporary ordinate data.
|
|
|
*/
|
|
@@ -7393,7 +7393,7 @@ static void sp_256_proj_point_dbl_n_store_avx2_4(sp_point* r, const sp_point* p,
|
|
|
*
|
|
|
* ra Result of addition.
|
|
|
* rs Result of subtraction.
|
|
|
- * p Frist point to add.
|
|
|
+ * p First point to add.
|
|
|
* q Second point to add.
|
|
|
* t Temporary ordinate data.
|
|
|
*/
|
|
@@ -7468,7 +7468,7 @@ static void sp_256_proj_point_add_sub_avx2_4(sp_point* ra, sp_point* rs,
|
|
|
}
|
|
|
|
|
|
/* Multiply the point by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* g Point to multiply.
|
|
@@ -7600,7 +7600,7 @@ typedef struct sp_table_entry {
|
|
|
* Only the first point can be the same pointer as the result point.
|
|
|
*
|
|
|
* r Result of addition.
|
|
|
- * p Frist point to add.
|
|
|
+ * p First point to add.
|
|
|
* q Second point to add.
|
|
|
* t Temporary ordinate data.
|
|
|
*/
|
|
@@ -7682,7 +7682,7 @@ static void sp_256_proj_point_add_qz1_4(sp_point* r, const sp_point* p,
|
|
|
* Ordinates are in Montgomery form.
|
|
|
*
|
|
|
* a Point to convert.
|
|
|
- * t Temprorary data.
|
|
|
+ * t Temporary data.
|
|
|
*/
|
|
|
static void sp_256_proj_to_affine_4(sp_point* a, sp_digit* t)
|
|
|
{
|
|
@@ -7704,7 +7704,7 @@ static void sp_256_proj_to_affine_4(sp_point* a, sp_digit* t)
|
|
|
*
|
|
|
* a The base point.
|
|
|
* table Place to store generated point data.
|
|
|
- * tmp Temprorary data.
|
|
|
+ * tmp Temporary data.
|
|
|
* heap Heap to use for allocation.
|
|
|
*/
|
|
|
static int sp_256_gen_stripe_table_4(const sp_point* a,
|
|
@@ -7784,7 +7784,7 @@ static int sp_256_gen_stripe_table_4(const sp_point* a,
|
|
|
#endif /* FP_ECC */
|
|
|
#if defined(FP_ECC) || defined(WOLFSSL_SP_SMALL)
|
|
|
/* Multiply the point by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* k Scalar to multiply by.
|
|
@@ -7947,7 +7947,7 @@ static void sp_ecc_get_cache(const sp_point* g, sp_cache_t** cache)
|
|
|
#endif /* FP_ECC */
|
|
|
|
|
|
/* Multiply the base point of P256 by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* g Point to multiply.
|
|
@@ -8005,7 +8005,7 @@ static int sp_256_ecc_mulmod_4(sp_point* r, const sp_point* g, const sp_digit* k
|
|
|
* Only the first point can be the same pointer as the result point.
|
|
|
*
|
|
|
* r Result of addition.
|
|
|
- * p Frist point to add.
|
|
|
+ * p First point to add.
|
|
|
* q Second point to add.
|
|
|
* t Temporary ordinate data.
|
|
|
*/
|
|
@@ -8087,7 +8087,7 @@ static void sp_256_proj_point_add_qz1_avx2_4(sp_point* r, const sp_point* p,
|
|
|
* Ordinates are in Montgomery form.
|
|
|
*
|
|
|
* a Point to convert.
|
|
|
- * t Temprorary data.
|
|
|
+ * t Temporary data.
|
|
|
*/
|
|
|
static void sp_256_proj_to_affine_avx2_4(sp_point* a, sp_digit* t)
|
|
|
{
|
|
@@ -8109,7 +8109,7 @@ static void sp_256_proj_to_affine_avx2_4(sp_point* a, sp_digit* t)
|
|
|
*
|
|
|
* a The base point.
|
|
|
* table Place to store generated point data.
|
|
|
- * tmp Temprorary data.
|
|
|
+ * tmp Temporary data.
|
|
|
* heap Heap to use for allocation.
|
|
|
*/
|
|
|
static int sp_256_gen_stripe_table_avx2_4(const sp_point* a,
|
|
@@ -8189,7 +8189,7 @@ static int sp_256_gen_stripe_table_avx2_4(const sp_point* a,
|
|
|
#endif /* FP_ECC */
|
|
|
#if defined(FP_ECC) || defined(WOLFSSL_SP_SMALL)
|
|
|
/* Multiply the point by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* k Scalar to multiply by.
|
|
@@ -8274,7 +8274,7 @@ static int sp_256_ecc_mulmod_stripe_avx2_4(sp_point* r, const sp_point* g,
|
|
|
|
|
|
#endif /* FP_ECC || WOLFSSL_SP_SMALL */
|
|
|
/* Multiply the base point of P256 by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* g Point to multiply.
|
|
@@ -8326,7 +8326,7 @@ static int sp_256_ecc_mulmod_avx2_4(sp_point* r, const sp_point* g, const sp_dig
|
|
|
|
|
|
#endif /* HAVE_INTEL_AVX2 */
|
|
|
/* Multiply the point by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* km Scalar to multiply by.
|
|
|
* p Point to multiply.
|
|
@@ -9668,7 +9668,7 @@ static const sp_table_entry p256_table[256] = {
|
|
|
};
|
|
|
|
|
|
/* Multiply the base point of P256 by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* k Scalar to multiply by.
|
|
@@ -9685,7 +9685,7 @@ static int sp_256_ecc_mulmod_base_4(sp_point* r, const sp_digit* k,
|
|
|
|
|
|
#ifdef HAVE_INTEL_AVX2
|
|
|
/* Multiply the base point of P256 by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* k Scalar to multiply by.
|
|
@@ -9732,7 +9732,7 @@ static const uint8_t recode_neg_4_7[130] = {
|
|
|
* subtraction.
|
|
|
*
|
|
|
* k Scalar to multiply by.
|
|
|
- * v Vector of operations to peform.
|
|
|
+ * v Vector of operations to perform.
|
|
|
*/
|
|
|
static void sp_256_ecc_recode_7_4(const sp_digit* k, ecc_recode* v)
|
|
|
{
|
|
@@ -21727,7 +21727,7 @@ static const sp_table_entry p256_table[2405] = {
|
|
|
};
|
|
|
|
|
|
/* Multiply the point by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* k Scalar to multiply by.
|
|
@@ -21808,7 +21808,7 @@ static int sp_256_ecc_mulmod_add_only_4(sp_point* r, const sp_point* g,
|
|
|
}
|
|
|
|
|
|
/* Multiply the base point of P256 by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* k Scalar to multiply by.
|
|
@@ -21825,7 +21825,7 @@ static int sp_256_ecc_mulmod_base_4(sp_point* r, const sp_digit* k,
|
|
|
|
|
|
#ifdef HAVE_INTEL_AVX2
|
|
|
/* Multiply the point by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* k Scalar to multiply by.
|
|
@@ -21906,7 +21906,7 @@ static int sp_256_ecc_mulmod_add_only_avx2_4(sp_point* r, const sp_point* g,
|
|
|
}
|
|
|
|
|
|
/* Multiply the base point of P256 by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* r Resulting point.
|
|
|
* k Scalar to multiply by.
|
|
@@ -21924,7 +21924,7 @@ static int sp_256_ecc_mulmod_base_avx2_4(sp_point* r, const sp_digit* k,
|
|
|
#endif /* HAVE_INTEL_AVX2 */
|
|
|
#endif /* WOLFSSL_SP_SMALL */
|
|
|
/* Multiply the base point of P256 by the scalar and return the result.
|
|
|
- * If map is true then convert result to affine co-ordinates.
|
|
|
+ * If map is true then convert result to affine coordinates.
|
|
|
*
|
|
|
* km Scalar to multiply by.
|
|
|
* r Resulting point.
|