diff options
author | Gilles Peskine <Gilles.Peskine@arm.com> | 2022-12-20 19:22:44 +0100 |
---|---|---|
committer | Gilles Peskine <Gilles.Peskine@arm.com> | 2022-12-20 19:55:51 +0100 |
commit | eb2e77f6170de7ae8738f0dfdbd261dbf6347006 (patch) | |
tree | 6841c70164fdc8cc4f00244fba6b0628cf845494 | |
parent | 1e2a4d4089f6e2e87d13868e62e2b0b2e02391b6 (diff) | |
download | mbedtls-eb2e77f6170de7ae8738f0dfdbd261dbf6347006.zip mbedtls-eb2e77f6170de7ae8738f0dfdbd261dbf6347006.tar.gz mbedtls-eb2e77f6170de7ae8738f0dfdbd261dbf6347006.tar.bz2 |
Document modulus representation selectors
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
-rw-r--r-- | library/bignum_mod.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/library/bignum_mod.h b/library/bignum_mod.h index bf00a36..9c2043d 100644 --- a/library/bignum_mod.h +++ b/library/bignum_mod.h @@ -87,12 +87,23 @@ #include "mbedtls/bignum.h" #endif -/* Skip 1 as it is slightly easier to accidentally pass to functions. */ +/** How residues associated with a modulus are represented. + * + * This also determines which fields of the modulus structure are valid and + * what their contents are (see #mbedtls_mpi_mod_modulus). + */ typedef enum { + /** Representation not chosen (makes the modulus structure invalid). */ MBEDTLS_MPI_MOD_REP_INVALID = 0, + /* Skip 1 as it is slightly easier to accidentally pass to functions. */ + /** Montgomery representation. */ MBEDTLS_MPI_MOD_REP_MONTGOMERY = 2, - MBEDTLS_MPI_MOD_REP_OPT_RED + /** TODO: document this. + * + * Residues are in canonical representation. + */ + MBEDTLS_MPI_MOD_REP_OPT_RED, } mbedtls_mpi_mod_rep_selector; /* Make mbedtls_mpi_mod_rep_selector and mbedtls_mpi_mod_ext_rep disjoint to @@ -124,7 +135,9 @@ typedef struct { mbedtls_mpi_mod_rep_selector int_rep; // selector to signal the active member of the union union rep { + /* if int_rep == #MBEDTLS_MPI_MOD_REP_MONTGOMERY */ mbedtls_mpi_mont_struct mont; + /* if int_rep == #MBEDTLS_MPI_MOD_REP_OPT_RED */ mbedtls_mpi_opt_red_struct ored; } rep; } mbedtls_mpi_mod_modulus; |