• Home
  • Raw
  • Download

Lines Matching refs:grp

174     MBEDTLS_MPI_CHK( mbedtls_ecp_check_budget( grp, ECDSA_RS_ECP, ops ) );
227 static int derive_mpi( const mbedtls_ecp_group *grp, mbedtls_mpi *x, in derive_mpi() argument
231 size_t n_size = ( grp->nbits + 7 ) / 8; in derive_mpi()
235 if( use_size * 8 > grp->nbits ) in derive_mpi()
236 MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( x, use_size * 8 - grp->nbits ) ); in derive_mpi()
239 if( mbedtls_mpi_cmp_mpi( x, &grp->N ) >= 0 ) in derive_mpi()
240 MBEDTLS_MPI_CHK( mbedtls_mpi_sub_mpi( x, x, &grp->N ) ); in derive_mpi()
252 static int ecdsa_sign_restartable( mbedtls_ecp_group *grp, in ecdsa_sign_restartable() argument
267 if( ! mbedtls_ecdsa_can_do( grp->id ) || grp->N.p == NULL ) in ecdsa_sign_restartable()
271 if( mbedtls_mpi_cmp_int( d, 1 ) < 0 || mbedtls_mpi_cmp_mpi( d, &grp->N ) >= 0 ) in ecdsa_sign_restartable()
318 MBEDTLS_MPI_CHK( mbedtls_ecp_gen_privkey( grp, pk, f_rng, p_rng ) ); in ecdsa_sign_restartable()
326 MBEDTLS_MPI_CHK( mbedtls_ecp_mul_restartable( grp, &R, pk, &grp->G, in ecdsa_sign_restartable()
330 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( pr, &R.X, &grp->N ) ); in ecdsa_sign_restartable()
349 MBEDTLS_MPI_CHK( derive_mpi( grp, &e, buf, blen ) ); in ecdsa_sign_restartable()
355 MBEDTLS_MPI_CHK( mbedtls_ecp_gen_privkey( grp, &t, f_rng_blind, in ecdsa_sign_restartable()
365 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( pk, pk, &grp->N ) ); in ecdsa_sign_restartable()
366 MBEDTLS_MPI_CHK( mbedtls_mpi_inv_mod( s, pk, &grp->N ) ); in ecdsa_sign_restartable()
368 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( s, s, &grp->N ) ); in ecdsa_sign_restartable()
403 int mbedtls_ecdsa_sign( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s, in mbedtls_ecdsa_sign() argument
407 ECDSA_VALIDATE_RET( grp != NULL ); in mbedtls_ecdsa_sign()
415 return( ecdsa_sign_restartable( grp, r, s, d, buf, blen, in mbedtls_ecdsa_sign()
424 static int ecdsa_sign_det_restartable( mbedtls_ecp_group *grp, in ecdsa_sign_det_restartable() argument
436 size_t grp_len = ( grp->nbits + 7 ) / 8; in ecdsa_sign_det_restartable()
462 MBEDTLS_MPI_CHK( derive_mpi( grp, &h, buf, blen ) ); in ecdsa_sign_det_restartable()
475 ret = mbedtls_ecdsa_sign( grp, r, s, d, buf, blen, in ecdsa_sign_det_restartable()
479 ret = ecdsa_sign_restartable( grp, r, s, d, buf, blen, in ecdsa_sign_det_restartable()
532 ret = ecdsa_sign_restartable( grp, r, s, d, buf, blen, in ecdsa_sign_det_restartable()
557 int mbedtls_ecdsa_sign_det( mbedtls_ecp_group *grp, mbedtls_mpi *r, in mbedtls_ecdsa_sign_det() argument
562 ECDSA_VALIDATE_RET( grp != NULL ); in mbedtls_ecdsa_sign_det()
568 return( ecdsa_sign_det_restartable( grp, r, s, d, buf, blen, md_alg, in mbedtls_ecdsa_sign_det()
573 int mbedtls_ecdsa_sign_det_ext( mbedtls_ecp_group *grp, mbedtls_mpi *r, in mbedtls_ecdsa_sign_det_ext() argument
581 ECDSA_VALIDATE_RET( grp != NULL ); in mbedtls_ecdsa_sign_det_ext()
588 return( ecdsa_sign_det_restartable( grp, r, s, d, buf, blen, md_alg, in mbedtls_ecdsa_sign_det_ext()
598 static int ecdsa_verify_restartable( mbedtls_ecp_group *grp, in ecdsa_verify_restartable() argument
614 if( ! mbedtls_ecdsa_can_do( grp->id ) || grp->N.p == NULL ) in ecdsa_verify_restartable()
635 if( mbedtls_mpi_cmp_int( r, 1 ) < 0 || mbedtls_mpi_cmp_mpi( r, &grp->N ) >= 0 || in ecdsa_verify_restartable()
636 mbedtls_mpi_cmp_int( s, 1 ) < 0 || mbedtls_mpi_cmp_mpi( s, &grp->N ) >= 0 ) in ecdsa_verify_restartable()
645 MBEDTLS_MPI_CHK( derive_mpi( grp, &e, buf, blen ) ); in ecdsa_verify_restartable()
652 MBEDTLS_MPI_CHK( mbedtls_mpi_inv_mod( &s_inv, s, &grp->N ) ); in ecdsa_verify_restartable()
655 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( pu1, pu1, &grp->N ) ); in ecdsa_verify_restartable()
658 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( pu2, pu2, &grp->N ) ); in ecdsa_verify_restartable()
669 MBEDTLS_MPI_CHK( mbedtls_ecp_muladd_restartable( grp, in ecdsa_verify_restartable()
670 &R, pu1, &grp->G, pu2, Q, ECDSA_RS_ECP ) ); in ecdsa_verify_restartable()
682 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( &R.X, &R.X, &grp->N ) ); in ecdsa_verify_restartable()
706 int mbedtls_ecdsa_verify( mbedtls_ecp_group *grp, in mbedtls_ecdsa_verify() argument
712 ECDSA_VALIDATE_RET( grp != NULL ); in mbedtls_ecdsa_verify()
718 return( ecdsa_verify_restartable( grp, buf, blen, Q, r, s, NULL ) ); in mbedtls_ecdsa_verify()
768 MBEDTLS_MPI_CHK( ecdsa_sign_det_restartable( &ctx->grp, &r, &s, &ctx->d, in mbedtls_ecdsa_write_signature_restartable()
777 MBEDTLS_MPI_CHK( mbedtls_ecdsa_sign( &ctx->grp, &r, &s, &ctx->d, in mbedtls_ecdsa_write_signature_restartable()
781 MBEDTLS_MPI_CHK( ecdsa_sign_restartable( &ctx->grp, &r, &s, &ctx->d, in mbedtls_ecdsa_write_signature_restartable()
887 if( ( ret = mbedtls_ecdsa_verify( &ctx->grp, hash, hlen, in mbedtls_ecdsa_read_signature_restartable()
891 if( ( ret = ecdsa_verify_restartable( &ctx->grp, hash, hlen, in mbedtls_ecdsa_read_signature_restartable()
920 ret = mbedtls_ecp_group_load( &ctx->grp, gid ); in mbedtls_ecdsa_genkey()
924 return( mbedtls_ecp_gen_keypair( &ctx->grp, &ctx->d, in mbedtls_ecdsa_genkey()
938 if( ( ret = mbedtls_ecp_group_copy( &ctx->grp, &key->grp ) ) != 0 || in mbedtls_ecdsa_from_keypair()