From eed2faab53f859c98bf85f1e324614da640bf3ff Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 26 May 1998 13:38:00 +0000 Subject: [PATCH] add-key works --- AUTHORS | 8 + ChangeLog | 4 + NEWS | 16 + TODO | 3 +- VERSION | 2 +- checks/ChangeLog | 6 + checks/Makefile.am | 8 +- cipher/ChangeLog | 8 + cipher/cipher.c | 41 ++- cipher/md.c | 33 +- cipher/rand-unix.c | 2 +- doc/DETAILS | 27 ++ g10/ChangeLog | 32 ++ g10/armor.c | 9 +- g10/build-packet.c | 2 + g10/compress.c | 6 + g10/encode.c | 24 +- g10/g10.c | 5 +- g10/gpgd.c | 7 +- g10/import.c | 25 +- g10/keydb.h | 2 + g10/keyedit.c | 63 +++- g10/keygen.c | 399 +++++++++++++++++---- g10/ks-proto.c | 246 +++++++++++++ g10/packet.h | 3 +- g10/passphrase.c | 43 ++- g10/plaintext.c | 3 +- g10/revoke.c | 2 +- g10/seckey-cert.c | 12 +- g10/sign.c | 12 +- include/ChangeLog | 8 + include/cipher.h | 9 +- mpi/ChangeLog | 6 + mpi/Makefile.am | 5 +- mpi/Makefile.in | 5 +- mpi/alpha/distfiles | 7 +- mpi/alpha/mpih-add1.S | 8 - mpi/alpha/{mpih-shift.S => mpih-lshift.S} | 93 +---- mpi/alpha/mpih-mul1.S | 89 +++++ mpi/alpha/mpih-mul2.S | 96 +++++ mpi/alpha/mpih-mul3.S | 94 +++++ mpi/alpha/mpih-rshift.S | 120 +++++++ mpi/alpha/mpih-sub1.S | 123 +++++++ mpi/config.links | 2 +- mpi/generic/distfiles | 3 +- mpi/hppa/distfiles | 3 +- mpi/hppa/{mpih-shift.S => mpih-lshift.S} | 58 +-- mpi/hppa/mpih-rshift.S | 68 ++++ mpi/i386/distfiles | 3 +- mpi/i386/mpih-lshift.S | 96 +++++ mpi/i386/{mpih-shift.S => mpih-rshift.S} | 64 +--- mpi/i586/distfiles | 3 +- mpi/i586/mpih-lshift.S | 230 ++++++++++++ mpi/i586/{mpih-shift.S => mpih-rshift.S} | 199 +--------- mpi/m68k/distfiles | 3 +- mpi/m68k/{mpih-shift.S => mpih-lshift.S} | 142 +------- mpi/m68k/mpih-rshift.S | 156 ++++++++ mpi/pa7100/distfiles | 3 +- mpi/pa7100/{mpih-shift.S => mpih-lshift.S} | 71 +--- mpi/pa7100/mpih-rshift.S | 85 +++++ mpi/sparc32/distfiles | 2 + mpi/sparc32/mpih-add1.S | 41 +-- mpi/sparc32/mpih-lshift.S | 96 +++++ mpi/sparc32/mpih-rshift.S | 92 +++++ tools/ChangeLog | 4 + tools/Makefile.am | 3 +- tools/Makefile.in | 18 +- tools/mk-tdata | Bin 0 -> 35307 bytes zlib/Makefile | 2 +- 69 files changed, 2342 insertions(+), 821 deletions(-) create mode 100644 checks/ChangeLog rename mpi/alpha/{mpih-shift.S => mpih-lshift.S} (64%) create mode 100644 mpi/alpha/mpih-mul1.S create mode 100644 mpi/alpha/mpih-mul2.S create mode 100644 mpi/alpha/mpih-mul3.S create mode 100644 mpi/alpha/mpih-rshift.S create mode 100644 mpi/alpha/mpih-sub1.S rename mpi/hppa/{mpih-shift.S => mpih-lshift.S} (53%) create mode 100644 mpi/hppa/mpih-rshift.S create mode 100644 mpi/i386/mpih-lshift.S rename mpi/i386/{mpih-shift.S => mpih-rshift.S} (66%) create mode 100644 mpi/i586/mpih-lshift.S rename mpi/i586/{mpih-shift.S => mpih-rshift.S} (57%) rename mpi/m68k/{mpih-shift.S => mpih-lshift.S} (52%) create mode 100644 mpi/m68k/mpih-rshift.S rename mpi/pa7100/{mpih-shift.S => mpih-lshift.S} (56%) create mode 100644 mpi/pa7100/mpih-rshift.S create mode 100644 mpi/sparc32/mpih-lshift.S create mode 100644 mpi/sparc32/mpih-rshift.S create mode 100755 tools/mk-tdata diff --git a/AUTHORS b/AUTHORS index e69de29bb..86dab482b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -0,0 +1,8 @@ +Authors of GNU Privacy Guard (gnupg). + +Werner Koch. Designed and implemented gnupg. + + +TRANSLATIONS Marco d'Itri 1997-02-22 +Disclaim + diff --git a/ChangeLog b/ChangeLog index 4cb043e34..01026b786 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon May 25 19:10:59 1998 Werner Koch (wk@isil.d.shuttle.de) + + * rand-unix.c (fast_random_poll): fixed syntax bug. + Mon May 11 10:21:31 1998 Werner Koch (wk@isil.d.shuttle.de) * configure.in (PRINTABLE_OS_NAME): Linux is now GNU/Linux diff --git a/NEWS b/NEWS index b6ebc6574..2b931cb50 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,19 @@ +Noteworthy changes in version 0.2.19 +------------------------------------ + + * Replaced /dev/urandom in checks with new tool mk-tdata. + + * Some assembler file cleanups; some more functions for the Alpha. + + * Tiger has now the OpenPGP assigned number 6. Because the OID has + changed, old signatures using this algorithm can't be verified. + + * gnupg now encrypts the compressed packed and not any longer in the + reverse order; anyway it can decrypt both versions. Thanks to Tom + for telling me this (not security related) bug. + + * --add-key works and you are now able to generate subkeys. + Noteworthy changes in version 0.2.18 ------------------------------------ diff --git a/TODO b/TODO index f31cbaa97..33bd1942c 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,6 @@ - * make --add-key work (to add an ElGamal key to a DSA key). + * add usage arguments to get_key_byname or return a PKC_LIST with + all keys and add a selection. * add readline support. Must enhance libreadline - Anyone? diff --git a/VERSION b/VERSION index 51e8fdc95..8b56c0a9f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.18 +0.2.18a diff --git a/checks/ChangeLog b/checks/ChangeLog new file mode 100644 index 000000000..d0bcf614b --- /dev/null +++ b/checks/ChangeLog @@ -0,0 +1,6 @@ +Mon May 18 15:40:02 1998 Werner Koch (wk@isil.d.shuttle.de) + + * Makefile.am: Now uses mk-tdata to produce random test data. + + * ChangeLog: New. + diff --git a/checks/Makefile.am b/checks/Makefile.am index b00dd1aab..654922bdc 100644 --- a/checks/Makefile.am +++ b/checks/Makefile.am @@ -42,12 +42,12 @@ secring.skr: secring.skr.asc ../g10/gpgm --yes --dearmor -o secring.skr secring.skr.asc data-500: - head -c 500 /dev/urandom >data-500 + ../tools/mk-tdata 500 /dev/urandom >data-500 data-9000: - head -c 9000 /dev/urandom >data-9000 + ../tools/mk-tdata 9000 /dev/urandom >data-9000 data-32000: - head -c 32000 /dev/urandom >data-32000 + ../tools/mk-tdata 32000 /dev/urandom >data-32000 data-80000: - head -c 80000 /dev/urandom >data-80000 + ../tools/mk-tdata 80000 /dev/urandom >data-80000 diff --git a/cipher/ChangeLog b/cipher/ChangeLog index f72c64f4b..5e37e8f1a 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,11 @@ +Fri May 22 07:30:39 1998 Werner Koch (wk@isil.d.shuttle.de) + + * md.c (md_get_oid): Add a new one for TIGER. + +Thu May 21 13:24:52 1998 Werner Koch (wk@isil.d.shuttle.de) + + * cipher.c: Add support for a dummy cipher + Thu May 14 15:40:36 1998 Werner Koch (wk@isil.d.shuttle.de) * rmd160.c (transform): fixed sigbus - I should better diff --git a/cipher/cipher.c b/cipher/cipher.c index f449a99b5..3f1d19924 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -46,10 +46,10 @@ static struct { const char *name; int algo; int keylen; } cipher_names[] = { { "3DES", CIPHER_ALGO_3DES ,0 }, { "CAST", CIPHER_ALGO_CAST ,128 }, { "BLOWFISH160", CIPHER_ALGO_BLOWFISH160 ,160 }, - { "ROT_N", CIPHER_ALGO_ROT_N ,0 }, { "SAFER_SK128", CIPHER_ALGO_SAFER_SK128 ,0 }, { "DES_SK", CIPHER_ALGO_DES_SK ,0 }, { "BLOWFISH", CIPHER_ALGO_BLOWFISH ,128 }, + { "DUMMY" , CIPHER_ALGO_DUMMY ,128 }, {NULL} }; @@ -76,6 +76,14 @@ struct cipher_handle_s { }; +static void +dummy_setkey( void *c, byte *key, unsigned keylen ) { } +static void +dummy_encrypt_block( void *c, byte *outbuf, byte *inbuf ) { BUG(); } +static void +dummy_decrypt_block( void *c, byte *outbuf, byte *inbuf ) { BUG(); } + + /**************** * Map a string to the cipher algo */ @@ -115,6 +123,7 @@ check_cipher_algo( int algo ) case CIPHER_ALGO_BLOWFISH160: case CIPHER_ALGO_BLOWFISH: case CIPHER_ALGO_CAST: + case CIPHER_ALGO_DUMMY: return 0; default: return G10ERR_CIPHER_ALGO; @@ -154,7 +163,9 @@ cipher_open( int algo, int mode, int secure ) hd = secure ? m_alloc_secure_clear( sizeof *hd ) : m_alloc_clear( sizeof *hd ); hd->algo = algo; - if( mode == CIPHER_MODE_AUTO_CFB ) { + if( algo == CIPHER_ALGO_DUMMY ) + hd->mode = CIPHER_MODE_DUMMY; + else if( mode == CIPHER_MODE_AUTO_CFB ) { if( algo != CIPHER_ALGO_BLOWFISH160 ) hd->mode = CIPHER_MODE_PHILS_CFB; else @@ -176,6 +187,12 @@ cipher_open( int algo, int mode, int secure ) hd->decrypt = FNCCAST_CRYPT(cast5_decrypt_block); break; + case CIPHER_ALGO_DUMMY: + hd->setkey = FNCCAST_SETKEY(dummy_setkey); + hd->encrypt = FNCCAST_CRYPT(dummy_encrypt_block); + hd->decrypt = FNCCAST_CRYPT(dummy_decrypt_block); + break; + default: log_fatal("cipher_open: invalid algo %d\n", algo ); } @@ -217,8 +234,8 @@ do_ecb_encrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nblocks ) for(n=0; n < nblocks; n++ ) { (*c->encrypt)( &c->c.context, outbuf, inbuf ); - inbuf += CAST5_BLOCKSIZE;; - outbuf += CAST5_BLOCKSIZE; + inbuf += STD_BLOCKSIZE;; + outbuf += STD_BLOCKSIZE; } } @@ -229,8 +246,8 @@ do_ecb_decrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nblocks ) for(n=0; n < nblocks; n++ ) { (*c->decrypt)( &c->c.context, outbuf, inbuf ); - inbuf += CAST5_BLOCKSIZE;; - outbuf += CAST5_BLOCKSIZE; + inbuf += STD_BLOCKSIZE;; + outbuf += STD_BLOCKSIZE; } } @@ -397,6 +414,10 @@ cipher_encrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nbytes ) case CIPHER_MODE_PHILS_CFB: do_cfb_encrypt(c, outbuf, inbuf, nbytes ); break; + case CIPHER_MODE_DUMMY: + if( inbuf != outbuf ) + memmove( outbuf, inbuf, nbytes ); + break; default: log_fatal("cipher_encrypt: invalid mode %d\n", c->mode ); } } @@ -419,6 +440,10 @@ cipher_decrypt( CIPHER_HANDLE c, byte *outbuf, byte *inbuf, unsigned nbytes ) case CIPHER_MODE_PHILS_CFB: do_cfb_decrypt(c, outbuf, inbuf, nbytes ); break; + case CIPHER_MODE_DUMMY: + if( inbuf != outbuf ) + memmove( outbuf, inbuf, nbytes ); + break; default: log_fatal("cipher_decrypt: invalid mode %d\n", c->mode ); } } @@ -433,8 +458,8 @@ void cipher_sync( CIPHER_HANDLE c ) { if( c->mode == CIPHER_MODE_PHILS_CFB && c->unused ) { - memmove(c->iv + c->unused, c->iv, CAST5_BLOCKSIZE - c->unused ); - memcpy(c->iv, c->lastiv + CAST5_BLOCKSIZE - c->unused, c->unused); + memmove(c->iv + c->unused, c->iv, STD_BLOCKSIZE - c->unused ); + memcpy(c->iv, c->lastiv + STD_BLOCKSIZE - c->unused, c->unused); c->unused = 0; } } diff --git a/cipher/md.c b/cipher/md.c index 87e66d995..4341b3968 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -216,35 +216,48 @@ md_digest_length( int algo ) } +/* fixme: put the oids in a table and add a mode to enumerate the OIDs + * to make g10/sig-check.c more portable */ const byte * md_asn_oid( int algo, size_t *asnlen, size_t *mdlen ) { - size_t alen, mlen; + size_t alen; byte *p; if( algo == DIGEST_ALGO_MD5 ) { static byte asn[18] = /* Object ID is 1.2.840.113549.2.5 */ { 0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86,0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 }; - mlen = 16; alen = DIM(asn); p = asn; + alen = DIM(asn); p = asn; } else if( algo == DIGEST_ALGO_RMD160 ) { static byte asn[15] = /* Object ID is 1.3.36.3.2.1 */ { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x24, 0x03, 0x02, 0x01, 0x05, 0x00, 0x04, 0x14 }; - mlen = 20; alen = DIM(asn); p = asn; + alen = DIM(asn); p = asn; } else if( algo == DIGEST_ALGO_TIGER ) { - static byte asn[15] = /* FIXME: Object ID is ???????????? */ - { 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x42 }; - mlen = 24; alen = DIM(asn); p = asn; + /* 40: SEQUENCE { + * 12: SEQUENCE { + * 8: OCTET STRING :54 49 47 45 52 31 39 32 + * 0: NULL + * : } + * 24: OCTET STRING + * : } + * + * By replacing the 5th byte (0x04) with 0x16 we would have; + * 8: IA5String 'TIGER192' + */ + static byte asn[18] = + { 0x30, 0x28, 0x30, 0x0c, 0x04, 0x08, 0x54, 0x49, 0x47, + 0x45, 0x52, 0x31, 0x39, 0x32, 0x05, 0x00, 0x04, 0x18 }; + alen = DIM(asn); p = asn; } else if( algo == DIGEST_ALGO_SHA1 ) { - static byte asn[15] = /* Objet ID is 1.3.14.3.2.26 */ + static byte asn[15] = /* Object ID is 1.3.14.3.2.26 */ { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14 }; - mlen = 20; alen = DIM(asn); p = asn; + alen = DIM(asn); p = asn; } else log_bug("md_asn_oid(%d)", algo ); @@ -252,7 +265,7 @@ md_asn_oid( int algo, size_t *asnlen, size_t *mdlen ) if( asnlen ) *asnlen = alen; if( mdlen ) - *mdlen = mlen; + *mdlen = p[alen-1]; return p; } diff --git a/cipher/rand-unix.c b/cipher/rand-unix.c index a0f19d824..c0b7bc702 100644 --- a/cipher/rand-unix.c +++ b/cipher/rand-unix.c @@ -62,7 +62,7 @@ fast_random_poll() { #if HAVE_GETHRTIME { hrtime_t tv; - tv = gethrtime(void); + tv = gethrtime(); add_randomness( &tv, sizeof(tv), 1 ); } #elif HAVE_GETTIMEOFTIME diff --git a/doc/DETAILS b/doc/DETAILS index 407bd0b7f..ded1e379c 100644 --- a/doc/DETAILS +++ b/doc/DETAILS @@ -284,3 +284,30 @@ Status codes are: +Ich werde jetzt doch das HKP Protokoll implementieren: + +Naja, die Doku ist so gut wie nichtexistent, da gebe ich Dir recht. +In kurzen Worten: + +(Minimal-)HTTP-Server auf Port 11371, versteht ein GET auf /pks/lookup, +wobei die Query-Parameter (Key-Value-Paare mit = zwischen Key und +Value; die Paare sind hinter ? und durch & getrennt). Gültige +Operationen sind: + +- - op (Operation) mit den Möglichkeiten index (gleich wie -kv bei + PGP), vindex (-kvv) und get (-kxa) +- - search: Liste der Worte, die im Key vorkommen müssen. Worte sind + mit Worttrennzeichen wie Space, Punkt, @, ... getrennt, Worttrennzeichen + werden nicht betrachtet, die Reihenfolge der Worte ist egal. +- - exact: (on=aktiv, alles andere inaktiv) Nur die Schlüssel + zurückgeben, die auch den "search"-String beinhalten (d.h. + Wortreihenfolge und Sonderzeichen sind wichtig) +- - fingerprint (Bei [v]index auch den Fingerprint ausgeben), "on" + für aktiv, alles andere inaktiv + +Neu (wird von GNUPG benutzt): + /pks/lookup/?op= + +Zusätzlich versteht der Keyserver auch ein POST auf /pks/add, womit +man Keys hochladen kann. + diff --git a/g10/ChangeLog b/g10/ChangeLog index 2838c7c8a..c320110c9 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,35 @@ +Tue May 26 11:24:33 1998 Werner Koch (wk@isil.d.shuttle.de) + + * passphrase.c (get_last_passphrase): New + (set_next_passphrase): New. + (passphrase_to_dek): add support for the above functions. + * keyedit.c (make_keysig_packet): Add sigclass 0x18, + changed all callers due to a new argument. + * keygen.c (write_keybinding): New + (generate_subkeypair): Add functionality + (ask_algo, ask_keysize, ask_valid_days): Broke out of generate_keypair + (ask_user_id, ask_passphrase): Ditto. + +Thu May 21 11:26:13 1998 Werner Koch (wk@isil.d.shuttle.de) + + * g10.c,gpgd.c (main): Does now return an int, so that egcs does + not complain. + + * armor.c (fake_packet): Removed erro message and add a noticed + that this part should be fixed. + + * sign.c (sign_file): Compression now comes in front of encryption. + * encode.c (encode_simple): Ditto. + (encode_crypt): Ditto. + +Tue May 19 16:18:19 1998 Werner Koch (wk@isil.d.shuttle.de) + + * armor.c (fake_packet): Changed assertion to log_error + +Sat May 16 16:02:06 1998 Werner Koch (wk@isil.d.shuttle.de) + + * build-packet.c (build_packet): Add SUBKEY packets. + Fri May 15 17:57:23 1998 Werner Koch (wk@isil.d.shuttle.de) * sign.c (hash_for): New and used in all places here. diff --git a/g10/armor.c b/g10/armor.c index 462dc17b3..49352a1eb 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -703,8 +703,13 @@ fake_packet( armor_filter_context_t *afx, IOBUF a, break; case fhdrENDClearsig: - assert( emplines ); - emplines--; /* don't count the last one */ + /* FIXME: this is wrong: Only the last CRLF should + * not be included in the hash, muts rewrite the FSM again + * This proble does only occur if the last line does not end + * in with a LF? + */ + if( emplines ) + emplines--; /* don't count the last one */ state = fhdrENDClearsigHelp; afx->helplen = n; break; diff --git a/g10/build-packet.c b/g10/build-packet.c index 1d4e05871..a37aba55c 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -82,9 +82,11 @@ build_packet( IOBUF out, PACKET *pkt ) case PKT_COMMENT: rc = do_comment( out, ctb, pkt->pkt.comment ); break; + case PKT_PUBKEY_SUBCERT: case PKT_PUBLIC_CERT: rc = do_public_cert( out, ctb, pkt->pkt.public_cert ); break; + case PKT_SECKEY_SUBCERT: case PKT_SECRET_CERT: rc = do_secret_cert( out, ctb, pkt->pkt.secret_cert ); break; diff --git a/g10/compress.c b/g10/compress.c index 4e4d438e0..ca5adaebd 100644 --- a/g10/compress.c +++ b/g10/compress.c @@ -75,6 +75,9 @@ do_compress( compress_filter_context_t *zfx, z_stream *zs, int flush, IOBUF a ) do { zs->next_out = zfx->outbuf; zs->avail_out = zfx->outbufsize; + if( DBG_FILTER ) + log_debug("call deflate: avail_in=%u, avail_out=%u\n", + (unsigned)zs->avail_in, (unsigned)zs->avail_out); zrc = deflate( zs, flush ); if( zrc == Z_STREAM_END && flush == Z_FINISH ) ; @@ -145,6 +148,9 @@ do_uncompress( compress_filter_context_t *zfx, z_stream *zs, } zs->avail_in = n; } + if( DBG_FILTER ) + log_debug("call inflate: avail_in=%u, avail_out=%u\n", + (unsigned)zs->avail_in, (unsigned)zs->avail_out); zrc = inflate( zs, Z_PARTIAL_FLUSH ); if( DBG_FILTER ) log_debug("inflate returned: avail_in=%u, avail_out=%u, zrc=%d\n", diff --git a/g10/encode.c b/g10/encode.c index 1e37dfd74..142ffeac2 100644 --- a/g10/encode.c +++ b/g10/encode.c @@ -112,13 +112,10 @@ encode_simple( const char *filename, int mode ) if( opt.armor ) iobuf_push_filter( out, armor_filter, &afx ); - - write_comment( out, "#created by GNUPG v" VERSION " (" + else + write_comment( out, "#created by GNUPG v" VERSION " (" PRINTABLE_OS_NAME ")"); - if( opt.compress ) - iobuf_push_filter( out, compress_filter, &zfx ); - if( s2k ) { PKT_symkey_enc *enc = m_alloc_clear( sizeof *enc ); enc->version = 4; @@ -150,11 +147,14 @@ encode_simple( const char *filename, int mode ) pt->buf = inp; pkt.pkttype = PKT_PLAINTEXT; pkt.pkt.plaintext = pt; - cfx.datalen = filesize? calc_packet_length( &pkt ) : 0; + cfx.datalen = filesize && !opt.compress ? calc_packet_length( &pkt ) : 0; /* register the cipher filter */ if( mode ) iobuf_push_filter( out, cipher_filter, &cfx ); + /* register the compress filter */ + if( opt.compress ) + iobuf_push_filter( out, compress_filter, &zfx ); /* do the work */ if( (rc = build_packet( out, &pkt )) ) @@ -211,13 +211,10 @@ encode_crypt( const char *filename, STRLIST remusr ) if( opt.armor ) iobuf_push_filter( out, armor_filter, &afx ); - - write_comment( out, "#created by GNUPG v" VERSION " (" + else + write_comment( out, "#created by GNUPG v" VERSION " (" PRINTABLE_OS_NAME ")"); - if( opt.compress ) - iobuf_push_filter( out, compress_filter, &zfx ); - /* create a session key */ cfx.dek = m_alloc_secure( sizeof *cfx.dek ); cfx.dek->algo = opt.def_cipher_algo; @@ -249,10 +246,13 @@ encode_crypt( const char *filename, STRLIST remusr ) init_packet(&pkt); pkt.pkttype = PKT_PLAINTEXT; pkt.pkt.plaintext = pt; - cfx.datalen = filesize? calc_packet_length( &pkt ) : 0; + cfx.datalen = filesize && !opt.compress? calc_packet_length( &pkt ) : 0; /* register the cipher filter */ iobuf_push_filter( out, cipher_filter, &cfx ); + /* register the compress filter */ + if( opt.compress ) + iobuf_push_filter( out, compress_filter, &zfx ); /* do the work */ if( (rc = build_packet( out, &pkt )) ) diff --git a/g10/g10.c b/g10/g10.c index cc91d1ac4..322a9f3b9 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -201,7 +201,7 @@ strusage( int level ) case 13: p = VERSION; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = - _("Please report bugs to .\n"); + _("Please report bugs to .\n"); break; case 1: case 40: p = @@ -364,7 +364,7 @@ check_opts(void) -void +int main( int argc, char **argv ) { ARGPARSE_ARGS pargs; @@ -1005,6 +1005,7 @@ main( int argc, char **argv ) FREE_STRLIST(remusr); FREE_STRLIST(locusr); g10_exit(0); + return 8; /*NEVER REACHED*/ } diff --git a/g10/gpgd.c b/g10/gpgd.c index 010b319b9..72fcade8d 100644 --- a/g10/gpgd.c +++ b/g10/gpgd.c @@ -58,7 +58,7 @@ strusage( int level ) case 13: p = VERSION; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = - "Please report bugs to .\n"; + "Please report bugs to .\n"; break; case 1: case 40: p = "Usage: gpgd [options] (-h for help)"; @@ -135,7 +135,7 @@ set_debug(void) } -void +int main( int argc, char **argv ) { ARGPARSE_ARGS pargs; @@ -236,9 +236,8 @@ main( int argc, char **argv ) become_daemon(); - - g10_exit(0); + return 8; /*NEVER REACHED*/ } diff --git a/g10/import.c b/g10/import.c index 68ecd5330..228c754eb 100644 --- a/g10/import.c +++ b/g10/import.c @@ -43,7 +43,8 @@ static int chk_self_sigs( const char *fname, KBNODE keyblock, PKT_public_cert *pkc, u32 *keyid ); static int delete_inv_parts( const char *fname, KBNODE keyblock, u32 *keyid ); static int merge_blocks( const char *fname, KBNODE keyblock_orig, - KBNODE keyblock, u32 *keyid, int *n_uids, int *n_sigs ); + KBNODE keyblock, u32 *keyid, + int *n_uids, int *n_sigs, int *n_subk ); static int append_uid( KBNODE keyblock, KBNODE node, int *n_sigs, const char *fname, u32 *keyid ); static int merge_sigs( KBNODE dst, KBNODE src, int *n_sigs, @@ -103,7 +104,7 @@ import_pubkeys( const char *fname ) return G10ERR_OPEN_FILE; } - if( !opt.no_armor ) /* armored reading is not diabled */ + if( !opt.no_armor ) /* armored reading is not disabled */ iobuf_push_filter( inp, armor_filter, &afx ); while( !(rc = read_block( inp, &cfx, &pending_pkt, &keyblock) )) { @@ -305,7 +306,7 @@ import_one( const char *fname, KBNODE keyblock ) log_info("%s: key %08lX imported\n", fname, (ulong)keyid[1]); } else { /* merge */ - int n_uids, n_sigs; + int n_uids, n_sigs, n_subk; /* Compare the original against the new key; just to be sure nothing * weird is going on */ @@ -335,12 +336,13 @@ import_one( const char *fname, KBNODE keyblock ) /* and try to merge the block */ clear_kbnode_flags( keyblock_orig ); clear_kbnode_flags( keyblock ); - n_uids = n_sigs = 0; + n_uids = n_sigs = n_subk = 0; rc = merge_blocks( fname, keyblock_orig, keyblock, - keyid, &n_uids, &n_sigs ); + keyid, &n_uids, &n_sigs, &n_subk ); if( rc ) goto leave; - if( n_uids || n_sigs ) { /* keyblock_orig has been updated; write */ + if( n_uids || n_sigs || n_subk ) { + /* keyblock_orig has been updated; write */ if( opt.verbose > 1 ) log_info("%s: writing to '%s'\n", fname, keyblock_resource_name(&kbpos) ); @@ -364,6 +366,12 @@ import_one( const char *fname, KBNODE keyblock ) else if( n_sigs ) log_info("%s: key %08lX, %d new signatures\n", fname, (ulong)keyid[1], n_sigs ); + if( n_subk == 1 ) + log_info("%s: key %08lX, 1 new subkey\n", + fname, (ulong)keyid[1]); + else if( n_subk ) + log_info("%s: key %08lX, %d new subkeys\n", + fname, (ulong)keyid[1], n_subk ); } else log_info("%s: key %08lX, not changed\n", fname, (ulong)keyid[1] ); @@ -593,7 +601,7 @@ delete_inv_parts( const char *fname, KBNODE keyblock, u32 *keyid ) */ static int merge_blocks( const char *fname, KBNODE keyblock_orig, KBNODE keyblock, - u32 *keyid, int *n_uids, int *n_sigs ) + u32 *keyid, int *n_uids, int *n_sigs, int *n_subk ) { KBNODE onode, node; int rc, found; @@ -667,6 +675,9 @@ merge_blocks( const char *fname, KBNODE keyblock_orig, KBNODE keyblock, } } + /* 4th: add new subkeys */ + /* FIXME */ + return 0; } diff --git a/g10/keydb.h b/g10/keydb.h index 968ee692a..3df11771e 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -98,6 +98,8 @@ int build_skc_list( STRLIST locusr, SKC_LIST *ret_skc_list, void set_passphrase_fd( int fd ); int get_passphrase_fd(void); DEK *passphrase_to_dek( u32 *keyid, int cipher_algo, STRING2KEY *s2k, int mode); +void set_next_passphrase( const char *s ); +char *get_last_passphrase(void); /*-- getkey.c --*/ void add_keyring( const char *name ); diff --git a/g10/keyedit.c b/g10/keyedit.c index 77da1977b..f5c95ea32 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -169,10 +169,6 @@ remove_keysigs( KBNODE keyblock, u32 *keyid, int all ) && (node->pkt->pkt.signature->sig_class&~3) == 0x10 ) { PKT_signature *sig = node->pkt->pkt.signature; - if( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] ) { - /* fixme: skip self-sig */ - } - tty_printf("\n \"%08lX %s ", sig->keyid[1], datestr_from_sig(sig)); if( node->flag & 6 ) @@ -349,6 +345,7 @@ sign_key( const char *username, STRLIST locusr ) rc = make_keysig_packet( &sig, pkc, node->pkt->pkt.user_id, + NULL, skc_rover->skc, 0x10, 0 ); if( rc ) { @@ -568,9 +565,10 @@ change_passphrase( const char *username ) KBNODE node; KBPOS kbpos; PKT_secret_cert *skc; - u32 skc_keyid[2]; + u32 keyid[2]; char *answer; int changed=0; + char *passphrase = NULL; /* find the userid */ rc = find_secret_keyblock_byname( &kbpos, username ); @@ -595,18 +593,28 @@ change_passphrase( const char *username ) } skc = node->pkt->pkt.secret_cert; - keyid_from_skc( skc, skc_keyid ); + keyid_from_skc( skc, keyid ); tty_printf("sec %4u%c/%08lX %s ", nbits_from_skc( skc ), pubkey_letter( skc->pubkey_algo ), - skc_keyid[1], datestr_from_skc(skc) ); + keyid[1], datestr_from_skc(skc) ); { size_t n; - char *p = get_user_id( skc_keyid, &n ); + char *p = get_user_id( keyid, &n ); tty_print_string( p, n ); m_free(p); tty_printf("\n"); } + for(node=keyblock; node; node = node->next ) { + if( node->pkt->pkttype == PKT_SECKEY_SUBCERT ) { + PKT_secret_cert *subskc = node->pkt->pkt.secret_cert; + keyid_from_skc( subskc, keyid ); + tty_printf("sub %4u%c/%08lX %s\n", + nbits_from_skc( subskc ), + pubkey_letter( subskc->pubkey_algo ), + keyid[1], datestr_from_skc(subskc) ); + } + } clear_kbnode_flags( keyblock ); switch( is_secret_key_protected( skc ) ) { @@ -619,10 +627,21 @@ change_passphrase( const char *username ) default: tty_printf("Key is protected.\n"); rc = check_secret_key( skc ); + if( !rc ) + passphrase = get_last_passphrase(); break; } - /* fixme: unprotect all subkeys */ + /* unprotect all subkeys (use the supplied passphrase or ask)*/ + for(node=keyblock; node; node = node->next ) { + if( node->pkt->pkttype == PKT_SECKEY_SUBCERT ) { + PKT_secret_cert *subskc = node->pkt->pkt.secret_cert; + set_next_passphrase( passphrase ); + rc = check_secret_key( subskc ); + if( rc ) + break; + } + } if( rc ) tty_printf("Can't edit this key: %s\n", g10_errstr(rc)); @@ -632,6 +651,7 @@ change_passphrase( const char *username ) tty_printf(_("Enter the new passphrase for this secret key.\n\n") ); + set_next_passphrase( NULL ); for(;;) { s2k->mode = 1; s2k->hash_algo = DIGEST_ALGO_RMD160; @@ -651,10 +671,17 @@ change_passphrase( const char *username ) break; } else { /* okay */ - /* fixme: protect all subkeys too */ skc->protect.algo = dek->algo; skc->protect.s2k = *s2k; rc = protect_secret_key( skc, dek ); + for(node=keyblock; !rc && node; node = node->next ) { + if( node->pkt->pkttype == PKT_SECKEY_SUBCERT ) { + PKT_secret_cert *subskc = node->pkt->pkt.secret_cert; + subskc->protect.algo = dek->algo; + subskc->protect.s2k = *s2k; + rc = protect_secret_key( subskc, dek ); + } + } if( rc ) log_error("protect_secret_key failed: %s\n", g10_errstr(rc) ); else @@ -676,7 +703,9 @@ change_passphrase( const char *username ) } leave: + m_free( passphrase ); release_kbnode( keyblock ); + set_next_passphrase( NULL ); return rc; } @@ -689,14 +718,16 @@ change_passphrase( const char *username ) */ int make_keysig_packet( PKT_signature **ret_sig, PKT_public_cert *pkc, - PKT_user_id *uid, PKT_secret_cert *skc, + PKT_user_id *uid, PKT_public_cert *subpkc, + PKT_secret_cert *skc, int sigclass, int digest_algo ) { PKT_signature *sig; int rc=0; MD_HANDLE md; - assert( (sigclass >= 0x10 && sigclass <= 0x13) || sigclass == 0x20 ); + assert( (sigclass >= 0x10 && sigclass <= 0x13) + || sigclass == 0x20 || sigclass == 0x18 ); if( !digest_algo ) { switch( skc->pubkey_algo ) { case PUBKEY_ALGO_DSA: digest_algo = DIGEST_ALGO_SHA1; break; @@ -706,11 +737,13 @@ make_keysig_packet( PKT_signature **ret_sig, PKT_public_cert *pkc, } } md = md_open( digest_algo, 0 ); - /*md_start_debug( md, "make" );*/ /* hash the public key certificate and the user id */ hash_public_cert( md, pkc ); - if( sigclass != 0x20 ) { + if( sigclass == 0x18 ) { /* subkey binding */ + hash_public_cert( md, subpkc ); + } + else if( sigclass != 0x20 ) { if( skc->version >=4 ) { byte buf[5]; buf[0] = 0xb4; /* indicates a userid packet */ @@ -759,7 +792,7 @@ make_keysig_packet( PKT_signature **ret_sig, PKT_public_cert *pkc, /* add some magic */ buf[0] = sig->version; buf[1] = 0xff; - buf[2] = n >> 24; /* hmmm, n is only 16 bit, so tthis is always 0 */ + buf[2] = n >> 24; /* hmmm, n is only 16 bit, so this is always 0 */ buf[3] = n >> 16; buf[4] = n >> 8; buf[5] = n; diff --git a/g10/keygen.c b/g10/keygen.c index b6894ab79..367c22de5 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -79,7 +79,47 @@ write_selfsig( KBNODE root, KBNODE pub_root, PKT_secret_cert *skc ) pkc = node->pkt->pkt.public_cert; /* and make the signature */ - rc = make_keysig_packet( &sig, pkc, uid, skc, 0x13, 0 ); + rc = make_keysig_packet( &sig, pkc, uid, NULL, skc, 0x13, 0 ); + if( rc ) { + log_error("make_keysig_packet failed: %s\n", g10_errstr(rc) ); + return rc; + } + + pkt = m_alloc_clear( sizeof *pkt ); + pkt->pkttype = PKT_SIGNATURE; + pkt->pkt.signature = sig; + add_kbnode( root, new_kbnode( pkt ) ); + return rc; +} + +static int +write_keybinding( KBNODE root, KBNODE pub_root, PKT_secret_cert *skc ) +{ + PACKET *pkt; + PKT_signature *sig; + int rc=0; + KBNODE node; + PKT_public_cert *pkc, *subpkc; + + if( opt.verbose ) + log_info(_("writing key binding signature\n")); + + /* get the pkc packet from the pub_tree */ + node = find_kbnode( pub_root, PKT_PUBLIC_CERT ); + if( !node ) + BUG(); + pkc = node->pkt->pkt.public_cert; + /* find the last subkey */ + subpkc = NULL; + for(node=pub_root; node; node = node->next ) { + if( node->pkt->pkttype == PKT_PUBKEY_SUBCERT ) + subpkc = node->pkt->pkt.public_cert; + } + if( !subpkc ) + BUG(); + + /* and make the signature */ + rc = make_keysig_packet( &sig, pkc, NULL, subpkc, skc, 0x18, 0 ); if( rc ) { log_error("make_keysig_packet failed: %s\n", g10_errstr(rc) ); return rc; @@ -95,7 +135,8 @@ write_selfsig( KBNODE root, KBNODE pub_root, PKT_secret_cert *skc ) static int gen_elg(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek, - STRING2KEY *s2k, PKT_secret_cert **ret_skc, u16 valid_days ) + STRING2KEY *s2k, PKT_secret_cert **ret_skc, u16 valid_days, + int version ) { int rc; int i; @@ -111,6 +152,7 @@ gen_elg(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek, skc = m_alloc_clear( sizeof *skc ); pkc = m_alloc_clear( sizeof *pkc ); skc->timestamp = pkc->timestamp = make_timestamp(); + skc->version = pkc->version = version; skc->valid_days = pkc->valid_days = valid_days; skc->pubkey_algo = pkc->pubkey_algo = PUBKEY_ALGO_ELGAMAL; pkc->d.elg.p = pk.p; @@ -124,8 +166,8 @@ gen_elg(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek, skc->protect.algo = 0; skc->csum = checksum_mpi( skc->d.elg.x ); - /* return an unprotected version of the skc */ - *ret_skc = copy_secret_cert( NULL, skc ); + if( ret_skc ) /* not a subkey: return an unprotected version of the skc */ + *ret_skc = copy_secret_cert( NULL, skc ); if( dek ) { skc->protect.algo = dek->algo; @@ -140,14 +182,14 @@ gen_elg(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek, } pkt = m_alloc_clear(sizeof *pkt); - pkt->pkttype = PKT_PUBLIC_CERT; + pkt->pkttype = ret_skc ? PKT_PUBLIC_CERT : PKT_PUBKEY_SUBCERT; pkt->pkt.public_cert = pkc; add_kbnode(pub_root, new_kbnode( pkt )); /* don't know whether it makes sense to have the factors, so for now * we store them in the secret keyring (but they are not secret) */ pkt = m_alloc_clear(sizeof *pkt); - pkt->pkttype = PKT_SECRET_CERT; + pkt->pkttype = ret_skc ? PKT_SECRET_CERT : PKT_SECKEY_SUBCERT; pkt->pkt.secret_cert = skc; add_kbnode(sec_root, new_kbnode( pkt )); for(i=0; factors[i]; i++ ) @@ -192,8 +234,8 @@ gen_rsa(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek, skc->d.rsa.csum += checksum_mpi( skc->d.rsa.rsa_q ); skc->d.rsa.csum += checksum_mpi( skc->d.rsa.rsa_u ); - /* return an unprotected version of the skc */ - *ret_skc = copy_secret_cert( NULL, skc ); + if( ret_skc ) /* not a subkey: return an unprotected version of the skc */ + *ret_skc = copy_secret_cert( NULL, skc ); if( dek ) { skc->d.rsa.is_protected = 1; @@ -210,12 +252,12 @@ gen_rsa(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek, } pkt = m_alloc_clear(sizeof *pkt); - pkt->pkttype = PKT_PUBLIC_CERT; + pkt->pkttype = ret_skc ? PKT_PUBLIC_CERT : PKT_PUBKEY_SUBCERT; pkt->pkt.public_cert = pkc; add_kbnode(pub_root, new_kbnode( pkt )); pkt = m_alloc_clear(sizeof *pkt); - pkt->pkttype = PKT_SECRET_CERT; + pkt->pkttype = ret_skc ? PKT_SECRET_CERT : PKT_SECKEY_SUBCERT; pkt->pkt.secret_cert = skc; add_kbnode(sec_root, new_kbnode( pkt )); @@ -267,8 +309,8 @@ gen_dsa(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek, skc->protect.algo = 0; skc->csum = checksum_mpi( skc->d.dsa.x ); - /* return an unprotected version of the skc */ - *ret_skc = copy_secret_cert( NULL, skc ); + if( ret_skc ) /* not a subkey: return an unprotected version of the skc */ + *ret_skc = copy_secret_cert( NULL, skc ); if( dek ) { skc->protect.algo = dek->algo; @@ -283,7 +325,7 @@ gen_dsa(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek, } pkt = m_alloc_clear(sizeof *pkt); - pkt->pkttype = PKT_PUBLIC_CERT; + pkt->pkttype = ret_skc ? PKT_PUBLIC_CERT : PKT_PUBKEY_SUBCERT; pkt->pkt.public_cert = pkc; add_kbnode(pub_root, new_kbnode( pkt )); @@ -294,7 +336,7 @@ gen_dsa(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek, * are known. */ pkt = m_alloc_clear(sizeof *pkt); - pkt->pkttype = PKT_SECRET_CERT; + pkt->pkttype = ret_skc ? PKT_SECRET_CERT : PKT_SECKEY_SUBCERT; pkt->pkt.secret_cert = skc; add_kbnode(sec_root, new_kbnode( pkt )); for(i=1; factors[i]; i++ ) /* the first one is q */ @@ -334,74 +376,63 @@ check_valid_days( const char *s ) } -/**************** - * Generate a keypair - */ -void -generate_keypair() +static int +ask_algo( int *ret_v4 ) { char *answer; - unsigned nbits; - char *pub_fname = NULL; - char *sec_fname = NULL; - char *uid = NULL; - KBNODE pub_root = NULL; - KBNODE sec_root = NULL; - PKT_secret_cert *skc = NULL; - DEK *dek = NULL; - STRING2KEY *s2k; - int rc; int algo; - const char *algo_name; - char *aname, *acomment, *amail; - int valid_days=0; - - if( opt.batch || opt.answer_yes || opt.answer_no ) { - log_error(_("Key generation can only be used in interactive mode\n")); - return; - } tty_printf(_("Please select the algorithm to use:\n" " (1) ElGamal is the suggested one.\n" - " (2) DSA can only be used for signatures.\n")); + " (2) ElGamal using v4 packets (OpenPGP)\n" + " (3) DSA can only be used for signatures.\n")); #ifdef ENABLE_RSA_KEYGEN - tty_printf(_(" (3) RSA cannot be used in the U.S.\n")); + tty_printf(_(" (4) RSA cannot be used in the U.S.\n")); #endif + *ret_v4 = 0; for(;;) { #ifdef ENABLE_RSA_KEYGEN - answer = tty_get(_("Your selection? (1,2,3) ")); + answer = tty_get(_("Your selection? (1,2,3,4) ")); #else - answer = tty_get(_("Your selection? (1,2) ")); + answer = tty_get(_("Your selection? (1,2,3) ")); #endif tty_kill_prompt(); algo = *answer? atoi(answer): 1; m_free(answer); - if( algo == 1 ) { + if( algo == 1 || algo == 2 ) { + if( algo == 2 ) + *ret_v4 = 1; algo = PUBKEY_ALGO_ELGAMAL; - algo_name = "ElGamal"; break; } - else if( algo == 2 ) { + else if( algo == 3 ) { + *ret_v4 = 1; algo = PUBKEY_ALGO_DSA; - algo_name = "DSA"; break; } #ifdef ENABLE_RSA_KEYGEN - else if( algo == 3 ) { + else if( algo == 4 ) { algo = PUBKEY_ALGO_RSA; - algo_name = "RSA"; break; } #endif } + return algo; +} +static unsigned +ask_keysize( int algo ) +{ + char *answer; + unsigned nbits; tty_printf(_("About to generate a new %s keypair.\n" " minimum keysize is 768 bits\n" " default keysize is 1024 bits\n" - " highest suggested keysize is 2048 bits\n"), algo_name ); + " highest suggested keysize is 2048 bits\n"), + pubkey_algo_to_string(algo) ); for(;;) { answer = tty_get(_("What keysize do you want? (1024) ")); tty_kill_prompt(); @@ -446,6 +477,15 @@ generate_keypair() nbits = ((nbits + 31) / 32) * 32; tty_printf(_("rounded up to %u bits\n"), nbits ); } + return nbits; +} + + +static int +ask_valid_days() +{ + char *answer; + int valid_days=0; tty_printf(_("Please specify how long the key should be valid.\n" " 0 = key does not expire\n" @@ -491,15 +531,21 @@ generate_keypair() break; } m_free(answer); + return valid_days; +} +static char * +ask_user_id() +{ + char *answer; + char *aname, *acomment, *amail, *uid; tty_printf( _("\n" "You need a User-ID to identify your key; the software constructs the user id\n" "from Real Name, Comment and Email Address in this form:\n" " \"Heinrich Heine (Der Dichter) \"\n\n") ); - uid = NULL; - aname=acomment=amail=NULL; + uid = aname = acomment = amail = NULL; for(;;) { char *p; @@ -600,8 +646,16 @@ generate_keypair() break; m_free(uid); uid = NULL; } + return uid; +} +static DEK * +ask_passphrase( STRING2KEY **ret_s2k ) +{ + DEK *dek = NULL; + STRING2KEY *s2k; + tty_printf(_("You need a Passphrase to protect your secret key.\n\n") ); s2k = m_alloc_secure( sizeof *s2k ); @@ -624,6 +678,77 @@ generate_keypair() else break; /* okay */ } + *ret_s2k = s2k; + return dek; +} + + +static int +do_create( int algo, unsigned nbits, KBNODE pub_root, KBNODE sec_root, + DEK *dek, STRING2KEY *s2k, PKT_secret_cert **skc, int valid_days, + int v4_packet ) +{ + int rc=0; + + tty_printf(_( +"We need to generate a lot of random bytes. It is a good idea to perform\n" +"some other action (work in another window, move the mouse, utilize the\n" +"network and the disks) during the prime generation; this gives the random\n" +"number generator a better chance to gain enough entropy.\n") ); + + if( algo == PUBKEY_ALGO_ELGAMAL ) + rc = gen_elg(nbits, pub_root, sec_root, dek, s2k, + skc, valid_days, v4_packet? 4:3 ); + #ifdef ENABLE_RSA_KEYGEN + else if( algo == PUBKEY_ALGO_RSA ) + rc = gen_rsa(nbits, pub_root, sec_root, dek, s2k, skc, valid_days ); + #endif + else if( algo == PUBKEY_ALGO_DSA ) + rc = gen_dsa(nbits, pub_root, sec_root, dek, s2k, skc, valid_days); + else + BUG(); + if( !rc ) { + add_kbnode( pub_root, + make_comment_node("#created by GNUPG v" VERSION " (" + PRINTABLE_OS_NAME ")")); + add_kbnode( sec_root, + make_comment_node("#created by GNUPG v" VERSION " (" + PRINTABLE_OS_NAME ")")); + } + return rc; +} + + +/**************** + * Generate a keypair + */ +void +generate_keypair() +{ + unsigned nbits; + char *pub_fname = NULL; + char *sec_fname = NULL; + char *uid = NULL; + KBNODE pub_root = NULL; + KBNODE sec_root = NULL; + PKT_secret_cert *skc = NULL; + DEK *dek; + STRING2KEY *s2k; + int rc; + int algo; + int ndays; + int v4; + + if( opt.batch || opt.answer_yes || opt.answer_no ) { + log_error(_("Key generation can only be used in interactive mode\n")); + return; + } + + algo = ask_algo( &v4 ); + nbits = ask_keysize( algo ); + ndays = ask_valid_days(); + uid = ask_user_id(); + dek = ask_passphrase( &s2k ); /* now check whether we are allowed to write to the keyrings */ @@ -642,30 +767,7 @@ generate_keypair() pub_root = make_comment_node("#"); delete_kbnode(pub_root); sec_root = make_comment_node("#"); delete_kbnode(sec_root); - tty_printf(_( -"We need to generate a lot of random bytes. It is a good idea to perform\n" -"some other action (work in another window, move the mouse, utilize the\n" -"network and the disks) during the prime generation; this gives the random\n" -"number generator a better chance to gain enough entropy.\n") ); - - if( algo == PUBKEY_ALGO_ELGAMAL ) - rc = gen_elg(nbits, pub_root, sec_root, dek, s2k, &skc, valid_days ); - #ifdef ENABLE_RSA_KEYGEN - else if( algo == PUBKEY_ALGO_RSA ) - rc = gen_rsa(nbits, pub_root, sec_root, dek, s2k, &skc, valid_days ); - #endif - else if( algo == PUBKEY_ALGO_DSA ) - rc = gen_dsa(nbits, pub_root, sec_root, dek, s2k, &skc, valid_days); - else - BUG(); - if( !rc ) { - add_kbnode( pub_root, - make_comment_node("#created by GNUPG v" VERSION " (" - PRINTABLE_OS_NAME ")")); - add_kbnode( sec_root, - make_comment_node("#created by GNUPG v" VERSION " (" - PRINTABLE_OS_NAME ")")); - } + rc = do_create( algo, nbits, pub_root, sec_root, dek, s2k, &skc, ndays, v4); if( !rc ) write_uid(pub_root, uid ); if( !rc ) @@ -718,6 +820,11 @@ generate_keypair() log_error("can't write secret key: %s\n", g10_errstr(rc) ); else { tty_printf(_("public and secret key created and signed.\n") ); + if( algo == PUBKEY_ALGO_DSA ) + tty_printf(_("Note that this key cannot be used for " + "encryption. You may want to use\n" + "the command \"--add-key\" to generate a " + "secondary key for this purpose.\n") ); } if( !rc1 ) @@ -745,8 +852,148 @@ generate_keypair() * add a new subkey to an existing key. */ void -generate_subkeypair( const char *userid ) +generate_subkeypair( const char *username ) { - log_fatal("To be implemented :-)\n"); + int rc=0; + KBPOS pub_kbpos, sec_kbpos; + KBNODE pub_keyblock = NULL; + KBNODE sec_keyblock = NULL; + KBNODE node; + PKT_secret_cert *skc = NULL; /* this is the primary skc */ + u32 keyid[2]; + int v4, algo, ndays; + unsigned nbits; + char *passphrase = NULL; + DEK *dek = NULL; + STRING2KEY *s2k = NULL; + + if( opt.batch || opt.answer_yes || opt.answer_no ) { + log_error(_("Key generation can only be used in interactive mode\n")); + return; + } + + /* search the userid */ + rc = find_secret_keyblock_byname( &sec_kbpos, username ); + if( rc ) { + log_error("user '%s' not found\n", username ); + goto leave; + } + rc = read_keyblock( &sec_kbpos, &sec_keyblock ); + if( rc ) { + log_error("error reading the secret key: %s\n", g10_errstr(rc) ); + goto leave; + } + /* and the public key */ + rc = find_keyblock_byname( &pub_kbpos, username ); + if( rc ) { + log_error("user '%s' not found in public ring\n", username ); + goto leave; + } + rc = read_keyblock( &pub_kbpos, &pub_keyblock ); + if( rc ) { + log_error("error reading the public key: %s\n", g10_errstr(rc) ); + goto leave; + } + + /* break out the primary key */ + node = find_kbnode( sec_keyblock, PKT_SECRET_CERT ); + if( !node ) { + log_error("Oops; secret key not found anymore!\n"); + rc = G10ERR_GENERAL; + goto leave; + } + + /* make a copy of the skc to keep the protected one in the keyblock */ + skc = copy_secret_cert( NULL, node->pkt->pkt.secret_cert ); + keyid_from_skc( skc, keyid ); + /* display primary and all secondary keys */ + tty_printf("sec %4u%c/%08lX %s ", + nbits_from_skc( skc ), + pubkey_letter( skc->pubkey_algo ), + keyid[1], datestr_from_skc(skc) ); + { + size_t n; + char *p = get_user_id( keyid, &n ); + tty_print_string( p, n ); + m_free(p); + tty_printf("\n"); + } + for(node=sec_keyblock; node; node = node->next ) { + if( node->pkt->pkttype == PKT_SECKEY_SUBCERT ) { + PKT_secret_cert *subskc = node->pkt->pkt.secret_cert; + keyid_from_skc( subskc, keyid ); + tty_printf("sub %4u%c/%08lX %s\n", + nbits_from_skc( subskc ), + pubkey_letter( subskc->pubkey_algo ), + keyid[1], datestr_from_skc(subskc) ); + } + } + tty_printf("\n"); + + + + /* unprotect to get the passphrase */ + switch( is_secret_key_protected( skc ) ) { + case -1: + rc = G10ERR_PUBKEY_ALGO; + break; + case 0: + tty_printf("This key is not protected.\n"); + break; + default: + tty_printf("Key is protected.\n"); + rc = check_secret_key( skc ); + if( !rc ) + passphrase = get_last_passphrase(); + break; + } + if( rc ) + goto leave; + + + algo = ask_algo( &v4 ); + nbits = ask_keysize( algo ); + ndays = ask_valid_days(); + + if( passphrase ) { + s2k = m_alloc_secure( sizeof *s2k ); + s2k->mode = 1; + s2k->hash_algo = DIGEST_ALGO_RMD160; + set_next_passphrase( passphrase ); + dek = passphrase_to_dek( NULL, CIPHER_ALGO_BLOWFISH, s2k, 2 ); + } + + rc = do_create( algo, nbits, pub_keyblock, sec_keyblock, + dek, s2k, NULL, ndays, v4 ); + if( !rc ) + rc = write_keybinding(pub_keyblock, pub_keyblock, skc); + if( !rc ) + rc = write_keybinding(sec_keyblock, pub_keyblock, skc); + /* write back */ + if( !rc ) { + rc = update_keyblock( &pub_kbpos, pub_keyblock ); + if( rc ) + log_error("update_public_keyblock failed\n" ); + } + if( !rc ) { + rc = update_keyblock( &sec_kbpos, sec_keyblock ); + if( rc ) + log_error("update_secret_keyblock failed\n" ); + } + if( !rc ) + tty_printf(_("public and secret subkey created.\n") ); + + + leave: + if( rc ) + tty_printf(_("Key generation failed: %s\n"), g10_errstr(rc) ); + m_free( passphrase ); + m_free( dek ); + m_free( s2k ); + if( skc ) /* release the copy of the (now unprotected) secret key */ + free_secret_cert(skc); + release_kbnode( sec_keyblock ); + release_kbnode( pub_keyblock ); + set_next_passphrase( NULL ); } diff --git a/g10/ks-proto.c b/g10/ks-proto.c index 38f21762b..b862357fb 100644 --- a/g10/ks-proto.c +++ b/g10/ks-proto.c @@ -18,6 +18,32 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +/**************** + * The extended HKP protocol: + * + * GET /pks/lookup[/][?[op=][&armor=0][&search=]] + * + * Default is: "armor=1", "op=get". "search" is only allowed if gnupg_user_id + * is not present. GET maybe replaced by HEAD in which case only some status + * information is returned. + * + * Hmmm, I don't like it, the better solution is to use: + * + * /pks/gnupg/get for binary lookups + * /pks/gnupg/upd to update a key + * /pks/gnupg/ins to insert a new key + * + * Optional a version string can be inserted as in: + * + * /pks/gnupg/v1.0/get + * + * Returned HTTP options: + * X-Key-Hash: + * X-Key-MTime: + * X-Key-LID: + * [fixme: is X-.... allowed?] + */ + #include #include #include @@ -34,6 +60,226 @@ read_line( FILE *fp ) { return -1; } + + + + +/**************** + * Send a HKP request + */ +int +hkp_request( int operation, const char *user_id ) +{ + +} + + + + + +/************************************************ + ******* client communication stuff ************ + ************************************************/ + +/**************** + * Initialisieren des clients + * Es wird ein Handle zurückgegeben oder -1 bei einem fehler. + * z.Z. ist nut eine Verbindung gleichzeitig möglich. + * Wenn einer serverpid von 0 angegeben wird, so wird diese + * der environment variabeln ATEXDB_PID entnommen. + */ + +int +hkp_open( const char *serverurl ) +{ + const char *s; + + s = SERVER_NAME_TEMPLATE; + client.serv_name = xmalloc(strlen(s) + 10 ); + sprintf(client.serv_name,s, serverpid ); + if( opt.verbose ) + Info("Using unix domain stream '%s'", client.serv_name ); + + memset( &client.serv_addr, 0, sizeof client.serv_addr ); + client.serv_addr.sun_family = AF_UNIX; + strcpy( client.serv_addr.sun_path, client.serv_name ); + client.serv_addr_len = strlen(client.serv_addr.sun_path) + + sizeof client.serv_addr.sun_family; + + client.sockfd = -1; + if( DoCheckVersion() ) + return -1; + return 0; +} + + +static int +DoConnect() +{ + if( client.sockfd != -1 ) + DoDisconnect(); + if( (client.sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1 ) { + Error(1000,"can't open unix domain socket"); + return 1; + } + if( connect(client.sockfd, (struct sockaddr*)&client.serv_addr, + client.serv_addr_len) == -1 ) { + Error(1000,"can't connect to '%s'",client.serv_addr.sun_path); + return 1; + } + + return 0; /* okay */ +} + +static int +DoDisconnect() +{ + if( client.sockfd != -1 ) { + close(client.sockfd); + client.sockfd = -1; + } + return 0; /* okay */ +} + +/**************** + * NBYTES auf den aktuellen stream schreiben. + */ +static int +DoWrite( void *buf, size_t nbytes ) +{ + size_t nleft = nbytes; + ssize_t nwritten; + + while( nleft > 0 ) { + /* FIXME: add EINTR handling */ + nwritten = write(client.sockfd, buf, nleft); + if( nwritten < 0 ) { + Error(1000,"error writing to server"); + return -1; + } + nleft -= nwritten; + buf = (char*)buf + nwritten; + } + return 0; +} + +static int +DoWriteStr( const char *s ) +{ + return DoWrite((char *)s, strlen(s) ); +} + + +static int +DoRead( void *buf, size_t buflen, size_t *ret_nread, int stop) +{ + size_t nleft = buflen; + int nread; + char *p; + + p = buf; + while( nleft > 0 ) { + /* FIXME: add EINTR handling */ + nread = read(client.sockfd, buf, stop? 1 : nleft); + if( nread < 0 ) { + Error(1000,"error reading from server"); + return -1; + } + else if( !nread ) + break; /* EOF */ + nleft -= nread; + buf = (char*)buf + nread; + if( stop ) + for(; p < (char*)buf ; p++ ) + if( *p == '\n' ) + goto leave; + } + leave: + if( ret_nread ) + *ret_nread = buflen - nleft; + return 0; +} + +/**************** + * Like DoRead(), but append the received data to the given strgbuf. + * read a maximum of nbytes; + */ +static int +DoReadIntoStrgbuf( strgbuf_t *strgbuf, size_t nbytes, size_t *ret_nread) +{ + size_t ntotal, nleft; + int nread; + byte *p, buffer[1000]; + + ntotal = 0; + nleft = nbytes; + while( nleft ) { + nread = read(client.sockfd, buffer, + nleft > DIM(buffer)? DIM(buffer) : nleft); + if( nread < 0 ) { + Error(1000,"error reading from server"); + return -1; + } + else if( !nread ) + break; /* EOF */ + nleft -= nread; + ntotal += nread; + /* ab in den stringbuffer */ + for(p=buffer; nread; nread--, p++ ) + PutStrgbuf(strgbuf, *p ); + } + + if( ret_nread ) + *ret_nread = ntotal; + return 0; +} + + +/**************** + * In retval wird das numerische argument nach OK zurückgegeben + */ +static int +DoRequest( char *request, long *retval ) +{ + if( DoWrite(request, strlen(request)) ) + return -1; + return DoWaitReply( retval ); +} + +static int +DoWaitReply( long *retval ) +{ + char *p, buf[200]; /* enough room for messages */ + size_t nread; + + /* read but stop at the first newline */ + if( DoRead(buf, DIM(buf)-2, &nread, 1 ) ) + return -1; + buf[DIM(buf)-1] = 0; + /* fixme: should check, that we have the linefeed and otherwise + * perform a dummy read */ + if( p = strchr(buf, '\n') ) + *p = 0; + if( *buf == 'O' && buf[1] == 'K' && (buf[2]==' ' || !buf[2]) ) { + if( retval ) + *retval = buf[2]? strtol(buf+3, NULL, 10 ):0; + return 0; + } + Error(0, "Server replied: %.60s", buf ); + return -1; +} + + + + + + + + + + + + #endif diff --git a/g10/packet.h b/g10/packet.h index 463cf53f2..7f38cd5cf 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -308,7 +308,8 @@ int write_comment( IOBUF out, const char *s ); /*-- sign.c --*/ int make_keysig_packet( PKT_signature **ret_sig, PKT_public_cert *pkc, - PKT_user_id *uid, PKT_secret_cert *skc, + PKT_user_id *uid, PKT_public_cert *subpkc, + PKT_secret_cert *skc, int sigclass, int digest_algo ); #endif /*G10_PACKET_H*/ diff --git a/g10/passphrase.c b/g10/passphrase.c index d3b882fa8..ebcba9942 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -33,6 +33,8 @@ #include "main.h" static int pwfd = -1; +static char *next_pw = NULL; +static char *last_pw = NULL; static void hash_passphrase( DEK *dek, char *pw, STRING2KEY *s2k, int create ); @@ -48,6 +50,34 @@ get_passphrase_fd() return pwfd; } +/**************** + * Set the passphrase to be used for the next query and only for the next + * one. + */ +void +set_next_passphrase( const char *s ) +{ + m_free(next_pw); + next_pw = NULL; + if( s ) { + next_pw = m_alloc_secure( strlen(s)+1 ); + strcpy(next_pw, s ); + } +} + +/**************** + * Get the last passphrase used in passphrase_to_dek. + * Note: This removes the passphrase from this modules and + * the caller must free the result. May return NULL: + */ +char * +get_last_passphrase() +{ + char *p = last_pw; + last_pw = NULL; + return p; +} + /**************** * Get a passphrase for the secret key with KEYID, display TEXT @@ -62,7 +92,7 @@ get_passphrase_fd() DEK * passphrase_to_dek( u32 *keyid, int cipher_algo, STRING2KEY *s2k, int mode ) { - char *pw; + char *pw = NULL; DEK *dek; STRING2KEY help_s2k; @@ -77,7 +107,7 @@ passphrase_to_dek( u32 *keyid, int cipher_algo, STRING2KEY *s2k, int mode ) :DEFAULT_DIGEST_ALGO; } - if( keyid && !opt.batch ) { + if( keyid && !opt.batch && !next_pw ) { char *ustr; tty_printf("Need a pass phrase to unlock the secret key for:\n"); tty_printf(" \"" ); @@ -87,7 +117,11 @@ passphrase_to_dek( u32 *keyid, int cipher_algo, STRING2KEY *s2k, int mode ) tty_printf("\"\n\n"); } - if( pwfd != -1 ) { /* read the passphrase from the given descriptor */ + if( next_pw ) { + pw = next_pw; + next_pw = NULL; + } + else if( pwfd != -1 ) { /* read the passphrase from the file */ int i, len; if( !opt.batch ) @@ -130,7 +164,8 @@ passphrase_to_dek( u32 *keyid, int cipher_algo, STRING2KEY *s2k, int mode ) dek->keylen = 0; else hash_passphrase( dek, pw, s2k, mode==2 ); - m_free(pw); /* is allocated in secure memory, so it will be burned */ + m_free(last_pw); + last_pw = pw; return dek; } diff --git a/g10/plaintext.c b/g10/plaintext.c index e15a269e8..cdf4fe2a2 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -77,7 +77,8 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx ) if( pt->len ) { for( ; pt->len; pt->len-- ) { if( (c = iobuf_get(pt->buf)) == -1 ) { - log_error("Problem reading source\n"); + log_error("Problem reading source (%u bytes remaining)\n", + (unsigned)pt->len); rc = G10ERR_READ_FILE; goto leave; } diff --git a/g10/revoke.c b/g10/revoke.c index 68f51e810..cafe84de3 100644 --- a/g10/revoke.c +++ b/g10/revoke.c @@ -159,7 +159,7 @@ gen_revoke( const char *uname ) /* create it */ - rc = make_keysig_packet( &sig, pkc, NULL, skc, 0x20, 0); + rc = make_keysig_packet( &sig, pkc, NULL, NULL, skc, 0x20, 0); if( rc ) { log_error("make_keysig_packet failed: %s\n", g10_errstr(rc)); goto leave; diff --git a/g10/seckey-cert.c b/g10/seckey-cert.c index a265a3713..8a5d98299 100644 --- a/g10/seckey-cert.c +++ b/g10/seckey-cert.c @@ -55,7 +55,7 @@ do_check( PKT_secret_cert *cert ) case CIPHER_ALGO_CAST: keyid_from_skc( cert, keyid ); dek = passphrase_to_dek( keyid, cert->protect.algo, - &cert->protect.s2k, 0 ); + &cert->protect.s2k, 0 ); cipher_hd = cipher_open( cert->protect.algo, CIPHER_MODE_AUTO_CFB, 1); cipher_setkey( cipher_hd, dek->key, dek->keylen ); @@ -227,7 +227,7 @@ check_secret_key( PKT_secret_cert *cert ) case PUBKEY_ALGO_ELGAMAL: case PUBKEY_ALGO_DSA: rc = do_check( cert ); - #if 1 /* set to 0 to disable the workaround */ + #if 0 /* set to 1 to enable the workaround */ if( rc == G10ERR_BAD_PASS && cert->is_protected && cert->protect.algo == CIPHER_ALGO_BLOWFISH && cert->pubkey_algo != PUBKEY_ALGO_ELGAMAL ) { @@ -243,11 +243,19 @@ check_secret_key( PKT_secret_cert *cert ) } #endif break; + #ifdef HAVE_RSA_CIPHER + case PUBKEY_ALGO_RSA: + case PUBKEY_ALGO_RSA_E: + case PUBKEY_ALGO_RSA_S: + rc = do_check( cert ); + break; + #endif default: rc = G10ERR_PUBKEY_ALGO; } if( get_passphrase_fd() != -1 ) break; } + return rc; } diff --git a/g10/sign.c b/g10/sign.c index 104aedb42..598f60998 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -170,17 +170,19 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr, if( opt.armor && !outfile ) iobuf_push_filter( out, armor_filter, &afx ); - write_comment( out, "#created by GNUPG v" VERSION " (" + else + write_comment( out, "#created by GNUPG v" VERSION " (" PRINTABLE_OS_NAME ")"); - if( opt.compress && !outfile ) - iobuf_push_filter( out, compress_filter, &zfx ); - if( encrypt ) { efx.pkc_list = pkc_list; /* fixme: set efx.cfx.datalen if known */ iobuf_push_filter( out, encrypt_filter, &efx ); } + if( opt.compress && !outfile ) + iobuf_push_filter( out, compress_filter, &zfx ); + + if( !detached ) { /* loop over the secret certificates and build headers */ for( skc_rover = skc_list; skc_rover; skc_rover = skc_rover->next ) { @@ -410,7 +412,6 @@ int clearsign_file( const char *fname, STRLIST locusr, const char *outfile ) { armor_filter_context_t afx; - compress_filter_context_t zfx; text_filter_context_t tfx; MD_HANDLE textmd = NULL; IOBUF inp = NULL, out = NULL; @@ -420,7 +421,6 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile ) SKC_LIST skc_rover = NULL; memset( &afx, 0, sizeof afx); - memset( &zfx, 0, sizeof zfx); memset( &tfx, 0, sizeof tfx); init_packet( &pkt ); diff --git a/include/ChangeLog b/include/ChangeLog index 9470baee4..b5f086805 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,11 @@ +Thu May 21 13:25:51 1998 Werner Koch (wk@isil.d.shuttle.de) + + * cipher.h: removed ROT 5 and changed one id and add dummy + +Tue May 19 18:09:05 1998 Werner Koch (wk@isil.d.shuttle.de) + + * cipher.h (DIGEST_ALGO_TIGER): Chnaged id from 101 to 6. + Mon May 4 16:37:17 1998 Werner Koch (wk@isil.d.shuttle.de) * cipher.h (PUBKEY_ALGO_ELGAMAL_E): New, with value of the diff --git a/include/cipher.h b/include/cipher.h index a78426bb5..a9349c2f6 100644 --- a/include/cipher.h +++ b/include/cipher.h @@ -42,10 +42,10 @@ #define CIPHER_ALGO_3DES 2 #define CIPHER_ALGO_CAST 3 #define CIPHER_ALGO_BLOWFISH 4 /* blowfish 128 bit key */ -#define CIPHER_ALGO_ROT_N 5 -#define CIPHER_ALGO_SAFER_SK128 6 -#define CIPHER_ALGO_DES_SK 7 +#define CIPHER_ALGO_SAFER_SK128 5 +#define CIPHER_ALGO_DES_SK 6 #define CIPHER_ALGO_BLOWFISH160 42 /* blowfish 160 bit key (not in OpenPGP)*/ +#define CIPHER_ALGO_DUMMY 110 /* no encryption at all */ #define PUBKEY_ALGO_RSA 1 #define PUBKEY_ALGO_RSA_E 2 /* RSA encrypt only */ @@ -58,7 +58,7 @@ #define DIGEST_ALGO_SHA1 2 #define DIGEST_ALGO_RMD160 3 #ifdef WITH_TIGER_HASH -#define DIGEST_ALGO_TIGER 101 +#define DIGEST_ALGO_TIGER 6 #endif #define is_RSA(a) ((a)==PUBKEY_ALGO_RSA || (a)==PUBKEY_ALGO_RSA_E \ @@ -81,6 +81,7 @@ struct cipher_handle_s { char does_not_matter[1]; }; #define CIPHER_MODE_CFB 2 #define CIPHER_MODE_PHILS_CFB 3 #define CIPHER_MODE_AUTO_CFB 4 +#define CIPHER_MODE_DUMMY 5 /* used with algo DUMMY for no encryption */ int cipher_debug_mode; diff --git a/mpi/ChangeLog b/mpi/ChangeLog index 86d7413b2..15da105fe 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,9 @@ +Mon May 18 13:47:06 1998 Werner Koch (wk@isil.d.shuttle.de) + + * config.links: split mpih-shift into mpih-[lr]shift and + changed all implementations. + * mpi/alpha: add some new assembler stuff. + Wed May 13 11:04:29 1998 Werner Koch (wk@isil.d.shuttle.de) * config.links: Add support for MIPS diff --git a/mpi/Makefile.am b/mpi/Makefile.am index e7a50d288..ead60a683 100644 --- a/mpi/Makefile.am +++ b/mpi/Makefile.am @@ -7,7 +7,7 @@ SUFFIXES = .S .s EXTRA_DIST = config.links DISTCLEANFILES = mpih-add1.S mpih-mul1.S mpih-mul2.S mpih-mul3.S \ - mpih-shift.S mpih-sub1.S asm-syntax.h sysdep.h + mpih-lshift.S mpih-rshift.S mpih-sub1.S asm-syntax.h sysdep.h noinst_LIBRARIES = libmpi.a @@ -43,7 +43,8 @@ common_asm_objects = mpih-mul1.o \ mpih-mul3.o \ mpih-add1.o \ mpih-sub1.o \ - mpih-shift.o + mpih-lshift.o \ + mpih-rshift.o libmpi_a_DEPENDENCIES = $(common_asm_objects) @MPI_EXTRA_ASM_OBJS@ libmpi_a_LIBADD = $(common_asm_objects) @MPI_EXTRA_ASM_OBJS@ diff --git a/mpi/Makefile.in b/mpi/Makefile.in index c0db398a7..cd14c3849 100644 --- a/mpi/Makefile.in +++ b/mpi/Makefile.in @@ -98,7 +98,7 @@ SUFFIXES = .S .s EXTRA_DIST = config.links DISTCLEANFILES = mpih-add1.S mpih-mul1.S mpih-mul2.S mpih-mul3.S \ - mpih-shift.S mpih-sub1.S asm-syntax.h sysdep.h + mpih-lshift.S mpih-rshift.S mpih-sub1.S asm-syntax.h sysdep.h noinst_LIBRARIES = libmpi.a # noinst_HEADERS = @@ -131,7 +131,8 @@ common_asm_objects = mpih-mul1.o \ mpih-mul3.o \ mpih-add1.o \ mpih-sub1.o \ - mpih-shift.o + mpih-lshift.o \ + mpih-rshift.o libmpi_a_DEPENDENCIES = $(common_asm_objects) @MPI_EXTRA_ASM_OBJS@ libmpi_a_LIBADD = $(common_asm_objects) @MPI_EXTRA_ASM_OBJS@ diff --git a/mpi/alpha/distfiles b/mpi/alpha/distfiles index e92d183d2..f2ab9fc3c 100644 --- a/mpi/alpha/distfiles +++ b/mpi/alpha/distfiles @@ -1,6 +1,11 @@ README mpih-add1.S -mpih-shift.S +mpih-sub1.S +mpih-mul1.S +mpih-mul2.S +mpih-mul3.S +mpih-lshift.S +mpih-rshift.S udiv-qrnnd.S diff --git a/mpi/alpha/mpih-add1.S b/mpi/alpha/mpih-add1.S index 54cec43fa..dc3bcfbb8 100644 --- a/mpi/alpha/mpih-add1.S +++ b/mpi/alpha/mpih-add1.S @@ -19,14 +19,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * Note: This code is heavily based on the GNU MP Library. - * Actually it's the same code with only minor changes in the - * way the data is stored; this is to support the abstraction - * of an optional secure memory allocation which may be used - * to avoid revealing of sensitive data due to paging etc. - * The GNU MP Library itself is published under the LGPL; - * however I decided to publish this code under the plain GPL. */ diff --git a/mpi/alpha/mpih-shift.S b/mpi/alpha/mpih-lshift.S similarity index 64% rename from mpi/alpha/mpih-shift.S rename to mpi/alpha/mpih-lshift.S index 8bbd10cd3..9688588fa 100644 --- a/mpi/alpha/mpih-shift.S +++ b/mpi/alpha/mpih-lshift.S @@ -1,4 +1,4 @@ -/* alpha rshift, lshift +/* alpha lshift * Copyright (C) 1994, 1995 Free Software Foundation, Inc. * Copyright (C) 1998 Free Software Foundation, Inc. * @@ -120,94 +120,3 @@ mpihelp_lshift: .end mpihelp_lshift - - - -/******************* - * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (r16) - * mpi_ptr_t up, (r17) - * mpi_size_t usize, (r18) - * unsigned cnt) (r19) - * - * This code runs at 4.8 cycles/limb on the 21064. With infinite unrolling, - * it would take 4 cycles/limb. It should be possible to get down to 3 - * cycles/limb since both ldq and stq can be paired with the other used - * instructions. But there are many restrictions in the 21064 pipeline that - * makes it hard, if not impossible, to get down to 3 cycles/limb: - * - * 1. ldq has a 3 cycle delay, srl and sll have a 2 cycle delay. - * 2. Only aligned instruction pairs can be paired. - * 3. The store buffer or silo might not be able to deal with the bandwidth. - */ - - .set noreorder - .set noat -.text - .align 3 - .globl mpihelp_rshift - .ent mpihelp_rshift -mpihelp_rshift: - .frame $30,0,$26,0 - - ldq $4,0($17) # load first limb - addq $17,8,$17 - subq $31,$19,$7 - subq $18,1,$18 - and $18,4-1,$20 # number of limbs in first loop - sll $4,$7,$0 # compute function result - - beq $20,.R0 - subq $18,$20,$18 - - .align 3 -.Roop0: - ldq $3,0($17) - addq $16,8,$16 - addq $17,8,$17 - subq $20,1,$20 - srl $4,$19,$5 - sll $3,$7,$6 - bis $3,$3,$4 - bis $5,$6,$8 - stq $8,-8($16) - bne $20,.Roop0 - -.R0: beq $18,.Rend - - .align 3 -.Roop: ldq $3,0($17) - addq $16,32,$16 - subq $18,4,$18 - srl $4,$19,$5 - sll $3,$7,$6 - - ldq $4,8($17) - srl $3,$19,$1 - bis $5,$6,$8 - stq $8,-32($16) - sll $4,$7,$2 - - ldq $3,16($17) - srl $4,$19,$5 - bis $1,$2,$8 - stq $8,-24($16) - sll $3,$7,$6 - - ldq $4,24($17) - srl $3,$19,$1 - bis $5,$6,$8 - stq $8,-16($16) - sll $4,$7,$2 - - addq $17,32,$17 - bis $1,$2,$8 - stq $8,-8($16) - - bgt $18,.Roop - -.Rend: srl $4,$19,$8 - stq $8,0($16) - ret $31,($26),1 - .end mpihelp_rshift - diff --git a/mpi/alpha/mpih-mul1.S b/mpi/alpha/mpih-mul1.S new file mode 100644 index 000000000..5b24d98d1 --- /dev/null +++ b/mpi/alpha/mpih-mul1.S @@ -0,0 +1,89 @@ +/* Alpha 21064 mpih-mul1.S -- Multiply a limb vector with a limb and store + * the result in a second limb vector. + * + * Copyright (C) 1992, 1994, 1995, 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + +/******************* + * mpi_limb_t + * mpihelp_mul_1( mpi_ptr_t res_ptr, (r16) + * mpi_ptr_t s1_ptr, (r17) + * mpi_size_t s1_size, (r18) + * mpi_limb_t s2_limb) (r19) + * + * This code runs at 42 cycles/limb on the EV4 and 18 cycles/limb on the EV5. + * + * To improve performance for long multiplications, we would use + * 'fetch' for S1 and 'fetch_m' for RES. It's not obvious how to use + * these instructions without slowing down the general code: 1. We can + * only have two prefetches in operation at any time in the Alpha + * architecture. 2. There will seldom be any special alignment + * between RES_PTR and S1_PTR. Maybe we can simply divide the current + * loop into an inner and outer loop, having the inner loop handle + * exactly one prefetch block? + */ + + .set noreorder + .set noat +.text + .align 3 + .globl mpihelp_mul_1 + .ent mpihelp_mul_1 2 +mpihelp_mul_1: + .frame $30,0,$26 + + ldq $2,0($17) # $2 = s1_limb + subq $18,1,$18 # size-- + mulq $2,$19,$3 # $3 = prod_low + bic $31,$31,$4 # clear cy_limb + umulh $2,$19,$0 # $0 = prod_high + beq $18,Lend1 # jump if size was == 1 + ldq $2,8($17) # $2 = s1_limb + subq $18,1,$18 # size-- + stq $3,0($16) + beq $18,Lend2 # jump if size was == 2 + + .align 3 +Loop: mulq $2,$19,$3 # $3 = prod_low + addq $4,$0,$0 # cy_limb = cy_limb + 'cy' + subq $18,1,$18 # size-- + umulh $2,$19,$4 # $4 = cy_limb + ldq $2,16($17) # $2 = s1_limb + addq $17,8,$17 # s1_ptr++ + addq $3,$0,$3 # $3 = cy_limb + prod_low + stq $3,8($16) + cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low) + addq $16,8,$16 # res_ptr++ + bne $18,Loop + +Lend2: mulq $2,$19,$3 # $3 = prod_low + addq $4,$0,$0 # cy_limb = cy_limb + 'cy' + umulh $2,$19,$4 # $4 = cy_limb + addq $3,$0,$3 # $3 = cy_limb + prod_low + cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low) + stq $3,8($16) + addq $4,$0,$0 # cy_limb = prod_high + cy + ret $31,($26),1 +Lend1: stq $3,0($16) + ret $31,($26),1 + + .end mpihelp_mul_1 + + diff --git a/mpi/alpha/mpih-mul2.S b/mpi/alpha/mpih-mul2.S new file mode 100644 index 000000000..0c8d361c3 --- /dev/null +++ b/mpi/alpha/mpih-mul2.S @@ -0,0 +1,96 @@ +/* Alpha 21064 addmul_1 -- Multiply a limb vector with a limb and add + * the result to a second limb vector. + * + * Copyright (C) 1992, 1994, 1995, 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + +/******************* + * mpi_limb_t + * mpihelp_addmul_1( mpi_ptr_t res_ptr, (r16) + * mpi_ptr_t s1_ptr, (r17) + * mpi_size_t s1_size, (r18) + * mpi_limb_t s2_limb) (r19) + * + * This code runs at 42 cycles/limb on EV4 and 18 cycles/limb on EV5. + */ + + + .set noreorder + .set noat +.text + .align 3 + .globl mpihelp_addmul_1 + .ent mpihelp_addmul_1 2 +mpihelp_addmul_1: + .frame $30,0,$26 + + ldq $2,0($17) # $2 = s1_limb + addq $17,8,$17 # s1_ptr++ + subq $18,1,$18 # size-- + mulq $2,$19,$3 # $3 = prod_low + ldq $5,0($16) # $5 = *res_ptr + umulh $2,$19,$0 # $0 = prod_high + beq $18,.Lend1 # jump if size was == 1 + ldq $2,0($17) # $2 = s1_limb + addq $17,8,$17 # s1_ptr++ + subq $18,1,$18 # size-- + addq $5,$3,$3 + cmpult $3,$5,$4 + stq $3,0($16) + addq $16,8,$16 # res_ptr++ + beq $18,.Lend2 # jump if size was == 2 + + .align 3 +.Loop: mulq $2,$19,$3 # $3 = prod_low + ldq $5,0($16) # $5 = *res_ptr + addq $4,$0,$0 # cy_limb = cy_limb + 'cy' + subq $18,1,$18 # size-- + umulh $2,$19,$4 # $4 = cy_limb + ldq $2,0($17) # $2 = s1_limb + addq $17,8,$17 # s1_ptr++ + addq $3,$0,$3 # $3 = cy_limb + prod_low + cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low) + addq $5,$3,$3 + cmpult $3,$5,$5 + stq $3,0($16) + addq $16,8,$16 # res_ptr++ + addq $5,$0,$0 # combine carries + bne $18,.Loop + +.Lend2: mulq $2,$19,$3 # $3 = prod_low + ldq $5,0($16) # $5 = *res_ptr + addq $4,$0,$0 # cy_limb = cy_limb + 'cy' + umulh $2,$19,$4 # $4 = cy_limb + addq $3,$0,$3 # $3 = cy_limb + prod_low + cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low) + addq $5,$3,$3 + cmpult $3,$5,$5 + stq $3,0($16) + addq $5,$0,$0 # combine carries + addq $4,$0,$0 # cy_limb = prod_high + cy + ret $31,($26),1 +.Lend1: addq $5,$3,$3 + cmpult $3,$5,$5 + stq $3,0($16) + addq $0,$5,$0 + ret $31,($26),1 + + .end mpihelp_addmul_1 + diff --git a/mpi/alpha/mpih-mul3.S b/mpi/alpha/mpih-mul3.S new file mode 100644 index 000000000..bdf16b57b --- /dev/null +++ b/mpi/alpha/mpih-mul3.S @@ -0,0 +1,94 @@ +/* Alpha 21064 submul_1 -- Multiply a limb vector with a limb and + * subtract the result from a second limb vector. + * Copyright (C) 1992, 1994, 1995, 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + +/******************* + * mpi_limb_t + * mpihelp_submul_1( mpi_ptr_t res_ptr, (r16 ) + * mpi_ptr_t s1_ptr, (r17 ) + * mpi_size_t s1_size, (r18 ) + * mpi_limb_t s2_limb) (r19 ) + * + * This code runs at 42 cycles/limb on EV4 and 18 cycles/limb on EV5. + */ + + .set noreorder + .set noat +.text + .align 3 + .globl mpihelp_submul_1 + .ent mpihelp_submul_1 2 +mpihelp_submul_1: + .frame $30,0,$26 + + ldq $2,0($17) # $2 = s1_limb + addq $17,8,$17 # s1_ptr++ + subq $18,1,$18 # size-- + mulq $2,$19,$3 # $3 = prod_low + ldq $5,0($16) # $5 = *res_ptr + umulh $2,$19,$0 # $0 = prod_high + beq $18,.Lend1 # jump if size was == 1 + ldq $2,0($17) # $2 = s1_limb + addq $17,8,$17 # s1_ptr++ + subq $18,1,$18 # size-- + subq $5,$3,$3 + cmpult $5,$3,$4 + stq $3,0($16) + addq $16,8,$16 # res_ptr++ + beq $18,.Lend2 # jump if size was == 2 + + .align 3 +.Loop: mulq $2,$19,$3 # $3 = prod_low + ldq $5,0($16) # $5 = *res_ptr + addq $4,$0,$0 # cy_limb = cy_limb + 'cy' + subq $18,1,$18 # size-- + umulh $2,$19,$4 # $4 = cy_limb + ldq $2,0($17) # $2 = s1_limb + addq $17,8,$17 # s1_ptr++ + addq $3,$0,$3 # $3 = cy_limb + prod_low + cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low) + subq $5,$3,$3 + cmpult $5,$3,$5 + stq $3,0($16) + addq $16,8,$16 # res_ptr++ + addq $5,$0,$0 # combine carries + bne $18,.Loop + +.Lend2: mulq $2,$19,$3 # $3 = prod_low + ldq $5,0($16) # $5 = *res_ptr + addq $4,$0,$0 # cy_limb = cy_limb + 'cy' + umulh $2,$19,$4 # $4 = cy_limb + addq $3,$0,$3 # $3 = cy_limb + prod_low + cmpult $3,$0,$0 # $0 = carry from (cy_limb + prod_low) + subq $5,$3,$3 + cmpult $5,$3,$5 + stq $3,0($16) + addq $5,$0,$0 # combine carries + addq $4,$0,$0 # cy_limb = prod_high + cy + ret $31,($26),1 +.Lend1: subq $5,$3,$3 + cmpult $5,$3,$5 + stq $3,0($16) + addq $0,$5,$0 + ret $31,($26),1 + + .end mpihelp_submul_1 + diff --git a/mpi/alpha/mpih-rshift.S b/mpi/alpha/mpih-rshift.S new file mode 100644 index 000000000..e93315ae2 --- /dev/null +++ b/mpi/alpha/mpih-rshift.S @@ -0,0 +1,120 @@ +/* alpha rshift + * Copyright (C) 1994, 1995 Free Software Foundation, Inc. + * Copyright (C) 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * Note: This code is heavily based on the GNU MP Library. + * Actually it's the same code with only minor changes in the + * way the data is stored; this is to support the abstraction + * of an optional secure memory allocation which may be used + * to avoid revealing of sensitive data due to paging etc. + * The GNU MP Library itself is published under the LGPL; + * however I decided to publish this code under the plain GPL. + */ + + + + +/******************* + * mpi_limb_t + * mpihelp_rshift( mpi_ptr_t wp, (r16) + * mpi_ptr_t up, (r17) + * mpi_size_t usize, (r18) + * unsigned cnt) (r19) + * + * This code runs at 4.8 cycles/limb on the 21064. With infinite unrolling, + * it would take 4 cycles/limb. It should be possible to get down to 3 + * cycles/limb since both ldq and stq can be paired with the other used + * instructions. But there are many restrictions in the 21064 pipeline that + * makes it hard, if not impossible, to get down to 3 cycles/limb: + * + * 1. ldq has a 3 cycle delay, srl and sll have a 2 cycle delay. + * 2. Only aligned instruction pairs can be paired. + * 3. The store buffer or silo might not be able to deal with the bandwidth. + */ + + .set noreorder + .set noat +.text + .align 3 + .globl mpihelp_rshift + .ent mpihelp_rshift +mpihelp_rshift: + .frame $30,0,$26,0 + + ldq $4,0($17) # load first limb + addq $17,8,$17 + subq $31,$19,$7 + subq $18,1,$18 + and $18,4-1,$20 # number of limbs in first loop + sll $4,$7,$0 # compute function result + + beq $20,.R0 + subq $18,$20,$18 + + .align 3 +.Roop0: + ldq $3,0($17) + addq $16,8,$16 + addq $17,8,$17 + subq $20,1,$20 + srl $4,$19,$5 + sll $3,$7,$6 + bis $3,$3,$4 + bis $5,$6,$8 + stq $8,-8($16) + bne $20,.Roop0 + +.R0: beq $18,.Rend + + .align 3 +.Roop: ldq $3,0($17) + addq $16,32,$16 + subq $18,4,$18 + srl $4,$19,$5 + sll $3,$7,$6 + + ldq $4,8($17) + srl $3,$19,$1 + bis $5,$6,$8 + stq $8,-32($16) + sll $4,$7,$2 + + ldq $3,16($17) + srl $4,$19,$5 + bis $1,$2,$8 + stq $8,-24($16) + sll $3,$7,$6 + + ldq $4,24($17) + srl $3,$19,$1 + bis $5,$6,$8 + stq $8,-16($16) + sll $4,$7,$2 + + addq $17,32,$17 + bis $1,$2,$8 + stq $8,-8($16) + + bgt $18,.Roop + +.Rend: srl $4,$19,$8 + stq $8,0($16) + ret $31,($26),1 + .end mpihelp_rshift + diff --git a/mpi/alpha/mpih-sub1.S b/mpi/alpha/mpih-sub1.S new file mode 100644 index 000000000..bf614309b --- /dev/null +++ b/mpi/alpha/mpih-sub1.S @@ -0,0 +1,123 @@ +/* Alpha sub_n -- Subtract two limb vectors of the same length > 0 and + * store difference in a third limb vector. + * Copyright (C) 1995, 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + +/******************* + * mpi_limb_t + * mpihelp_sub_n( mpi_ptr_t res_ptr, (r16) + * mpi_ptr_t s1_ptr, (r17) + * mpi_ptr_t s2_ptr, (r18) + * mpi_size_t size) (r19) + */ + + .set noreorder + .set noat +.text + .align 3 + .globl mpihelp_sub_n + .ent mpihelp_sub_n +mpihelp_sub_n: + .frame $30,0,$26,0 + + ldq $3,0($17) + ldq $4,0($18) + + subq $19,1,$19 + and $19,4-1,$2 # number of limbs in first loop + bis $31,$31,$0 + beq $2,.L0 # if multiple of 4 limbs, skip first loop + + subq $19,$2,$19 + +.Loop0: subq $2,1,$2 + ldq $5,8($17) + addq $4,$0,$4 + ldq $6,8($18) + cmpult $4,$0,$1 + subq $3,$4,$4 + cmpult $3,$4,$0 + stq $4,0($16) + or $0,$1,$0 + + addq $17,8,$17 + addq $18,8,$18 + bis $5,$5,$3 + bis $6,$6,$4 + addq $16,8,$16 + bne $2,.Loop0 + +.L0: beq $19,.Lend + + .align 3 +.Loop: subq $19,4,$19 + + ldq $5,8($17) + addq $4,$0,$4 + ldq $6,8($18) + cmpult $4,$0,$1 + subq $3,$4,$4 + cmpult $3,$4,$0 + stq $4,0($16) + or $0,$1,$0 + + ldq $3,16($17) + addq $6,$0,$6 + ldq $4,16($18) + cmpult $6,$0,$1 + subq $5,$6,$6 + cmpult $5,$6,$0 + stq $6,8($16) + or $0,$1,$0 + + ldq $5,24($17) + addq $4,$0,$4 + ldq $6,24($18) + cmpult $4,$0,$1 + subq $3,$4,$4 + cmpult $3,$4,$0 + stq $4,16($16) + or $0,$1,$0 + + ldq $3,32($17) + addq $6,$0,$6 + ldq $4,32($18) + cmpult $6,$0,$1 + subq $5,$6,$6 + cmpult $5,$6,$0 + stq $6,24($16) + or $0,$1,$0 + + addq $17,32,$17 + addq $18,32,$18 + addq $16,32,$16 + bne $19,.Loop + +.Lend: addq $4,$0,$4 + cmpult $4,$0,$1 + subq $3,$4,$4 + cmpult $3,$4,$0 + stq $4,0($16) + or $0,$1,$0 + ret $31,($26),1 + + .end mpihelp_sub_n + + diff --git a/mpi/config.links b/mpi/config.links index 699ca8580..bd525abc1 100644 --- a/mpi/config.links +++ b/mpi/config.links @@ -150,7 +150,7 @@ fi # fixme: grep these modules from Makefile.in mpi_ln_modules="${mpi_extra_modules} mpih-add1 mpih-mul1 mpih-mul2 mpih-mul3 \ - mpih-shift mpih-sub1" + mpih-lshift mpih-rshift mpih-sub1" mpi_ln_objects= mpi_ln_src= diff --git a/mpi/generic/distfiles b/mpi/generic/distfiles index 1febb49dd..02a1ca4c6 100644 --- a/mpi/generic/distfiles +++ b/mpi/generic/distfiles @@ -2,6 +2,7 @@ mpih-add1.c mpih-mul1.c mpih-mul2.c mpih-mul3.c -mpih-shift.c +mpih-lshift.c +mpih-rshift.c mpih-sub1.c diff --git a/mpi/hppa/distfiles b/mpi/hppa/distfiles index 83c59ea62..7f24205d3 100644 --- a/mpi/hppa/distfiles +++ b/mpi/hppa/distfiles @@ -2,5 +2,6 @@ README udiv-qrnnd.S mpih-add1.S mpih-sub1.S -mpih-shift.S +mpih-lshift.S +mpih-rshift.S diff --git a/mpi/hppa/mpih-shift.S b/mpi/hppa/mpih-lshift.S similarity index 53% rename from mpi/hppa/mpih-shift.S rename to mpi/hppa/mpih-lshift.S index 153fbd7f0..ada09f595 100644 --- a/mpi/hppa/mpih-shift.S +++ b/mpi/hppa/mpih-lshift.S @@ -1,6 +1,6 @@ -/* hppa rshift, lshift - * Copyright (C) 1992, 1994 Free Software Foundation, Inc. - * Copyright (C) 1998 Free Software Foundation, Inc. +/* hppa lshift +* + * Copyright (C) 1992, 1994, 1998 Free Software Foundation, Inc. * * This file is part of GNUPG. * @@ -17,14 +17,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * Note: This code is heavily based on the GNU MP Library. - * Actually it's the same code with only minor changes in the - * way the data is stored; this is to support the abstraction - * of an optional secure memory allocation which may be used - * to avoid revealing of sensitive data due to paging etc. - * The GNU MP Library itself is published under the LGPL; - * however I decided to publish this code under the plain GPL. */ @@ -78,47 +70,3 @@ L$0004 vshd %r22,%r0,%r20 -/******************* - * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (gr26) - * mpi_ptr_t up, (gr25) - * mpi_size_t usize, (gr24) - * unsigned cnt) (gr23) - */ - - .code - .export mpihelp_rshift -mpihelp_rshift - .proc - .callinfo frame=64,no_calls - .entry - - ldws,ma 4(0,%r25),%r22 - mtsar %r23 - addib,= -1,%r24,L$r004 - vshd %r22,%r0,%r28 ; compute carry out limb - ldws,ma 4(0,%r25),%r29 - addib,= -1,%r24,L$r002 - vshd %r29,%r22,%r20 - -L$roop ldws,ma 4(0,%r25),%r22 - stws,ma %r20,4(0,%r26) - addib,= -1,%r24,L$r003 - vshd %r22,%r29,%r20 - ldws,ma 4(0,%r25),%r29 - stws,ma %r20,4(0,%r26) - addib,<> -1,%r24,L$roop - vshd %r29,%r22,%r20 - -L$r002 stws,ma %r20,4(0,%r26) - vshd %r0,%r29,%r20 - bv 0(%r2) - stw %r20,0(0,%r26) -L$r003 stws,ma %r20,4(0,%r26) -L$r004 vshd %r0,%r22,%r20 - bv 0(%r2) - stw %r20,0(0,%r26) - - .exit - .procend - diff --git a/mpi/hppa/mpih-rshift.S b/mpi/hppa/mpih-rshift.S new file mode 100644 index 000000000..0299d2e27 --- /dev/null +++ b/mpi/hppa/mpih-rshift.S @@ -0,0 +1,68 @@ +/* hppa rshift +* + * Copyright (C) 1992, 1994, 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + + + +/******************* + * mpi_limb_t + * mpihelp_rshift( mpi_ptr_t wp, (gr26) + * mpi_ptr_t up, (gr25) + * mpi_size_t usize, (gr24) + * unsigned cnt) (gr23) + */ + + .code + .export mpihelp_rshift +mpihelp_rshift + .proc + .callinfo frame=64,no_calls + .entry + + ldws,ma 4(0,%r25),%r22 + mtsar %r23 + addib,= -1,%r24,L$r004 + vshd %r22,%r0,%r28 ; compute carry out limb + ldws,ma 4(0,%r25),%r29 + addib,= -1,%r24,L$r002 + vshd %r29,%r22,%r20 + +L$roop ldws,ma 4(0,%r25),%r22 + stws,ma %r20,4(0,%r26) + addib,= -1,%r24,L$r003 + vshd %r22,%r29,%r20 + ldws,ma 4(0,%r25),%r29 + stws,ma %r20,4(0,%r26) + addib,<> -1,%r24,L$roop + vshd %r29,%r22,%r20 + +L$r002 stws,ma %r20,4(0,%r26) + vshd %r0,%r29,%r20 + bv 0(%r2) + stw %r20,0(0,%r26) +L$r003 stws,ma %r20,4(0,%r26) +L$r004 vshd %r0,%r22,%r20 + bv 0(%r2) + stw %r20,0(0,%r26) + + .exit + .procend + diff --git a/mpi/i386/distfiles b/mpi/i386/distfiles index 34de91574..88d2a30c7 100644 --- a/mpi/i386/distfiles +++ b/mpi/i386/distfiles @@ -2,7 +2,8 @@ mpih-add1.S mpih-mul1.S mpih-mul2.S mpih-mul3.S -mpih-shift.S +mpih-lshift.S +mpih-rshift.S mpih-sub1.S syntax.h diff --git a/mpi/i386/mpih-lshift.S b/mpi/i386/mpih-lshift.S new file mode 100644 index 000000000..a84f6b1f9 --- /dev/null +++ b/mpi/i386/mpih-lshift.S @@ -0,0 +1,96 @@ +/* i80386 lshift + * Copyright (C) 1998 Free Software Foundation, Inc. + * Copyright (C) 1992, 1994 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * Note: This code is heavily based on the GNU MP Library. + * Actually it's the same code with only minor changes in the + * way the data is stored; this is to support the abstraction + * of an optional secure memory allocation which may be used + * to avoid revealing of sensitive data due to paging etc. + * The GNU MP Library itself is published under the LGPL; + * however I decided to publish this code under the plain GPL. + */ + + +#include "sysdep.h" +#include "asm-syntax.h" + + +/******************* + * mpi_limb_t + * mpihelp_lshift( mpi_ptr_t wp, (sp + 4) + * mpi_ptr_t up, (sp + 8) + * mpi_size_t usize, (sp + 12) + * unsigned cnt) (sp + 16) + */ + +.text + ALIGN (3) + .globl C_SYMBOL_NAME(mpihelp_lshift) +C_SYMBOL_NAME(mpihelp_lshift:) + pushl %edi + pushl %esi + pushl %ebx + + movl 16(%esp),%edi /* res_ptr */ + movl 20(%esp),%esi /* s_ptr */ + movl 24(%esp),%edx /* size */ + movl 28(%esp),%ecx /* cnt */ + + subl $4,%esi /* adjust s_ptr */ + + movl (%esi,%edx,4),%ebx /* read most significant limb */ + xorl %eax,%eax + shldl %cl,%ebx,%eax /* compute carry limb */ + decl %edx + jz Lend + pushl %eax /* push carry limb onto stack */ + testb $1,%edx + jnz L1 /* enter loop in the middle */ + movl %ebx,%eax + + ALIGN (3) +Loop: movl (%esi,%edx,4),%ebx /* load next lower limb */ + shldl %cl,%ebx,%eax /* compute result limb */ + movl %eax,(%edi,%edx,4) /* store it */ + decl %edx +L1: movl (%esi,%edx,4),%eax + shldl %cl,%eax,%ebx + movl %ebx,(%edi,%edx,4) + decl %edx + jnz Loop + + shll %cl,%eax /* compute least significant limb */ + movl %eax,(%edi) /* store it */ + + popl %eax /* pop carry limb */ + + popl %ebx + popl %esi + popl %edi + ret + +Lend: shll %cl,%ebx /* compute least significant limb */ + movl %ebx,(%edi) /* store it */ + + popl %ebx + popl %esi + popl %edi + ret + diff --git a/mpi/i386/mpih-shift.S b/mpi/i386/mpih-rshift.S similarity index 66% rename from mpi/i386/mpih-shift.S rename to mpi/i386/mpih-rshift.S index f10f268e5..3dd9caf7e 100644 --- a/mpi/i386/mpih-shift.S +++ b/mpi/i386/mpih-rshift.S @@ -1,4 +1,4 @@ -/* i80386 rshift, lshift +/* i80386 rshift * Copyright (C) 1998 Free Software Foundation, Inc. * Copyright (C) 1992, 1994 Free Software Foundation, Inc. * @@ -32,68 +32,6 @@ #include "asm-syntax.h" -/******************* - * mpi_limb_t - * mpihelp_lshift( mpi_ptr_t wp, (sp + 4) - * mpi_ptr_t up, (sp + 8) - * mpi_size_t usize, (sp + 12) - * unsigned cnt) (sp + 16) - */ - -.text - ALIGN (3) - .globl C_SYMBOL_NAME(mpihelp_lshift) -C_SYMBOL_NAME(mpihelp_lshift:) - pushl %edi - pushl %esi - pushl %ebx - - movl 16(%esp),%edi /* res_ptr */ - movl 20(%esp),%esi /* s_ptr */ - movl 24(%esp),%edx /* size */ - movl 28(%esp),%ecx /* cnt */ - - subl $4,%esi /* adjust s_ptr */ - - movl (%esi,%edx,4),%ebx /* read most significant limb */ - xorl %eax,%eax - shldl %cl,%ebx,%eax /* compute carry limb */ - decl %edx - jz Lend - pushl %eax /* push carry limb onto stack */ - testb $1,%edx - jnz L1 /* enter loop in the middle */ - movl %ebx,%eax - - ALIGN (3) -Loop: movl (%esi,%edx,4),%ebx /* load next lower limb */ - shldl %cl,%ebx,%eax /* compute result limb */ - movl %eax,(%edi,%edx,4) /* store it */ - decl %edx -L1: movl (%esi,%edx,4),%eax - shldl %cl,%eax,%ebx - movl %ebx,(%edi,%edx,4) - decl %edx - jnz Loop - - shll %cl,%eax /* compute least significant limb */ - movl %eax,(%edi) /* store it */ - - popl %eax /* pop carry limb */ - - popl %ebx - popl %esi - popl %edi - ret - -Lend: shll %cl,%ebx /* compute least significant limb */ - movl %ebx,(%edi) /* store it */ - - popl %ebx - popl %esi - popl %edi - ret - /******************* * mpi_limb_t * mpihelp_rshift( mpi_ptr_t wp, (sp + 4) diff --git a/mpi/i586/distfiles b/mpi/i586/distfiles index 951480fde..8f821fbfb 100644 --- a/mpi/i586/distfiles +++ b/mpi/i586/distfiles @@ -2,7 +2,8 @@ mpih-add1.S mpih-mul1.S mpih-mul2.S mpih-mul3.S -mpih-shift.S +mpih-lshift.S +mpih-rshift.S mpih-sub1.S README diff --git a/mpi/i586/mpih-lshift.S b/mpi/i586/mpih-lshift.S new file mode 100644 index 000000000..9e0cb0297 --- /dev/null +++ b/mpi/i586/mpih-lshift.S @@ -0,0 +1,230 @@ +/* i80586 lshift + * Copyright (C) 1998 Free Software Foundation, Inc. + * Copyright (C) 1992, 1994 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * Note: This code is heavily based on the GNU MP Library. + * Actually it's the same code with only minor changes in the + * way the data is stored; this is to support the abstraction + * of an optional secure memory allocation which may be used + * to avoid revealing of sensitive data due to paging etc. + * The GNU MP Library itself is published under the LGPL; + * however I decided to publish this code under the plain GPL. + */ + + +#include "sysdep.h" +#include "asm-syntax.h" + + +/******************* + * mpi_limb_t + * mpihelp_lshift( mpi_ptr_t wp, (sp + 4) + * mpi_ptr_t up, (sp + 8) + * mpi_size_t usize, (sp + 12) + * unsigned cnt) (sp + 16) + */ + +.text + ALIGN (3) + .globl C_SYMBOL_NAME(mpihelp_lshift) +C_SYMBOL_NAME(mpihelp_lshift:) + + pushl %edi + pushl %esi + pushl %ebx + pushl %ebp + + movl 20(%esp),%edi /* res_ptr */ + movl 24(%esp),%esi /* s_ptr */ + movl 28(%esp),%ebp /* size */ + movl 32(%esp),%ecx /* cnt */ + +/* We can use faster code for shift-by-1 under certain conditions. */ + cmp $1,%ecx + jne Lnormal + leal 4(%esi),%eax + cmpl %edi,%eax + jnc Lspecial /* jump if s_ptr + 1 >= res_ptr */ + leal (%esi,%ebp,4),%eax + cmpl %eax,%edi + jnc Lspecial /* jump if res_ptr >= s_ptr + size */ + +Lnormal: + leal -4(%edi,%ebp,4),%edi + leal -4(%esi,%ebp,4),%esi + + movl (%esi),%edx + subl $4,%esi + xorl %eax,%eax + shldl %cl,%edx,%eax /* compute carry limb */ + pushl %eax /* push carry limb onto stack */ + + decl %ebp + pushl %ebp + shrl $3,%ebp + jz Lend + + movl (%edi),%eax /* fetch destination cache line */ + + ALIGN (2) +Loop: movl -28(%edi),%eax /* fetch destination cache line */ + movl %edx,%ebx + + movl (%esi),%eax + movl -4(%esi),%edx + shldl %cl,%eax,%ebx + shldl %cl,%edx,%eax + movl %ebx,(%edi) + movl %eax,-4(%edi) + + movl -8(%esi),%ebx + movl -12(%esi),%eax + shldl %cl,%ebx,%edx + shldl %cl,%eax,%ebx + movl %edx,-8(%edi) + movl %ebx,-12(%edi) + + movl -16(%esi),%edx + movl -20(%esi),%ebx + shldl %cl,%edx,%eax + shldl %cl,%ebx,%edx + movl %eax,-16(%edi) + movl %edx,-20(%edi) + + movl -24(%esi),%eax + movl -28(%esi),%edx + shldl %cl,%eax,%ebx + shldl %cl,%edx,%eax + movl %ebx,-24(%edi) + movl %eax,-28(%edi) + + subl $32,%esi + subl $32,%edi + decl %ebp + jnz Loop + +Lend: popl %ebp + andl $7,%ebp + jz Lend2 +Loop2: movl (%esi),%eax + shldl %cl,%eax,%edx + movl %edx,(%edi) + movl %eax,%edx + subl $4,%esi + subl $4,%edi + decl %ebp + jnz Loop2 + +Lend2: shll %cl,%edx /* compute least significant limb */ + movl %edx,(%edi) /* store it */ + + popl %eax /* pop carry limb */ + + popl %ebp + popl %ebx + popl %esi + popl %edi + ret + +/* We loop from least significant end of the arrays, which is only + permissable if the source and destination don't overlap, since the + function is documented to work for overlapping source and destination. +*/ + +Lspecial: + movl (%esi),%edx + addl $4,%esi + + decl %ebp + pushl %ebp + shrl $3,%ebp + + addl %edx,%edx + incl %ebp + decl %ebp + jz LLend + + movl (%edi),%eax /* fetch destination cache line */ + + ALIGN (2) +LLoop: movl 28(%edi),%eax /* fetch destination cache line */ + movl %edx,%ebx + + movl (%esi),%eax + movl 4(%esi),%edx + adcl %eax,%eax + movl %ebx,(%edi) + adcl %edx,%edx + movl %eax,4(%edi) + + movl 8(%esi),%ebx + movl 12(%esi),%eax + adcl %ebx,%ebx + movl %edx,8(%edi) + adcl %eax,%eax + movl %ebx,12(%edi) + + movl 16(%esi),%edx + movl 20(%esi),%ebx + adcl %edx,%edx + movl %eax,16(%edi) + adcl %ebx,%ebx + movl %edx,20(%edi) + + movl 24(%esi),%eax + movl 28(%esi),%edx + adcl %eax,%eax + movl %ebx,24(%edi) + adcl %edx,%edx + movl %eax,28(%edi) + + leal 32(%esi),%esi /* use leal not to clobber carry */ + leal 32(%edi),%edi + decl %ebp + jnz LLoop + +LLend: popl %ebp + sbbl %eax,%eax /* save carry in %eax */ + andl $7,%ebp + jz LLend2 + addl %eax,%eax /* restore carry from eax */ +LLoop2: movl %edx,%ebx + movl (%esi),%edx + adcl %edx,%edx + movl %ebx,(%edi) + + leal 4(%esi),%esi /* use leal not to clobber carry */ + leal 4(%edi),%edi + decl %ebp + jnz LLoop2 + + jmp LL1 +LLend2: addl %eax,%eax /* restore carry from eax */ +LL1: movl %edx,(%edi) /* store last limb */ + + sbbl %eax,%eax + negl %eax + + popl %ebp + popl %ebx + popl %esi + popl %edi + ret + + diff --git a/mpi/i586/mpih-shift.S b/mpi/i586/mpih-rshift.S similarity index 57% rename from mpi/i586/mpih-shift.S rename to mpi/i586/mpih-rshift.S index 07d5fbc84..aec26e64d 100644 --- a/mpi/i586/mpih-shift.S +++ b/mpi/i586/mpih-rshift.S @@ -1,4 +1,4 @@ -/* i80586 rshift, lshift +/* i80586 rshift * Copyright (C) 1998 Free Software Foundation, Inc. * Copyright (C) 1992, 1994 Free Software Foundation, Inc. * @@ -32,203 +32,6 @@ #include "asm-syntax.h" -/******************* - * mpi_limb_t - * mpihelp_lshift( mpi_ptr_t wp, (sp + 4) - * mpi_ptr_t up, (sp + 8) - * mpi_size_t usize, (sp + 12) - * unsigned cnt) (sp + 16) - */ - -.text - ALIGN (3) - .globl C_SYMBOL_NAME(mpihelp_lshift) -C_SYMBOL_NAME(mpihelp_lshift:) - - pushl %edi - pushl %esi - pushl %ebx - pushl %ebp - - movl 20(%esp),%edi /* res_ptr */ - movl 24(%esp),%esi /* s_ptr */ - movl 28(%esp),%ebp /* size */ - movl 32(%esp),%ecx /* cnt */ - -/* We can use faster code for shift-by-1 under certain conditions. */ - cmp $1,%ecx - jne Lnormal - leal 4(%esi),%eax - cmpl %edi,%eax - jnc Lspecial /* jump if s_ptr + 1 >= res_ptr */ - leal (%esi,%ebp,4),%eax - cmpl %eax,%edi - jnc Lspecial /* jump if res_ptr >= s_ptr + size */ - -Lnormal: - leal -4(%edi,%ebp,4),%edi - leal -4(%esi,%ebp,4),%esi - - movl (%esi),%edx - subl $4,%esi - xorl %eax,%eax - shldl %cl,%edx,%eax /* compute carry limb */ - pushl %eax /* push carry limb onto stack */ - - decl %ebp - pushl %ebp - shrl $3,%ebp - jz Lend - - movl (%edi),%eax /* fetch destination cache line */ - - ALIGN (2) -Loop: movl -28(%edi),%eax /* fetch destination cache line */ - movl %edx,%ebx - - movl (%esi),%eax - movl -4(%esi),%edx - shldl %cl,%eax,%ebx - shldl %cl,%edx,%eax - movl %ebx,(%edi) - movl %eax,-4(%edi) - - movl -8(%esi),%ebx - movl -12(%esi),%eax - shldl %cl,%ebx,%edx - shldl %cl,%eax,%ebx - movl %edx,-8(%edi) - movl %ebx,-12(%edi) - - movl -16(%esi),%edx - movl -20(%esi),%ebx - shldl %cl,%edx,%eax - shldl %cl,%ebx,%edx - movl %eax,-16(%edi) - movl %edx,-20(%edi) - - movl -24(%esi),%eax - movl -28(%esi),%edx - shldl %cl,%eax,%ebx - shldl %cl,%edx,%eax - movl %ebx,-24(%edi) - movl %eax,-28(%edi) - - subl $32,%esi - subl $32,%edi - decl %ebp - jnz Loop - -Lend: popl %ebp - andl $7,%ebp - jz Lend2 -Loop2: movl (%esi),%eax - shldl %cl,%eax,%edx - movl %edx,(%edi) - movl %eax,%edx - subl $4,%esi - subl $4,%edi - decl %ebp - jnz Loop2 - -Lend2: shll %cl,%edx /* compute least significant limb */ - movl %edx,(%edi) /* store it */ - - popl %eax /* pop carry limb */ - - popl %ebp - popl %ebx - popl %esi - popl %edi - ret - -/* We loop from least significant end of the arrays, which is only - permissable if the source and destination don't overlap, since the - function is documented to work for overlapping source and destination. -*/ - -Lspecial: - movl (%esi),%edx - addl $4,%esi - - decl %ebp - pushl %ebp - shrl $3,%ebp - - addl %edx,%edx - incl %ebp - decl %ebp - jz LLend - - movl (%edi),%eax /* fetch destination cache line */ - - ALIGN (2) -LLoop: movl 28(%edi),%eax /* fetch destination cache line */ - movl %edx,%ebx - - movl (%esi),%eax - movl 4(%esi),%edx - adcl %eax,%eax - movl %ebx,(%edi) - adcl %edx,%edx - movl %eax,4(%edi) - - movl 8(%esi),%ebx - movl 12(%esi),%eax - adcl %ebx,%ebx - movl %edx,8(%edi) - adcl %eax,%eax - movl %ebx,12(%edi) - - movl 16(%esi),%edx - movl 20(%esi),%ebx - adcl %edx,%edx - movl %eax,16(%edi) - adcl %ebx,%ebx - movl %edx,20(%edi) - - movl 24(%esi),%eax - movl 28(%esi),%edx - adcl %eax,%eax - movl %ebx,24(%edi) - adcl %edx,%edx - movl %eax,28(%edi) - - leal 32(%esi),%esi /* use leal not to clobber carry */ - leal 32(%edi),%edi - decl %ebp - jnz LLoop - -LLend: popl %ebp - sbbl %eax,%eax /* save carry in %eax */ - andl $7,%ebp - jz LLend2 - addl %eax,%eax /* restore carry from eax */ -LLoop2: movl %edx,%ebx - movl (%esi),%edx - adcl %edx,%edx - movl %ebx,(%edi) - - leal 4(%esi),%esi /* use leal not to clobber carry */ - leal 4(%edi),%edi - decl %ebp - jnz LLoop2 - - jmp LL1 -LLend2: addl %eax,%eax /* restore carry from eax */ -LL1: movl %edx,(%edi) /* store last limb */ - - sbbl %eax,%eax - negl %eax - - popl %ebp - popl %ebx - popl %esi - popl %edi - ret - - - /******************* * mpi_limb_t diff --git a/mpi/m68k/distfiles b/mpi/m68k/distfiles index c69629e7b..4c0967b84 100644 --- a/mpi/m68k/distfiles +++ b/mpi/m68k/distfiles @@ -1,5 +1,6 @@ syntax.h -mpih-shift.S +mpih-lshift.S +mpih-rshift.S mpih-add1.S mpih-sub1.S diff --git a/mpi/m68k/mpih-shift.S b/mpi/m68k/mpih-lshift.S similarity index 52% rename from mpi/m68k/mpih-shift.S rename to mpi/m68k/mpih-lshift.S index 09b1bcd57..af305c847 100644 --- a/mpi/m68k/mpih-shift.S +++ b/mpi/m68k/mpih-lshift.S @@ -1,15 +1,15 @@ -/* mc68020 __mpn_lshift -- Shift left a low-level natural-number integer. +/* mc68020 lshift -- Shift left a low-level natural-number integer. -Copyright (C) 1996 Free Software Foundation, Inc. +Copyright (C) 1996, 1998 Free Software Foundation, Inc. -This file is part of the GNU MP Library. +This file is part of GNUPG. -The GNU MP Library is free software; you can redistribute it and/or modify +GNUPG is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -The GNU MP Library is distributed in the hope that it will be useful, but +GNUPG is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. @@ -17,7 +17,8 @@ License for more details. You should have received a copy of the GNU Library General Public License along with the GNU MP Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -MA 02111-1307, USA. */ +MA 02111-1307, USA. +*/ #include "sysdep.h" #include "asm-syntax.h" @@ -154,133 +155,4 @@ EPILOG(mpihelp_lshift) -/******************* - * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (sp + 4) - * mpi_ptr_t up, (sp + 8) - * mpi_size_t usize, (sp + 12) - * unsigned cnt) (sp + 16) - */ - -#define res_ptr a1 -#define s_ptr a0 -#define s_size d6 -#define cnt d4 - - TEXT - ALIGN - GLOBL C_SYMBOL_NAME(mpihelp_rshift) - -C_SYMBOL_NAME(mpihelp_rshift:) -PROLOG(mpihelp_rshift) - /* Save used registers on the stack. */ - moveml R(d2)-R(d6)/R(a2),MEM_PREDEC(sp) - - /* Copy the arguments to registers. */ - movel MEM_DISP(sp,28),R(res_ptr) - movel MEM_DISP(sp,32),R(s_ptr) - movel MEM_DISP(sp,36),R(s_size) - movel MEM_DISP(sp,40),R(cnt) - - moveql #1,R(d5) - cmpl R(d5),R(cnt) - bne L(Rnormal) - cmpl R(res_ptr),R(s_ptr) - bls L(Rspecial) /* jump if res_ptr >= s_ptr */ -#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) - lea MEM_INDX1(res_ptr,s_size,l,4),R(a2) -#else /* not mc68020 */ - movel R(s_size),R(d0) - asll #2,R(d0) - lea MEM_INDX(res_ptr,d0,l),R(a2) -#endif - cmpl R(s_ptr),R(a2) - bls L(Rspecial) /* jump if s_ptr >= res_ptr + s_size */ - -L(Rnormal:) - moveql #32,R(d5) - subl R(cnt),R(d5) - movel MEM_POSTINC(s_ptr),R(d2) - movel R(d2),R(d0) - lsll R(d5),R(d0) /* compute carry limb */ - - lsrl R(cnt),R(d2) - movel R(d2),R(d1) - subql #1,R(s_size) - beq L(Rend) - lsrl #1,R(s_size) - bcs L(R1) - subql #1,R(s_size) - -L(Roop:) - movel MEM_POSTINC(s_ptr),R(d2) - movel R(d2),R(d3) - lsll R(d5),R(d3) - orl R(d3),R(d1) - movel R(d1),MEM_POSTINC(res_ptr) - lsrl R(cnt),R(d2) -L(R1:) - movel MEM_POSTINC(s_ptr),R(d1) - movel R(d1),R(d3) - lsll R(d5),R(d3) - orl R(d3),R(d2) - movel R(d2),MEM_POSTINC(res_ptr) - lsrl R(cnt),R(d1) - - dbf R(s_size),L(Roop) - subl #0x10000,R(s_size) - bcc L(Roop) - -L(Rend:) - movel R(d1),MEM(res_ptr) /* store most significant limb */ - -/* Restore used registers from stack frame. */ - moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2) - rts - -/* We loop from most significant end of the arrays, which is only - permissable if the source and destination don't overlap, since the - function is documented to work for overlapping source and destination. */ - -L(Rspecial:) -#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) - lea MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr) - lea MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr) -#else /* not mc68000 */ - movel R(s_size),R(d0) - asll #2,R(d0) - addl R(s_size),R(s_ptr) - addl R(s_size),R(res_ptr) -#endif - - clrl R(d0) /* initialize carry */ - eorw #1,R(s_size) - lsrl #1,R(s_size) - bcc L(LR1) - subql #1,R(s_size) - -L(LRoop:) - movel MEM_PREDEC(s_ptr),R(d2) - roxrl #1,R(d2) - movel R(d2),MEM_PREDEC(res_ptr) -L(LR1:) - movel MEM_PREDEC(s_ptr),R(d2) - roxrl #1,R(d2) - movel R(d2),MEM_PREDEC(res_ptr) - - dbf R(s_size),L(LRoop) - roxrl #1,R(d0) /* save cy in msb */ - subl #0x10000,R(s_size) - bcs L(LRend) - addl R(d0),R(d0) /* restore cy */ - bra L(LRoop) - -L(LRend:) -/* Restore used registers from stack frame. */ - moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2) - rts -EPILOG(mpihelp_rshift) - - - diff --git a/mpi/m68k/mpih-rshift.S b/mpi/m68k/mpih-rshift.S new file mode 100644 index 000000000..5670888c9 --- /dev/null +++ b/mpi/m68k/mpih-rshift.S @@ -0,0 +1,156 @@ +/* mc68020 rshift -- Shift right a low-level natural-number integer. + +Copyright (C) 1996, 1998 Free Software Foundation, Inc. + +This file is part of GNUPG. + +GNUPG is free software; you can redistribute it and/or modify +it under the terms of the GNU Library General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at your +option) any later version. + +GNUPG is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +License for more details. + +You should have received a copy of the GNU Library General Public License +along with the GNU MP Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +MA 02111-1307, USA. +*/ + +#include "sysdep.h" +#include "asm-syntax.h" + + +/******************* + * mpi_limb_t + * mpihelp_rshift( mpi_ptr_t wp, (sp + 4) + * mpi_ptr_t up, (sp + 8) + * mpi_size_t usize, (sp + 12) + * unsigned cnt) (sp + 16) + */ + +#define res_ptr a1 +#define s_ptr a0 +#define s_size d6 +#define cnt d4 + + TEXT + ALIGN + GLOBL C_SYMBOL_NAME(mpihelp_rshift) + +C_SYMBOL_NAME(mpihelp_rshift:) +PROLOG(mpihelp_rshift) + /* Save used registers on the stack. */ + moveml R(d2)-R(d6)/R(a2),MEM_PREDEC(sp) + + /* Copy the arguments to registers. */ + movel MEM_DISP(sp,28),R(res_ptr) + movel MEM_DISP(sp,32),R(s_ptr) + movel MEM_DISP(sp,36),R(s_size) + movel MEM_DISP(sp,40),R(cnt) + + moveql #1,R(d5) + cmpl R(d5),R(cnt) + bne L(Rnormal) + cmpl R(res_ptr),R(s_ptr) + bls L(Rspecial) /* jump if res_ptr >= s_ptr */ +#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) + lea MEM_INDX1(res_ptr,s_size,l,4),R(a2) +#else /* not mc68020 */ + movel R(s_size),R(d0) + asll #2,R(d0) + lea MEM_INDX(res_ptr,d0,l),R(a2) +#endif + cmpl R(s_ptr),R(a2) + bls L(Rspecial) /* jump if s_ptr >= res_ptr + s_size */ + +L(Rnormal:) + moveql #32,R(d5) + subl R(cnt),R(d5) + movel MEM_POSTINC(s_ptr),R(d2) + movel R(d2),R(d0) + lsll R(d5),R(d0) /* compute carry limb */ + + lsrl R(cnt),R(d2) + movel R(d2),R(d1) + subql #1,R(s_size) + beq L(Rend) + lsrl #1,R(s_size) + bcs L(R1) + subql #1,R(s_size) + +L(Roop:) + movel MEM_POSTINC(s_ptr),R(d2) + movel R(d2),R(d3) + lsll R(d5),R(d3) + orl R(d3),R(d1) + movel R(d1),MEM_POSTINC(res_ptr) + lsrl R(cnt),R(d2) +L(R1:) + movel MEM_POSTINC(s_ptr),R(d1) + movel R(d1),R(d3) + lsll R(d5),R(d3) + orl R(d3),R(d2) + movel R(d2),MEM_POSTINC(res_ptr) + lsrl R(cnt),R(d1) + + dbf R(s_size),L(Roop) + subl #0x10000,R(s_size) + bcc L(Roop) + +L(Rend:) + movel R(d1),MEM(res_ptr) /* store most significant limb */ + +/* Restore used registers from stack frame. */ + moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2) + rts + +/* We loop from most significant end of the arrays, which is only + permissable if the source and destination don't overlap, since the + function is documented to work for overlapping source and destination. */ + +L(Rspecial:) +#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) + lea MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr) + lea MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr) +#else /* not mc68000 */ + movel R(s_size),R(d0) + asll #2,R(d0) + addl R(s_size),R(s_ptr) + addl R(s_size),R(res_ptr) +#endif + + clrl R(d0) /* initialize carry */ + eorw #1,R(s_size) + lsrl #1,R(s_size) + bcc L(LR1) + subql #1,R(s_size) + +L(LRoop:) + movel MEM_PREDEC(s_ptr),R(d2) + roxrl #1,R(d2) + movel R(d2),MEM_PREDEC(res_ptr) +L(LR1:) + movel MEM_PREDEC(s_ptr),R(d2) + roxrl #1,R(d2) + movel R(d2),MEM_PREDEC(res_ptr) + + dbf R(s_size),L(LRoop) + roxrl #1,R(d0) /* save cy in msb */ + subl #0x10000,R(s_size) + bcs L(LRend) + addl R(d0),R(d0) /* restore cy */ + bra L(LRoop) + +L(LRend:) +/* Restore used registers from stack frame. */ + moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2) + rts +EPILOG(mpihelp_rshift) + + + + diff --git a/mpi/pa7100/distfiles b/mpi/pa7100/distfiles index d468fa20a..fece94310 100644 --- a/mpi/pa7100/distfiles +++ b/mpi/pa7100/distfiles @@ -1,2 +1,3 @@ -mpih-shift.S +mpih-lshift.S +mpih-rshift.S diff --git a/mpi/pa7100/mpih-shift.S b/mpi/pa7100/mpih-lshift.S similarity index 56% rename from mpi/pa7100/mpih-shift.S rename to mpi/pa7100/mpih-lshift.S index 1287f30f1..e17e1b705 100644 --- a/mpi/pa7100/mpih-shift.S +++ b/mpi/pa7100/mpih-lshift.S @@ -1,4 +1,4 @@ -/* hppa rshift, lshift +/* hppa lshift * optimized for the PA7100, where is runs at 3.25 cycles/limb * Copyright (C) 1992, 1994 Free Software Foundation, Inc. * Copyright (C) 1998 Free Software Foundation, Inc. @@ -18,14 +18,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * Note: This code is heavily based on the GNU MP Library. - * Actually it's the same code with only minor changes in the - * way the data is stored; this is to support the abstraction - * of an optional secure memory allocation which may be used - * to avoid revealing of sensitive data due to paging etc. - * The GNU MP Library itself is published under the LGPL; - * however I decided to publish this code under the plain GPL. */ @@ -95,64 +87,3 @@ L$0004 vshd %r22,%r0,%r20 -/******************* - * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (gr26) - * mpi_ptr_t up, (gr25) - * mpi_size_t usize, (gr24) - * unsigned cnt) (gr23) - */ - - .code - .export mpihelp_rshift -mpihelp_rshift - .proc - .callinfo frame=64,no_calls - .entry - - ldws,ma 4(0,%r25),%r22 - mtsar %r23 - addib,= -1,%r24,L$r004 - vshd %r22,%r0,%r28 ; compute carry out limb - ldws,ma 4(0,%r25),%r29 - addib,<= -5,%r24,L$rrest - vshd %r29,%r22,%r20 - -L$roop ldws,ma 4(0,%r25),%r22 - stws,ma %r20,4(0,%r26) - vshd %r22,%r29,%r20 - ldws,ma 4(0,%r25),%r29 - stws,ma %r20,4(0,%r26) - vshd %r29,%r22,%r20 - ldws,ma 4(0,%r25),%r22 - stws,ma %r20,4(0,%r26) - vshd %r22,%r29,%r20 - ldws,ma 4(0,%r25),%r29 - stws,ma %r20,4(0,%r26) - addib,> -4,%r24,L$roop - vshd %r29,%r22,%r20 - -L$rrest addib,= 4,%r24,L$rend1 - nop -L$eroop ldws,ma 4(0,%r25),%r22 - stws,ma %r20,4(0,%r26) - addib,<= -1,%r24,L$rend2 - vshd %r22,%r29,%r20 - ldws,ma 4(0,%r25),%r29 - stws,ma %r20,4(0,%r26) - addib,> -1,%r24,L$eroop - vshd %r29,%r22,%r20 - -L$rend1 stws,ma %r20,4(0,%r26) - vshd %r0,%r29,%r20 - bv 0(%r2) - stw %r20,0(0,%r26) -L$rend2 stws,ma %r20,4(0,%r26) -L$r004 vshd %r0,%r22,%r20 - bv 0(%r2) - stw %r20,0(0,%r26) - - .exit - .procend - - diff --git a/mpi/pa7100/mpih-rshift.S b/mpi/pa7100/mpih-rshift.S new file mode 100644 index 000000000..b409de042 --- /dev/null +++ b/mpi/pa7100/mpih-rshift.S @@ -0,0 +1,85 @@ +/* hppa rshift + * optimized for the PA7100, where is runs at 3.25 cycles/limb + * Copyright (C) 1992, 1994 Free Software Foundation, Inc. + * Copyright (C) 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + + +/******************* + * mpi_limb_t + * mpihelp_rshift( mpi_ptr_t wp, (gr26) + * mpi_ptr_t up, (gr25) + * mpi_size_t usize, (gr24) + * unsigned cnt) (gr23) + */ + + .code + .export mpihelp_rshift +mpihelp_rshift + .proc + .callinfo frame=64,no_calls + .entry + + ldws,ma 4(0,%r25),%r22 + mtsar %r23 + addib,= -1,%r24,L$r004 + vshd %r22,%r0,%r28 ; compute carry out limb + ldws,ma 4(0,%r25),%r29 + addib,<= -5,%r24,L$rrest + vshd %r29,%r22,%r20 + +L$roop ldws,ma 4(0,%r25),%r22 + stws,ma %r20,4(0,%r26) + vshd %r22,%r29,%r20 + ldws,ma 4(0,%r25),%r29 + stws,ma %r20,4(0,%r26) + vshd %r29,%r22,%r20 + ldws,ma 4(0,%r25),%r22 + stws,ma %r20,4(0,%r26) + vshd %r22,%r29,%r20 + ldws,ma 4(0,%r25),%r29 + stws,ma %r20,4(0,%r26) + addib,> -4,%r24,L$roop + vshd %r29,%r22,%r20 + +L$rrest addib,= 4,%r24,L$rend1 + nop +L$eroop ldws,ma 4(0,%r25),%r22 + stws,ma %r20,4(0,%r26) + addib,<= -1,%r24,L$rend2 + vshd %r22,%r29,%r20 + ldws,ma 4(0,%r25),%r29 + stws,ma %r20,4(0,%r26) + addib,> -1,%r24,L$eroop + vshd %r29,%r22,%r20 + +L$rend1 stws,ma %r20,4(0,%r26) + vshd %r0,%r29,%r20 + bv 0(%r2) + stw %r20,0(0,%r26) +L$rend2 stws,ma %r20,4(0,%r26) +L$r004 vshd %r0,%r22,%r20 + bv 0(%r2) + stw %r20,0(0,%r26) + + .exit + .procend + + diff --git a/mpi/sparc32/distfiles b/mpi/sparc32/distfiles index 7933edc8f..95ff42882 100644 --- a/mpi/sparc32/distfiles +++ b/mpi/sparc32/distfiles @@ -1,4 +1,6 @@ +mpih-lshift.S +mpih-rshift.S mpih-add1.S udiv.S diff --git a/mpi/sparc32/mpih-add1.S b/mpi/sparc32/mpih-add1.S index 04315d106..b90d9d60f 100644 --- a/mpi/sparc32/mpih-add1.S +++ b/mpi/sparc32/mpih-add1.S @@ -1,24 +1,25 @@ -! SPARC __mpn_add_n -- Add two limb vectors of the same length > 0 and store -! sum in a third limb vector. +/* SPARC _add_n -- Add two limb vectors of the same length > 0 and store + * sum in a third limb vector. + * + * Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ -! Copyright (C) 1995, 1996 Free Software Foundation, Inc. - -! This file is part of the GNU MP Library. - -! The GNU MP Library is free software; you can redistribute it and/or modify -! it under the terms of the GNU Library General Public License as published by -! the Free Software Foundation; either version 2 of the License, or (at your -! option) any later version. - -! The GNU MP Library is distributed in the hope that it will be useful, but -! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public -! License for more details. - -! You should have received a copy of the GNU Library General Public License -! along with the GNU MP Library; see the file COPYING.LIB. If not, write to -! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -! MA 02111-1307, USA. /******************* diff --git a/mpi/sparc32/mpih-lshift.S b/mpi/sparc32/mpih-lshift.S new file mode 100644 index 000000000..5348a157a --- /dev/null +++ b/mpi/sparc32/mpih-lshift.S @@ -0,0 +1,96 @@ +/* sparc lshift + * + * Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + +! INPUT PARAMETERS +! res_ptr %o0 +! src_ptr %o1 +! size %o2 +! cnt %o3 + +#include "sysdep.h" + + .text + .align 4 + .global C_SYMBOL_NAME(mpihelp_lshift) +C_SYMBOL_NAME(mpihelp_lshift): + sll %o2,2,%g1 + add %o1,%g1,%o1 ! make %o1 point at end of src + ld [%o1-4],%g2 ! load first limb + sub %g0,%o3,%o5 ! negate shift count + add %o0,%g1,%o0 ! make %o0 point at end of res + add %o2,-1,%o2 + andcc %o2,4-1,%g4 ! number of limbs in first loop + srl %g2,%o5,%g1 ! compute function result + be L0 ! if multiple of 4 limbs, skip first loop + st %g1,[%sp+80] + + sub %o2,%g4,%o2 ! adjust count for main loop + +Loop0: ld [%o1-8],%g3 + add %o0,-4,%o0 + add %o1,-4,%o1 + addcc %g4,-1,%g4 + sll %g2,%o3,%o4 + srl %g3,%o5,%g1 + mov %g3,%g2 + or %o4,%g1,%o4 + bne Loop0 + st %o4,[%o0+0] + +L0: tst %o2 + be Lend + nop + +Loop: ld [%o1-8],%g3 + add %o0,-16,%o0 + addcc %o2,-4,%o2 + sll %g2,%o3,%o4 + srl %g3,%o5,%g1 + + ld [%o1-12],%g2 + sll %g3,%o3,%g4 + or %o4,%g1,%o4 + st %o4,[%o0+12] + srl %g2,%o5,%g1 + + ld [%o1-16],%g3 + sll %g2,%o3,%o4 + or %g4,%g1,%g4 + st %g4,[%o0+8] + srl %g3,%o5,%g1 + + ld [%o1-20],%g2 + sll %g3,%o3,%g4 + or %o4,%g1,%o4 + st %o4,[%o0+4] + srl %g2,%o5,%g1 + + add %o1,-16,%o1 + or %g4,%g1,%g4 + bne Loop + st %g4,[%o0+0] + +Lend: sll %g2,%o3,%g2 + st %g2,[%o0-4] + retl + ld [%sp+80],%o0 + diff --git a/mpi/sparc32/mpih-rshift.S b/mpi/sparc32/mpih-rshift.S new file mode 100644 index 000000000..009962663 --- /dev/null +++ b/mpi/sparc32/mpih-rshift.S @@ -0,0 +1,92 @@ +/* sparc rshift + * + * Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +! INPUT PARAMETERS +! res_ptr %o0 +! src_ptr %o1 +! size %o2 +! cnt %o3 + +#include "sysdep.h" + + .text + .align 4 + .global C_SYMBOL_NAME(mpohelp_rshift) +C_SYMBOL_NAME(mpihelp_rshift): + ld [%o1],%g2 ! load first limb + sub %g0,%o3,%o5 ! negate shift count + add %o2,-1,%o2 + andcc %o2,4-1,%g4 ! number of limbs in first loop + sll %g2,%o5,%g1 ! compute function result + be L0 ! if multiple of 4 limbs, skip first loop + st %g1,[%sp+80] + + sub %o2,%g4,%o2 ! adjust count for main loop + +Loop0: ld [%o1+4],%g3 + add %o0,4,%o0 + add %o1,4,%o1 + addcc %g4,-1,%g4 + srl %g2,%o3,%o4 + sll %g3,%o5,%g1 + mov %g3,%g2 + or %o4,%g1,%o4 + bne Loop0 + st %o4,[%o0-4] + +L0: tst %o2 + be Lend + nop + +Loop: ld [%o1+4],%g3 + add %o0,16,%o0 + addcc %o2,-4,%o2 + srl %g2,%o3,%o4 + sll %g3,%o5,%g1 + + ld [%o1+8],%g2 + srl %g3,%o3,%g4 + or %o4,%g1,%o4 + st %o4,[%o0-16] + sll %g2,%o5,%g1 + + ld [%o1+12],%g3 + srl %g2,%o3,%o4 + or %g4,%g1,%g4 + st %g4,[%o0-12] + sll %g3,%o5,%g1 + + ld [%o1+16],%g2 + srl %g3,%o3,%g4 + or %o4,%g1,%o4 + st %o4,[%o0-8] + sll %g2,%o5,%g1 + + add %o1,16,%o1 + or %g4,%g1,%g4 + bne Loop + st %g4,[%o0-4] + +Lend: srl %g2,%o3,%g2 + st %g2,[%o0-0] + retl + ld [%sp+80],%o0 + diff --git a/tools/ChangeLog b/tools/ChangeLog index ccea6da89..bd342718a 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,7 @@ +Mon May 18 15:39:22 1998 Werner Koch (wk@isil.d.shuttle.de) + + * mk-tdata.c: New. + Tue Apr 7 19:50:41 1998 Werner Koch (wk@isil.d.shuttle.de) * bftest.c: Now supports all availabe ciphers. diff --git a/tools/Makefile.am b/tools/Makefile.am index 2a33a0adb..16a48bb93 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -4,13 +4,14 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl needed_libs = ../cipher/libcipher.a ../util/libutil.a \ ../mpi/libmpi.a ../util/libutil.a -noinst_PROGRAMS = mpicalc bftest clean-sat +noinst_PROGRAMS = mpicalc bftest clean-sat mk-tdata mpicalc_SOURCES = mpicalc.c bftest_SOURCES = bftest.c clean_sat_SOURCES = clean-sat.c +mk_tdata_SOURCES = mk-tdata.c mpicalc_LDADD = @INTLLIBS@ $(needed_libs) diff --git a/tools/Makefile.in b/tools/Makefile.in index 6920c4cbe..96f53d4cb 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -96,13 +96,14 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl needed_libs = ../cipher/libcipher.a ../util/libutil.a \ ../mpi/libmpi.a ../util/libutil.a -noinst_PROGRAMS = mpicalc bftest clean-sat +noinst_PROGRAMS = mpicalc bftest clean-sat mk-tdata mpicalc_SOURCES = mpicalc.c bftest_SOURCES = bftest.c clean_sat_SOURCES = clean-sat.c +mk_tdata_SOURCES = mk-tdata.c mpicalc_LDADD = @INTLLIBS@ $(needed_libs) bftest_LDADD = @INTLLIBS@ $(needed_libs) @@ -128,6 +129,10 @@ clean_sat_OBJECTS = clean-sat.o clean_sat_LDADD = $(LDADD) clean_sat_DEPENDENCIES = clean_sat_LDFLAGS = +mk_tdata_OBJECTS = mk-tdata.o +mk_tdata_LDADD = $(LDADD) +mk_tdata_DEPENDENCIES = +mk_tdata_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ @@ -138,9 +143,10 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP = --best -DEP_FILES = .deps/bftest.P .deps/clean-sat.P .deps/mpicalc.P -SOURCES = $(mpicalc_SOURCES) $(bftest_SOURCES) $(clean_sat_SOURCES) -OBJECTS = $(mpicalc_OBJECTS) $(bftest_OBJECTS) $(clean_sat_OBJECTS) +DEP_FILES = .deps/bftest.P .deps/clean-sat.P .deps/mk-tdata.P \ +.deps/mpicalc.P +SOURCES = $(mpicalc_SOURCES) $(bftest_SOURCES) $(clean_sat_SOURCES) $(mk_tdata_SOURCES) +OBJECTS = $(mpicalc_OBJECTS) $(bftest_OBJECTS) $(clean_sat_OBJECTS) $(mk_tdata_OBJECTS) default: all @@ -191,6 +197,10 @@ clean-sat: $(clean_sat_OBJECTS) $(clean_sat_DEPENDENCIES) @rm -f clean-sat $(LINK) $(clean_sat_LDFLAGS) $(clean_sat_OBJECTS) $(clean_sat_LDADD) $(LIBS) +mk-tdata: $(mk_tdata_OBJECTS) $(mk_tdata_DEPENDENCIES) + @rm -f mk-tdata + $(LINK) $(mk_tdata_LDFLAGS) $(mk_tdata_OBJECTS) $(mk_tdata_LDADD) $(LIBS) + tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) diff --git a/tools/mk-tdata b/tools/mk-tdata new file mode 100755 index 0000000000000000000000000000000000000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ulyH!!vF@2e5OwU=kJiKX6xkFiS|0_Z%2CG!P#yDc~u_U9s3R3px;I3w1?lZ$8<*R z$MDzUEdOtTZ*=mryp8Dpa6>e%k$%E0?;k<8zoA%$`h5!cEByQydjHOh=0kt}oUr51 z=WHVGOn+eoz8V$6@5<-*db0dWfb)AjZ#MWw;P&?unZ5#>WgScIck@RnXAHg^W)VmVb-vNId_(s5N4g6ihV@~>af!p73V|mAc za~z`n7b8BO1AY?xJ5B!I0OxoM6!I?c&H(o?Ub4%j{FjsmziUT%R|2>4HbCCB!0m6< zF?~DmLFkX0=-&r`f}Shk$Pbe}m!w7;v||Pm+p$$`D#KO|JBwbWi*o*pUe#7^%t3*CX$8ypvHG5I{Nu- z4%_29I(v|b6I?v3H8pjoS$)(-%^FmRoDrLJENb{7Oh%qIg{(HGY_~j_6`S&eCysZ; z5>{D@s2YmF%DUPCd@tj4%Ki3EnPtQBE-TPxq$Q%?Kk6_Av)W<1m0EJpO-H-!#5-0ot}h;wH{u7h73OMhV$or9!>>u zAOOmW#Ud!FX&h{3roH4a_SijGl*V5i#tri+M1hyDJauJ@{R7Q*_R2c2p(y>!UwG!~V)~!?zmO>^SM<+N2g0|^tFK3unu6#Z0m`|rY9IouAb}3mK zC3bZ6ZpXWWy&W9`@j<*ghVS=4&0~`Tt_2$&c}$~V2!~c9`v9&mN;dpuQGV_;RA(yX F{SPSUprZf) literal 0 HcmV?d00001 diff --git a/zlib/Makefile b/zlib/Makefile index c9c36c2a7..62ad85b7b 100644 --- a/zlib/Makefile +++ b/zlib/Makefile @@ -93,7 +93,7 @@ POSUB = po RANLIB = ranlib USE_INCLUDED_LIBINTL = yes USE_NLS = yes -VERSION = 0.2.18 +VERSION = 0.2.18a ZLIBS = l =