mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* g10.c, options.h: Removed option --emulate-checksum-bug.
* misc.c (checksum_u16_nobug): Removed. (checksum_u16): Removed the bug emulation. (checksum_mpi): Ditto. (checksum_mpi_counted_nbits): Removed and replaced all calls with checksum_mpi. * parse-packet.c (read_protected_v3_mpi): New. (parse_key): Use it here to store it as an opaque MPI. * seckey-cert.c (do_check): Changed the v3 unprotection to the new why to store these keys. (protect_secret_key): Likewise. * build-packet.c (do_secret_key): And changed the writing.
This commit is contained in:
parent
c30d7e8dc7
commit
c5445cc323
10 changed files with 152 additions and 126 deletions
|
@ -390,7 +390,7 @@ do_secret_key( IOBUF out, int ctb, PKT_secret_key *sk )
|
|||
iobuf_put(a, sk->protect.algo );
|
||||
if( sk->protect.s2k.mode >= 1000 ) {
|
||||
/* These modes are not possible in OpenPGP, we use them
|
||||
to implement our extesnsions, 101 can ve views as a
|
||||
to implement our extensions, 101 can be seen as a
|
||||
private/experimental extension (this is not
|
||||
specified in rfc2440 but the same scheme is used
|
||||
for all other algorithm identifiers) */
|
||||
|
@ -426,8 +426,20 @@ do_secret_key( IOBUF out, int ctb, PKT_secret_key *sk )
|
|||
p = mpi_get_opaque( sk->skey[npkey], &i );
|
||||
iobuf_write(a, p, i );
|
||||
}
|
||||
else if( sk->is_protected ) {
|
||||
/* The secret key is protected te old v4 way. */
|
||||
for( ; i < nskey; i++ ) {
|
||||
byte *p;
|
||||
int ndata;
|
||||
|
||||
assert (mpi_is_opaque (sk->skey[i]));
|
||||
p = mpi_get_opaque (sk->skey[i], &ndata);
|
||||
iobuf_write (a, p, ndata);
|
||||
}
|
||||
write_16(a, sk->csum );
|
||||
}
|
||||
else {
|
||||
/* v3 way - same code for protected and non- protected key */
|
||||
/* non-protected key */
|
||||
for( ; i < nskey; i++ )
|
||||
mpi_write(a, sk->skey[i] );
|
||||
write_16(a, sk->csum );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue