mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* parse-packet.c (parse_key): Support a SHA1 checksum as per
draft-rfc2440-bis04. * packet.h (PKT_secret_key): Add field sha1chk. * seckey-cert.c (do_check): Check the SHA1 checksum (protect_secret_key): And create it. * build-packet.c (do_secret_key): Mark it as sha-1 protected. * g10.c, options.h: New option --simple-sk-checksum.
This commit is contained in:
parent
e906ef5f5b
commit
60e0b2ad92
8 changed files with 113 additions and 34 deletions
|
@ -1494,14 +1494,16 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||
if (rc) /* one of the MPIs were bad */
|
||||
goto leave;
|
||||
sk->protect.algo = iobuf_get_noeof(inp); pktlen--;
|
||||
sk->protect.sha1chk = 0;
|
||||
if( sk->protect.algo ) {
|
||||
sk->is_protected = 1;
|
||||
sk->protect.s2k.count = 0;
|
||||
if( sk->protect.algo == 255 ) {
|
||||
if( sk->protect.algo == 254 || sk->protect.algo == 255 ) {
|
||||
if( pktlen < 3 ) {
|
||||
rc = G10ERR_INVALID_PACKET;
|
||||
goto leave;
|
||||
}
|
||||
sk->protect.sha1chk = (sk->protect.algo == 254);
|
||||
sk->protect.algo = iobuf_get_noeof(inp); pktlen--;
|
||||
sk->protect.s2k.mode = iobuf_get_noeof(inp); pktlen--;
|
||||
sk->protect.s2k.hash_algo = iobuf_get_noeof(inp); pktlen--;
|
||||
|
@ -1550,8 +1552,10 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||
}
|
||||
|
||||
if( list_mode ) {
|
||||
printf(", algo: %d, hash: %d",
|
||||
printf(", algo: %d,%s hash: %d",
|
||||
sk->protect.algo,
|
||||
sk->protect.sha1chk? ""
|
||||
:" simple checksum,",
|
||||
sk->protect.s2k.hash_algo );
|
||||
if( sk->protect.s2k.mode == 1
|
||||
|| sk->protect.s2k.mode == 3 ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue