Lines Matching refs:ctx

21     mbedtls_rsa_context ctx;
28 mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V21, hash );
33 ctx.len = mod / 8 + ( ( mod % 8 ) ? 1 : 0 );
34 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.N, radix_N, input_N ) == 0 );
35 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.E, radix_E, input_E ) == 0 );
37 TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
41 …TEST_ASSERT( mbedtls_rsa_pkcs1_encrypt( &ctx, &rnd_buffer_rand, &info, MBEDTLS_RSA_PUBLIC, msg_len…
44 hexify( output_str, output, ctx.len );
50 mbedtls_rsa_free( &ctx );
64 mbedtls_rsa_context ctx;
71 mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V21, hash );
78 ctx.len = mod / 8 + ( ( mod % 8 ) ? 1 : 0 );
79 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.P, radix_P, input_P ) == 0 );
80 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.Q, radix_Q, input_Q ) == 0 );
81 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.N, radix_N, input_N ) == 0 );
82 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.E, radix_E, input_E ) == 0 );
84 TEST_ASSERT( mbedtls_mpi_sub_int( &P1, &ctx.P, 1 ) == 0 );
85 TEST_ASSERT( mbedtls_mpi_sub_int( &Q1, &ctx.Q, 1 ) == 0 );
87 TEST_ASSERT( mbedtls_mpi_gcd( &G, &ctx.E, &H ) == 0 );
88 TEST_ASSERT( mbedtls_mpi_inv_mod( &ctx.D , &ctx.E, &H ) == 0 );
89 TEST_ASSERT( mbedtls_mpi_mod_mpi( &ctx.DP, &ctx.D, &P1 ) == 0 );
90 TEST_ASSERT( mbedtls_mpi_mod_mpi( &ctx.DQ, &ctx.D, &Q1 ) == 0 );
91 TEST_ASSERT( mbedtls_mpi_inv_mod( &ctx.QP, &ctx.Q, &ctx.P ) == 0 );
93 TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
97 …TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx, &rnd_pseudo_rand, &rnd_info, MBEDTLS_RSA_PRIVATE, &o…
100 hexify( output_str, output, ctx.len );
107 mbedtls_rsa_free( &ctx );
123 mbedtls_rsa_context ctx;
132 mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V21, hash );
139 ctx.len = mod / 8 + ( ( mod % 8 ) ? 1 : 0 );
140 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.P, radix_P, input_P ) == 0 );
141 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.Q, radix_Q, input_Q ) == 0 );
142 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.N, radix_N, input_N ) == 0 );
143 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.E, radix_E, input_E ) == 0 );
145 TEST_ASSERT( mbedtls_mpi_sub_int( &P1, &ctx.P, 1 ) == 0 );
146 TEST_ASSERT( mbedtls_mpi_sub_int( &Q1, &ctx.Q, 1 ) == 0 );
148 TEST_ASSERT( mbedtls_mpi_gcd( &G, &ctx.E, &H ) == 0 );
149 TEST_ASSERT( mbedtls_mpi_inv_mod( &ctx.D , &ctx.E, &H ) == 0 );
150 TEST_ASSERT( mbedtls_mpi_mod_mpi( &ctx.DP, &ctx.D, &P1 ) == 0 );
151 TEST_ASSERT( mbedtls_mpi_mod_mpi( &ctx.DQ, &ctx.D, &Q1 ) == 0 );
152 TEST_ASSERT( mbedtls_mpi_inv_mod( &ctx.QP, &ctx.Q, &ctx.P ) == 0 );
154 TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
161 …TEST_ASSERT( mbedtls_rsa_pkcs1_sign( &ctx, &rnd_buffer_rand, &info, MBEDTLS_RSA_PRIVATE, digest, 0…
164 hexify( output_str, output, ctx.len);
171 mbedtls_rsa_free( &ctx );
184 mbedtls_rsa_context ctx;
188 mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V21, hash );
193 ctx.len = mod / 8 + ( ( mod % 8 ) ? 1 : 0 );
194 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.N, radix_N, input_N ) == 0 );
195 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.E, radix_E, input_E ) == 0 );
197 TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
205 …TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC, digest, 0, hash_resul…
208 mbedtls_rsa_free( &ctx );
226 mbedtls_rsa_context ctx;
229 mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V21, ctx_hash );
234 ctx.len = mod / 8 + ( ( mod % 8 ) ? 1 : 0 );
235 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.N, radix_N, input_N ) == 0 );
236 TEST_ASSERT( mbedtls_mpi_read_string( &ctx.E, radix_E, input_E ) == 0 );
238 TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
255 TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC,
259 TEST_ASSERT( mbedtls_rsa_rsassa_pss_verify_ext( &ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC,
265 mbedtls_rsa_free( &ctx );