Lines Matching refs:N

587     ecp_mpi_load( &grp->N, n, nlen );  in ecp_group_load()
594 grp->nbits = mbedtls_mpi_bitlen( &grp->N ); in ecp_group_load()
823 #define A( i ) N->p + i * WIDTH
831 static int ecp_mod_p192( mbedtls_mpi *N ) in ecp_mod_p192() argument
838 MBEDTLS_MPI_CHK( mbedtls_mpi_grow( N, 6 * WIDTH ) ); in ecp_mod_p192()
840 p = N->p; in ecp_mod_p192()
841 end = p + N->n; in ecp_mod_p192()
881 #define MAX32 N->n
882 #define A( j ) N->p[j]
883 #define STORE32 N->p[i] = cur;
887 #define MAX32 N->n * 2
888 #define A( j ) j % 2 ? (uint32_t)( N->p[j/2] >> 32 ) : (uint32_t)( N->p[j/2] )
891 N->p[i/2] &= 0x00000000FFFFFFFF; \
892 N->p[i/2] |= ((mbedtls_mpi_uint) cur) << 32; \
894 N->p[i/2] &= 0xFFFFFFFF00000000; \
895 N->p[i/2] |= (mbedtls_mpi_uint) cur; \
935 MBEDTLS_MPI_CHK( mbedtls_mpi_grow( N, b * 2 / 8 / sizeof( mbedtls_mpi_uint ) ) ); \
950 if( c < 0 ) fix_negative( N, c, &C, bits );
956 static inline int fix_negative( mbedtls_mpi *N, signed char c, mbedtls_mpi *C, size_t bits ) in fix_negative() argument
971 MBEDTLS_MPI_CHK( mbedtls_mpi_sub_abs( N, C, N ) ); in fix_negative()
972 N->s = -1; in fix_negative()
983 static int ecp_mod_p224( mbedtls_mpi *N ) in ecp_mod_p224() argument
1004 static int ecp_mod_p256( mbedtls_mpi *N ) in ecp_mod_p256() argument
1041 static int ecp_mod_p384( mbedtls_mpi *N ) in ecp_mod_p384() argument
1114 static int ecp_mod_p521( mbedtls_mpi *N ) in ecp_mod_p521() argument
1124 if( N->n < P521_WIDTH ) in ecp_mod_p521()
1129 M.n = N->n - ( P521_WIDTH - 1 ); in ecp_mod_p521()
1133 memcpy( Mp, N->p + P521_WIDTH - 1, M.n * sizeof( mbedtls_mpi_uint ) ); in ecp_mod_p521()
1137 N->p[P521_WIDTH - 1] &= P521_MASK; in ecp_mod_p521()
1138 for( i = P521_WIDTH; i < N->n; i++ ) in ecp_mod_p521()
1139 N->p[i] = 0; in ecp_mod_p521()
1142 MBEDTLS_MPI_CHK( mbedtls_mpi_add_abs( N, N, &M ) ); in ecp_mod_p521()
1163 static int ecp_mod_p255( mbedtls_mpi *N ) in ecp_mod_p255() argument
1170 if( N->n < P255_WIDTH ) in ecp_mod_p255()
1175 M.n = N->n - ( P255_WIDTH - 1 ); in ecp_mod_p255()
1180 memcpy( Mp, N->p + P255_WIDTH - 1, M.n * sizeof( mbedtls_mpi_uint ) ); in ecp_mod_p255()
1185 MBEDTLS_MPI_CHK( mbedtls_mpi_set_bit( N, 255, 0 ) ); in ecp_mod_p255()
1186 for( i = P255_WIDTH; i < N->n; i++ ) in ecp_mod_p255()
1187 N->p[i] = 0; in ecp_mod_p255()
1191 MBEDTLS_MPI_CHK( mbedtls_mpi_add_abs( N, N, &M ) ); in ecp_mod_p255()
1210 static inline int ecp_mod_koblitz( mbedtls_mpi *N, mbedtls_mpi_uint *Rp, size_t p_limbs, in ecp_mod_koblitz() argument
1218 if( N->n < p_limbs ) in ecp_mod_koblitz()
1231 M.n = N->n - ( p_limbs - adjust ); in ecp_mod_koblitz()
1235 memcpy( Mp, N->p + p_limbs - adjust, M.n * sizeof( mbedtls_mpi_uint ) ); in ecp_mod_koblitz()
1242 N->p[p_limbs - 1] &= mask; in ecp_mod_koblitz()
1243 for( i = p_limbs; i < N->n; i++ ) in ecp_mod_koblitz()
1244 N->p[i] = 0; in ecp_mod_koblitz()
1248 MBEDTLS_MPI_CHK( mbedtls_mpi_add_abs( N, N, &M ) ); in ecp_mod_koblitz()
1253 M.n = N->n - ( p_limbs - adjust ); in ecp_mod_koblitz()
1257 memcpy( Mp, N->p + p_limbs - adjust, M.n * sizeof( mbedtls_mpi_uint ) ); in ecp_mod_koblitz()
1264 N->p[p_limbs - 1] &= mask; in ecp_mod_koblitz()
1265 for( i = p_limbs; i < N->n; i++ ) in ecp_mod_koblitz()
1266 N->p[i] = 0; in ecp_mod_koblitz()
1270 MBEDTLS_MPI_CHK( mbedtls_mpi_add_abs( N, N, &M ) ); in ecp_mod_koblitz()
1284 static int ecp_mod_p192k1( mbedtls_mpi *N ) in ecp_mod_p192k1() argument
1289 return( ecp_mod_koblitz( N, Rp, 192 / 8 / sizeof( mbedtls_mpi_uint ), 0, 0, 0 ) ); in ecp_mod_p192k1()
1298 static int ecp_mod_p224k1( mbedtls_mpi *N ) in ecp_mod_p224k1() argument
1304 return( ecp_mod_koblitz( N, Rp, 4, 1, 32, 0xFFFFFFFF ) ); in ecp_mod_p224k1()
1306 return( ecp_mod_koblitz( N, Rp, 224 / 8 / sizeof( mbedtls_mpi_uint ), 0, 0, 0 ) ); in ecp_mod_p224k1()
1317 static int ecp_mod_p256k1( mbedtls_mpi *N ) in ecp_mod_p256k1() argument
1321 return( ecp_mod_koblitz( N, Rp, 256 / 8 / sizeof( mbedtls_mpi_uint ), 0, 0, 0 ) ); in ecp_mod_p256k1()