Cryptography Reference
In-Depth Information
set_huge( &w, 0 );
copy_huge( &w, &signature->s );
inv( &w, &params->n );
// z is the L_n leftmost bits of hash - cannot be longer than n
load_huge( &z, ( unsigned char * ) hash,
( ( hash_len * 4 ) < params->n.size ) ? ( hash_len * 4 ) : params->n.size );
// u1 = zw % n
multiply( &z, &w );
divide( &z, &params->n, NULL ); // u1 = z
// u2 = (rw) % q
multiply( &w, &signature->r );
divide( &w, &params->n, NULL ); // u2 = w
// (x1,y1) = u1 * G + u2 * Q
set_huge( &G.x, 0 );
set_huge( &G.y, 0 );
set_huge( &Q.x, 0 );
set_huge( &Q.y, 0 );
copy_huge( &G.x, &params->G.x );
copy_huge( &G.y, &params->G.y );
copy_huge( &Q.x, &public_key->x );
copy_huge( &Q.y, &public_key->y );
multiply_point( &G, &z, &params->a, &params->p );
multiply_point( &Q, &w, &params->a, &params->p );
add_points( &G, &Q, &params->p );
// r = x1 % n
divide( &G.x, &params->n, NULL );
match = !compare( &G.x, &signature->r );
free_huge( &z );
free_huge( &w );
free_huge( &G.x );
free_huge( &G.y );
free_huge( &Q.x );
free_huge( &Q.y );
return match;
}
Here, as in signature generation, modular exponentiation has been replaced
with elliptic-curve addition and multiplication operations.
Search WWH ::




Custom Search