1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

See ChangeLog: Tue Jul 25 17:44:15 CEST 2000 Werner Koch

This commit is contained in:
Werner Koch 2000-07-25 15:38:12 +00:00
parent 0bf44b072c
commit b872ea2577
16 changed files with 493 additions and 238 deletions

View file

@ -58,29 +58,24 @@ pk_sign( int algo, MPI *data, MPI hash, MPI *skey )
/* make a sexp from skey */
if( algo == GCRY_PK_DSA ) {
s_skey = SEXP_CONS( SEXP_NEW( "private-key", 0 ),
gcry_sexp_vlist( SEXP_NEW( "dsa", 3 ),
gcry_sexp_new_name_mpi( "p", skey[0] ),
gcry_sexp_new_name_mpi( "q", skey[1] ),
gcry_sexp_new_name_mpi( "g", skey[2] ),
gcry_sexp_new_name_mpi( "y", skey[3] ),
gcry_sexp_new_name_mpi( "x", skey[4] ),
NULL ));
rc = gcry_sexp_build ( &s_skey, NULL,
"(private-key(dsa(p%m)(q%m)(g%m)(y%m)(x%m)))",
skey[0], skey[1], skey[2], skey[3], skey[4] );
}
else if( algo == GCRY_PK_ELG || algo == GCRY_PK_ELG_E ) {
s_skey = SEXP_CONS( SEXP_NEW( "private-key", 0 ),
gcry_sexp_vlist( SEXP_NEW( "elg", 3 ),
gcry_sexp_new_name_mpi( "p", skey[0] ),
gcry_sexp_new_name_mpi( "g", skey[1] ),
gcry_sexp_new_name_mpi( "y", skey[2] ),
gcry_sexp_new_name_mpi( "x", skey[3] ),
NULL ));
rc = gcry_sexp_build ( &s_skey, NULL,
"(private-key(elg(p%m)(g%m)(y%m)(x%m)))",
skey[0], skey[1], skey[2], skey[3] );
}
else
return GPGERR_PUBKEY_ALGO;
if ( rc )
BUG ();
/* put hash into a S-Exp s_hash */
s_hash = gcry_sexp_new_mpi( hash );
if ( gcry_sexp_build( &s_hash, NULL, "%m", hash ) )
BUG ();
rc = gcry_pk_sign( &s_sig, s_hash, s_skey );
gcry_sexp_release( s_hash );
@ -93,10 +88,13 @@ pk_sign( int algo, MPI *data, MPI hash, MPI *skey )
assert( list );
data[0] = gcry_sexp_cdr_mpi( list, 0 );
assert( data[0] );
gcry_sexp_release (list);
list = gcry_sexp_find_token( s_sig, "s" , 0 );
assert( list );
data[1] = gcry_sexp_cdr_mpi( list, 0 );
assert( data[1] );
gcry_sexp_release (list);
}