1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

added more stuff

This commit is contained in:
Werner Koch 1998-01-02 20:40:10 +00:00
parent 4d2636eafe
commit b7bdef0834
23 changed files with 639 additions and 224 deletions

View file

@ -65,6 +65,7 @@ check_elg( PKT_secret_cert *cert )
unsigned nbytes;
u32 keyid[2];
ELG_secret_key skey;
char save_iv[8];
if( cert->d.elg.is_protected ) { /* remove the protection */
DEK *dek = NULL;
@ -80,6 +81,7 @@ check_elg( PKT_secret_cert *cert )
blowfish_setkey( blowfish_ctx, dek->key, dek->keylen );
m_free(dek); /* pw is in secure memory, so m_free() burns it */
blowfish_setiv( blowfish_ctx, NULL );
memcpy(save_iv, cert->d.elg.protect.blowfish.iv, 8 );
blowfish_decode_cfb( blowfish_ctx,
cert->d.elg.protect.blowfish.iv,
cert->d.elg.protect.blowfish.iv, 8 );
@ -94,6 +96,7 @@ check_elg( PKT_secret_cert *cert )
/* now let's see wether we have used the right passphrase */
if( csum != cert->d.elg.csum ) {
mpi_free(test_x);
memcpy( cert->d.elg.protect.blowfish.iv, save_iv, 8 );
return G10ERR_BAD_PASS;
}
@ -105,6 +108,7 @@ check_elg( PKT_secret_cert *cert )
memset( &skey, 0, sizeof skey );
if( !res ) {
mpi_free(test_x);
memcpy( cert->d.elg.protect.blowfish.iv, save_iv, 8 );
return G10ERR_BAD_PASS;
}
mpi_set(cert->d.elg.x, test_x);
@ -274,6 +278,8 @@ check_secret_key( PKT_secret_cert *cert )
#endif
else
rc = G10ERR_PUBKEY_ALGO;
if( get_passphrase_fd() != -1 )
break;
}
return rc;
}