mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	Create ecp_group_copy() and use it
This commit is contained in:
		
							parent
							
								
									aa431613b3
								
							
						
					
					
						commit
						e09631b7c4
					
				@ -219,6 +219,17 @@ int ecp_is_zero( ecp_point *pt );
 | 
			
		||||
 */
 | 
			
		||||
int ecp_copy( ecp_point *P, const ecp_point *Q );
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief           Copy the contents of a group object
 | 
			
		||||
 *
 | 
			
		||||
 * \param dst       Destination group
 | 
			
		||||
 * \param src       Source group
 | 
			
		||||
 *
 | 
			
		||||
 * \return          0 if successful,
 | 
			
		||||
 *                  POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed
 | 
			
		||||
 */
 | 
			
		||||
int ecp_group_copy( ecp_group *dst, const ecp_group *src );
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * \brief           Import a non-zero point from two ASCII strings
 | 
			
		||||
 *
 | 
			
		||||
 | 
			
		||||
@ -181,6 +181,14 @@ cleanup:
 | 
			
		||||
    return( ret );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copy the contents of a group object
 | 
			
		||||
 */
 | 
			
		||||
int ecp_group_copy( ecp_group *dst, const ecp_group *src )
 | 
			
		||||
{
 | 
			
		||||
    return ecp_use_known_dp( dst, src->id );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Import a non-zero point from ASCII strings
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@ -152,9 +152,9 @@ int main( int argc, char *argv[] )
 | 
			
		||||
    printf( "  . Preparing verification context..." );
 | 
			
		||||
    fflush( stdout );
 | 
			
		||||
 | 
			
		||||
    if( ( ret = ecp_use_known_dp( &ctx_verify.grp, ctx_sign.grp.id ) ) != 0 )
 | 
			
		||||
    if( ( ret = ecp_group_copy( &ctx_verify.grp, &ctx_sign.grp ) ) != 0 )
 | 
			
		||||
    {
 | 
			
		||||
        printf( " failed\n  ! ecp_use_known_dp returned %d\n", ret );
 | 
			
		||||
        printf( " failed\n  ! ecp_group_copy returned %d\n", ret );
 | 
			
		||||
        goto exit;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user