The unified diff between revisions [2b4b13ac..] and [1c2b7d38..] is displayed below. It can also be downloaded as a raw diff.

#
#
# delete "TODO"
#
# delete "logs/sqr.old"
#
# add_file "mess.sh"
#  content [ee34aef379627e97871efac71f93ebe600548bd7]
#
# patch "bn.ind"
#  from [eb15c6226d253088d1c63b4d47035e0c2a829fe2]
#    to [b5b26c459959328cc7fa46592fc33f0b635758b5]
#
# patch "bn.pdf"
#  from [8fed3f365c2a3324c4a4c81b82c046b116f1f0c2]
#    to [ae8c63c491612ff5dbf41b97370dac8b569e2df7]
#
# patch "bn.tex"
#  from [20cadcede6073a9027d85eb340269f5f15737f36]
#    to [3cf40f63f99097eb88fcdd728a0d5495904e8b7e]
#
# patch "bn_error.c"
#  from [a3f1d67e5952a5288a5e3b25ae1af448d0c55323]
#    to [2d913fbe9f26b513548a5b439ce5a2fc0439bfab]
#
# patch "bn_fast_mp_invmod.c"
#  from [4d3634c512613a6a57a72c5664058c4a47e9a960]
#    to [15975e4e1d66aeae5d3bf1a337139813bd97dc64]
#
# patch "bn_fast_mp_montgomery_reduce.c"
#  from [78d8d5998865b41471663c55715fb1dd6752cee7]
#    to [4c83769796abded7a48eeceb017835692128d5fd]
#
# patch "bn_fast_s_mp_mul_digs.c"
#  from [9a92ee7590332a1db78b9d37171680e6b87e1670]
#    to [8c7ec5242443c6bbdfe90b6421c6e1351dd775b3]
#
# patch "bn_fast_s_mp_mul_high_digs.c"
#  from [ceff3a71492dd8079556c72a83364f4930e9e733]
#    to [58c0a62a1a4fd0eb6d9b66f51b57348225b6d65a]
#
# patch "bn_fast_s_mp_sqr.c"
#  from [eda475fe947ffc90906c7167eec15450c2209362]
#    to [b18e62eb12ffb8e8f4a434a237c2efa75b73fdc4]
#
# patch "bn_mp_2expt.c"
#  from [c0a974c10b34a7d5fa7e677ae3d1293a4e290138]
#    to [d02950375b877315d7b9f4c96acddcdd7cea623d]
#
# patch "bn_mp_abs.c"
#  from [5ee072348880edcf0c2830885697a4233734580d]
#    to [cc89fc43ae13f246ad1ab978ed599c93d4cb01b9]
#
# patch "bn_mp_add.c"
#  from [0cc7225dceeea5eb317eb215e4417ee0f23dd4ae]
#    to [f2289f13117e9016d82afcd94c2ab991a1e57802]
#
# patch "bn_mp_add_d.c"
#  from [d6830e293314b416b519fede793966d4ecbfde57]
#    to [a9a93d171db95284326e1803d70cd16d5be92ac8]
#
# patch "bn_mp_addmod.c"
#  from [b15c4348f1d5f51ccb10b50d1206032b4e0e0c4c]
#    to [e8276fd9681b60cc5846f410134bf0970974876a]
#
# patch "bn_mp_and.c"
#  from [74d28d927a0271c274f0ff8195651d793c2307a1]
#    to [f9d823300dfb664349710a9bfad2be4bdfc76b04]
#
# patch "bn_mp_clamp.c"
#  from [7c26a55902cadb40f234df0f174b750102b05122]
#    to [89152494cc2db2aeb0950d4f97a46d69d51d0fbd]
#
# patch "bn_mp_clear.c"
#  from [246c4a2b16e20f7d0a43f1fc990c3a7f1ead9bfb]
#    to [2378b1b2751c869649011dc51b5e4626c20b22a4]
#
# patch "bn_mp_clear_multi.c"
#  from [30f79c92867e21713828f674e9f125602d1edbfb]
#    to [6d62953c54210dec638be9f5a2294f83a619b40e]
#
# patch "bn_mp_cmp.c"
#  from [f48e439ef12bf49c92d8269958c09d2fb7e390ec]
#    to [d671443879ebd10881e72316c18461ed1db34433]
#
# patch "bn_mp_cmp_d.c"
#  from [a3e0a785b17ac01577ef58cebd7df89baa4a0dc9]
#    to [1b074dab32ee11b2c4ee6962f456c61f56a79797]
#
# patch "bn_mp_cmp_mag.c"
#  from [a0698d9635cf3832841c8cc50639af3caa3d02c4]
#    to [b86add5ee03e1e98f3d2050b7a2226835e8e9f63]
#
# patch "bn_mp_cnt_lsb.c"
#  from [3d6446de20143460fada1208b56c20fdcb5a0f89]
#    to [6a13ed21775156012c18bc7fe2a96a4b13668afe]
#
# patch "bn_mp_copy.c"
#  from [a548ebca4bf8db0dca759222dfa976b97d551c89]
#    to [d56eca4a86a1aced85aa6d4349460326416a87cf]
#
# patch "bn_mp_count_bits.c"
#  from [40adf953ce3210d33f9723e6f724e4700a807718]
#    to [460d18db977e52240bdc2255a0cd130f837ba2e4]
#
# patch "bn_mp_div.c"
#  from [0f214a2ee7c1cfd6152ebd473d2f04db67f2f86c]
#    to [1603878fe4fe2c8c763a985369744f1d526f586e]
#
# patch "bn_mp_div_2.c"
#  from [e57a17c6b78085f9e5eef4df072218919a1888b6]
#    to [d584eb2131c23d44f7d8a1c58fe0330520742961]
#
# patch "bn_mp_div_2d.c"
#  from [58636c779564cc44fdd8ccf9b75f01f047fb45e8]
#    to [814b62178fc9d469011d1291209c976b1c5689aa]
#
# patch "bn_mp_div_3.c"
#  from [1d32a597de97e1ae46dc5b399c9dc9f6a2068475]
#    to [d96605d29c8e0bd8edbd72120db01e97138b71b4]
#
# patch "bn_mp_div_d.c"
#  from [d7f4600af77c0ec3d063e71f1ea76bb6da0f882f]
#    to [cbdcd35ed87ee6231ba332aea9b4999057e95726]
#
# patch "bn_mp_dr_is_modulus.c"
#  from [66009ac52e299147a27b8562fcaeef9ff806b8f0]
#    to [94797f18971c49db29fe3a5068525e903386896e]
#
# patch "bn_mp_dr_reduce.c"
#  from [e66ad3324fbe632c9168616227cab4bafada767a]
#    to [7290d18987f613cdb2a6b5f22efa6c5faeebb850]
#
# patch "bn_mp_dr_setup.c"
#  from [bd378fd2525c0d744ffeccebc38703c189f4a140]
#    to [d5f860f0fa662e85db3871a63ea7026318140f51]
#
# patch "bn_mp_exch.c"
#  from [acfc6896a26538be3832eba6ff1d4d17a0b2fae2]
#    to [7f77882503c78291246802dfdc5951e85b83e5dc]
#
# patch "bn_mp_expt_d.c"
#  from [b7adb8028ffe97d74f17a2c3e4ee85aa222ffe0f]
#    to [261f9a3fb03d75be6dfaa0d6001b39b292e08fd1]
#
# patch "bn_mp_exptmod.c"
#  from [5834ec7efb5ce20b64f84e8015eaa59bfd93f090]
#    to [db7933b21337396fa608bb6f2ca1f04fa7915198]
#
# patch "bn_mp_exptmod_fast.c"
#  from [0c597499c614a4fc38dbf06574749138133f69b2]
#    to [5a692f134deeab0992612206c16f8bf970b5088c]
#
# patch "bn_mp_exteuclid.c"
#  from [84910598afbed46c88cd0802b8c2607c8ea9e1d0]
#    to [2e2e7f55da00258ed0bae27ce268ae1235b5d6b2]
#
# patch "bn_mp_fread.c"
#  from [4e80ea1d33795bf3aac96f439e182f56c46992d7]
#    to [0671107a9cfa26d3518db90f3c6adf72a9365564]
#
# patch "bn_mp_fwrite.c"
#  from [3923546490c8d8ea313e3a75ed030bb5f637a14b]
#    to [199e089ebf312e694f5afb241c0d6e38a7a06062]
#
# patch "bn_mp_gcd.c"
#  from [a5ec727015fd307450f7718c481285dd1599d5d0]
#    to [bf556ea29d2e32c27105cd6f8ff69c4da406ba3a]
#
# patch "bn_mp_get_int.c"
#  from [c161ac67fec2fda9279c294f69845fd44cabfa6d]
#    to [e56841a81a3b93ec8afe25f144f8990b5b27e5b7]
#
# patch "bn_mp_grow.c"
#  from [5d24eb35c5e6eeb36e58dc477f570f308e31b86c]
#    to [371fba672eba9a36894e37f7c87333eca9d13a58]
#
# patch "bn_mp_init.c"
#  from [dc9416c8eef1a2aec31f655efbf69f30366707ec]
#    to [78b37a5252d18b46f9b32108d733071f351aeaf5]
#
# patch "bn_mp_init_copy.c"
#  from [85088498a8625eb86dd85679e1f39c7757561fa2]
#    to [fd7c20c0ee3473615de23c59074cf5c6757a20ca]
#
# patch "bn_mp_init_multi.c"
#  from [b1635102a3be4451303a739b6f164f73d10ca561]
#    to [7eb256888f319d1f22a2077840b00144a635a360]
#
# patch "bn_mp_init_set.c"
#  from [53918f753d6f18c1e0fc608b8b67ada7fc25af3b]
#    to [cc8de44fe1c250b7fd3c3c34764eeb6479442307]
#
# patch "bn_mp_init_set_int.c"
#  from [1772b10c31bf67011748664d7ed6541d9cad0ac6]
#    to [62b0c86e524c47885c0acef1c0b98dc9d43120bd]
#
# patch "bn_mp_init_size.c"
#  from [f343728fd0b919c0551ee4fb955c7b7348084917]
#    to [7f3cd6fbba38b36e824d4fa6bfc71384e1fc6150]
#
# patch "bn_mp_invmod.c"
#  from [05e43c05923465c284cccf8707ee1a59ed911233]
#    to [ce1865904090004db508933d7085a1af7e908b78]
#
# patch "bn_mp_invmod_slow.c"
#  from [0e68e06289ca853df2e27007a793f251eeb6db76]
#    to [1df4033bc1245af3306017c814f91956404f9d17]
#
# patch "bn_mp_is_square.c"
#  from [e905ec883178a2185809f2c902bac355e5816bad]
#    to [1b3b3d62e0920e8ea1fdb4ab9ef75fdc1675d5d6]
#
# patch "bn_mp_jacobi.c"
#  from [9c41eb9191d5875db6dd10ef168fedbe621a3b2a]
#    to [8b6a59e14a516bb223dd5b89c6212480d3e6b046]
#
# patch "bn_mp_karatsuba_mul.c"
#  from [7bed1bacfcdcc8d1c5962ad4bcc6ef3c1f55bea9]
#    to [d12ad7521ac06b66055b94595f5ee8c73198859d]
#
# patch "bn_mp_karatsuba_sqr.c"
#  from [32ce87d5ec2f68aea40bea22927f5a3f632c47b5]
#    to [cb25e7157ae4c7432461857852bf8bf43b124755]
#
# patch "bn_mp_lcm.c"
#  from [ae6e40952e57e849e762a25ce87385e02fb4bdcd]
#    to [2efc953f9b2bf277bb46d07bde7ea65497ab65d9]
#
# patch "bn_mp_lshd.c"
#  from [0c04c3e6d8491249a27227826faeae84c966a94f]
#    to [1be9d6059f7990723ab18ad01c84eef2dcb743a6]
#
# patch "bn_mp_mod.c"
#  from [c8090d320496ca60b99764b9335ba865c36cbfed]
#    to [3bed12926c4d019853f2b4dac814a7505580380e]
#
# patch "bn_mp_mod_2d.c"
#  from [e0e5f0ab899aae9477bf97785f85320ad0b78865]
#    to [39b5088c61a702e45117c046a246c0ba3457acec]
#
# patch "bn_mp_mod_d.c"
#  from [57cd7a01f1616d22ebced526e91159b1d242e0f9]
#    to [6df502c9569a11c797e90478d2a8909ba0d1247c]
#
# patch "bn_mp_montgomery_calc_normalization.c"
#  from [41769e061872600b8d99328e343fe770b7b3aec4]
#    to [87b5ed6813882ce20a7cfd650969495219105276]
#
# patch "bn_mp_montgomery_reduce.c"
#  from [0b42eac9d7346004d688cbe3063e947ea1893f3f]
#    to [a57d1c56341758bafd5640de7816ff2f7d9641cb]
#
# patch "bn_mp_montgomery_setup.c"
#  from [0ddf17c06f6f5dc9fd7311284277b7a87a3cfc27]
#    to [63ee332ae3a63047da7a388f8ca254b0cd4957a4]
#
# patch "bn_mp_mul.c"
#  from [cb9292558d6b699232dfe1d24d6b134b265aec30]
#    to [f95da85da87525e95e09c97272ee1c70420b2fda]
#
# patch "bn_mp_mul_2.c"
#  from [e7df32645d7a80e3badc2c696caf09d438932742]
#    to [551cba350d6670dd37afa3ff3f928002b60257e2]
#
# patch "bn_mp_mul_2d.c"
#  from [2d59d8ba0c487c42e75e24cd6808147fee6041ff]
#    to [aad4f65c8fe2dfbdffd0dbea052515346b2c1345]
#
# patch "bn_mp_mul_d.c"
#  from [684e50bde0381306076b4b64d2ecbab99b7af195]
#    to [5ccc5289b208ab817dbb8d966b279c30fe0270aa]
#
# patch "bn_mp_mulmod.c"
#  from [958738a570b35415e919d6c6e55adbce7ff59f55]
#    to [935d0f5903589ddf62f42fc691cb2f83aa2832c4]
#
# patch "bn_mp_n_root.c"
#  from [ceda8bdd58d2fb45707be024bc9ad46ceb44a337]
#    to [7cd8f559d867362d24bc0d3b468e94c8520b92e6]
#
# patch "bn_mp_neg.c"
#  from [02cb8735d235feb2f3016b581f23d6da582f8765]
#    to [1f6e366f84f62e9790cd32a2197ac01ab15f18d3]
#
# patch "bn_mp_or.c"
#  from [01c1a84d9dcba644c61f69a3c00164f5f3346599]
#    to [7172bc3a4b5683959d2b4780fd2b1bc7d8edb3c1]
#
# patch "bn_mp_prime_fermat.c"
#  from [bed25e3d7aef4e9ce0bd9642626e082b7bc02e73]
#    to [d6a54db5584a3b7557d4aff7b0dc30ebdf28a731]
#
# patch "bn_mp_prime_is_divisible.c"
#  from [ac6f9ad19e8ee7c27df8dab72b160090de3f88e5]
#    to [efff6a4fe42fffe8f6d30ff6b240194cd7c46e72]
#
# patch "bn_mp_prime_is_prime.c"
#  from [616c045068c12c0d7cd8a73080ef55da4e501493]
#    to [dc21e8dade254b50b4339e7b33e28793cc2051b1]
#
# patch "bn_mp_prime_miller_rabin.c"
#  from [e893c60f539dce9136d4afe96650b4e5a649876b]
#    to [d59e75a31931262d9d08121a0fc78e93ae7628d2]
#
# patch "bn_mp_prime_next_prime.c"
#  from [cc04aebd4d5b5e203b330e0f4a8180c48be6af13]
#    to [d0f2cc0de0f3f223bdf94c4b717a14875d131614]
#
# patch "bn_mp_prime_rabin_miller_trials.c"
#  from [93963170cbd3a50b33dc5f1dd76ccdfd935c239c]
#    to [b0421d46d35a8f5ee2a448e246732e6953529948]
#
# patch "bn_mp_prime_random_ex.c"
#  from [4cba143b51b505f3c881caf21f5879695d0dcefa]
#    to [f1a195af61c7430bd490c9fac1e5a6ca813817bb]
#
# patch "bn_mp_radix_size.c"
#  from [cea57d1d767181e6a51d13d3dd79684a4e62482a]
#    to [c4c793794ffb15a3995382cfbbfc6e014e9449f1]
#
# patch "bn_mp_radix_smap.c"
#  from [9b2641767d4071696aa72126a339bd5450163b9e]
#    to [90acb63521808ba2825dacbf29401f79a06efcc2]
#
# patch "bn_mp_rand.c"
#  from [21e113ee13fd97a003bb05376e3bf1c706469d43]
#    to [aa66e8277829f6ecd05ca0c3c91b209c844bd4a7]
#
# patch "bn_mp_read_radix.c"
#  from [a761d92fa0571ee25a4d8e25029b65ed715f5c41]
#    to [cb0ec976374b9be1ef0066b884fafea58f6d3eee]
#
# patch "bn_mp_read_signed_bin.c"
#  from [5e3b2483fb9e04ac544331b7a46df0263e3a6cd0]
#    to [46e0eb1eeb55a3c156f04219b12f82aa7c64b1ba]
#
# patch "bn_mp_read_unsigned_bin.c"
#  from [15a5dc9e2dd8a6fe5a7b53c52c4ecb4babbdd1d5]
#    to [55c99cff4309d0b894cbbe9dbfee85bd206eeb63]
#
# patch "bn_mp_reduce.c"
#  from [22c1ae63de48d5cc0e48db4bcadef234f025e060]
#    to [9c18643caba6d8f2895c5fc474040c640516997b]
#
# patch "bn_mp_reduce_2k.c"
#  from [3a75893da1c3a1c868056cb31e118a3683200bd5]
#    to [85e52ad760353d6e2e869459d713cecf49eaef4b]
#
# patch "bn_mp_reduce_2k_l.c"
#  from [18cbea4d1de3dcd4ae121ef87f750fd71b936d65]
#    to [05a3e5ac63757258558201d23442cf0a22706b4c]
#
# patch "bn_mp_reduce_2k_setup.c"
#  from [94f2c64d767763bc4c38322b408d768ca2aa4ecc]
#    to [2cba08eed631dfc432f8248373e6d23b77283180]
#
# patch "bn_mp_reduce_2k_setup_l.c"
#  from [2f7604831262ef985d2d84fff4079f660e9d4355]
#    to [3b5c4f5c810be907d8a1278715629afae0eff683]
#
# patch "bn_mp_reduce_is_2k.c"
#  from [4d4b366051978336c6ab81f3e987b0aa19c16812]
#    to [63e0be9bf4893e8b1748b59881d5c8dfd07f977b]
#
# patch "bn_mp_reduce_is_2k_l.c"
#  from [f8a3ff10225afdfb3aa25c9de44066343247722a]
#    to [0d61c2db7ed32d9e04049f132f1e3b83dc1cba24]
#
# patch "bn_mp_reduce_setup.c"
#  from [c0d6b73b259cda2c962f44710c16a7942f6adbfc]
#    to [17d0c225ecb4671353a9158de6d0eb189e704bdf]
#
# patch "bn_mp_rshd.c"
#  from [f3d16d9373f3707a2024da60481cfcb91484a34d]
#    to [01550999b6f4d046203f0ba9fa69e28441063075]
#
# patch "bn_mp_set.c"
#  from [a9535a1aa1f54c47f3bb503c74d03b7202f682a0]
#    to [b9720c95ebba5888000331272a9b363ac60f757f]
#
# patch "bn_mp_set_int.c"
#  from [f969f32a9ce516009747993ccd66e03e17aff3f2]
#    to [b5eb6b13ba3e4f03c52574fab0dd85b8b915924f]
#
# patch "bn_mp_shrink.c"
#  from [1349448a8f2a625e7817074996951d5a2d1ec158]
#    to [2a97caa488bf03b698501431831788b7096dde65]
#
# patch "bn_mp_signed_bin_size.c"
#  from [9ad18efcb95355ea048e428c9a1808cf3e44de82]
#    to [095c4525cb020eb504d55ae5c48e4c52654a0a1b]
#
# patch "bn_mp_sqr.c"
#  from [093d797ab504fa4cfb271b47a8c10075b2441b9f]
#    to [0f2296767c878d8019e13c07fd449560955fc024]
#
# patch "bn_mp_sqrmod.c"
#  from [2d316f2f768b25e981f2e62c0bb245cb4dfc8ec8]
#    to [a0dd26072bdd106242f6fd655a30188cfb25ea38]
#
# patch "bn_mp_sqrt.c"
#  from [9d312eb9205cadcc089d54d19d712238dbf6d03c]
#    to [450813392fbfbe44bbae85535fb8b998eb8184ce]
#
# patch "bn_mp_sub.c"
#  from [c5092e05763947b6dc2e9fa0858dc3750bac02fe]
#    to [a33a08150a286b0039173cca2a41315b2091365d]
#
# patch "bn_mp_sub_d.c"
#  from [e80435db75b1dc7f60a2b3f6d27204113017d849]
#    to [bfedcdb1837eaea36cc8016f412d64837f34f8e1]
#
# patch "bn_mp_submod.c"
#  from [72847e4cc7457fd16feda88a9a22461c9cc6467a]
#    to [fa8ab8b897cac02d06e7b4b1a9b9a3053a40e858]
#
# patch "bn_mp_to_signed_bin.c"
#  from [37639284a790d77339bcd7f53e66a18017563dd6]
#    to [b5f2791e69cca9974bef85270825055442f8b1cd]
#
# patch "bn_mp_to_signed_bin_n.c"
#  from [c3aea4a9e1164e03d1d58338de680a6f55b5ad8f]
#    to [7c0825814f330b851e34e7bd494780800c8cd761]
#
# patch "bn_mp_to_unsigned_bin.c"
#  from [efb1eee1129615146646f646378a25742c9a6492]
#    to [a4065f821ee4c734de19f31be4d596c612622b72]
#
# patch "bn_mp_to_unsigned_bin_n.c"
#  from [90b468fd50ea8c8151e0f40e6aa8ac302ec2fe46]
#    to [7bb5466e439b1f52f095ae2acbe150e342b21dc5]
#
# patch "bn_mp_toom_mul.c"
#  from [8a45c9922034269d563cbdbd1b55d772ccc06056]
#    to [963f922d61caf8828638f9b990020406ec22ae1f]
#
# patch "bn_mp_toom_sqr.c"
#  from [496802f1dbcf4a358fb38b7458609f209b5435cd]
#    to [a40b43897c5e23520f99ceaa59bf939eb5bac1ed]
#
# patch "bn_mp_toradix.c"
#  from [78a3ed650fec464f1229d14ea550b3703d3ef8d1]
#    to [e945e74e11ac54e91af44216023f55656cf7f650]
#
# patch "bn_mp_toradix_n.c"
#  from [1a2704322409b2e9f54e9f7e41ef69be2ae5e4c9]
#    to [17b42cd6147e873d7834a05c342f937b391426f6]
#
# patch "bn_mp_unsigned_bin_size.c"
#  from [8b1963305618f9f8effe51212c9794d59e8d6c24]
#    to [8e2ac8bf6a9f3a1de0ef11cec7730ffbc1e6f1a8]
#
# patch "bn_mp_xor.c"
#  from [6a3de9432fe1ad939de000694be657772cd913e7]
#    to [937f73fe8252c4bbdc7f60d2d8a80396e0c5e971]
#
# patch "bn_mp_zero.c"
#  from [4247063811e504255b015c2cc19acb28d2a304e4]
#    to [9c936f75b20687b223129734ebd93e04db6bdf00]
#
# patch "bn_prime_tab.c"
#  from [fec54b5cd76b20913620ffe6922c6a37ee96e1b7]
#    to [45021011858d4ff6abc198aa591f731a41fa9aa9]
#
# patch "bn_reverse.c"
#  from [dd999dcbec79713c226d741f97af41ec6ed7e58f]
#    to [137f7c2e7abb88f8b99699187d460a216d2edef1]
#
# patch "bn_s_mp_add.c"
#  from [e16a196df2c5a2a1ba9c51d184105791f7151e6c]
#    to [5ccb09709881715f8114ec5bd47b86b13bd2982c]
#
# patch "bn_s_mp_exptmod.c"
#  from [7ac1accce85a140678573008fcdd67f2834737ed]
#    to [a6a69525a2db4382684510dbb71bcbcbc20cb053]
#
# patch "bn_s_mp_mul_digs.c"
#  from [d312dd371b770bf210c2d96f267247163ab15e0f]
#    to [709d778c346b50939bb7c8a49b5b44be5845bae9]
#
# patch "bn_s_mp_mul_high_digs.c"
#  from [7fedd32cbf39b73ee19e2c4f84708d46e6698375]
#    to [f590816a055898ebeb40cd5826147faf32e0d844]
#
# patch "bn_s_mp_sqr.c"
#  from [eba4101c1f1ff9dc11fadf942075e3e0fff40737]
#    to [dc3edf5189c48351f73dd0b0df23c60ac23d78c8]
#
# patch "bn_s_mp_sub.c"
#  from [46e30a7f53648000600b31472e9f6f8463145196]
#    to [3b4ddc0ab104634daee083067a0368bcc611daf9]
#
# patch "bncore.c"
#  from [2a706b0ca7b0d41a6ef37bc33c26d2d2a4338b7e]
#    to [10ead291d5f52c4d162e40e497f53f6d639a70e1]
#
# patch "booker.pl"
#  from [f5935051a27a7a963ac1730d44d2de8f682e12e6]
#    to [b00c5b2be0d8233baf482d7422b360606fc961bc]
#
# patch "changes.txt"
#  from [686b8da0e27120cb775f6960c80f1efc7b80940d]
#    to [aafc04f83cde62256b1525b5457971f64616e499]
#
# patch "demo/demo.c"
#  from [ad8e1506fbbd176371eece0e73edc6696b4ab79d]
#    to [709dafa2cd6efd826d038844380305cfd42d67ab]
#
# patch "demo/timing.c"
#  from [495dc5a5ca04a74a7ac7146d3c40c1c0cde360a2]
#    to [b75910c66587af2b0222534851c5503e01811a00]
#
# patch "etc/2kprime.c"
#  from [8916b4a19cfcec43ec1788ca54b59d213e0bbe30]
#    to [b001c8ef24408aba0dfa4f7462e61969c6968bd3]
#
# patch "etc/drprime.c"
#  from [721a3e4d253bbe004dd67da6e9cd28dba2e5fe8b]
#    to [df563d5b3f2832a2cacc8506e5ecf30dcef25a3c]
#
# patch "etc/drprimes.txt"
#  from [a1729704304c95123744b923bf4aad877575b27f]
#    to [748f978f785fc935efcfc622f27fe53a4993fc80]
#
# patch "etc/makefile.icc"
#  from [bd3824382f4b2ca2df34f552e13393a2f27739c7]
#    to [e115ddcc88cff9c28dbe597dd5b0c076e4e65d80]
#
# patch "etc/mersenne.c"
#  from [0b7491b74ebf52193361a1f1011866a56cf277bd]
#    to [05d1c4504baf9d7568ec2daf99e2074a7661edda]
#
# patch "etc/mont.c"
#  from [3618f1f988eddb11db6f83d114a13e74c1078ba4]
#    to [b2584eb8712177a6e88175f408d45048492a5e1f]
#
# patch "etc/pprime.c"
#  from [5b67dfe9a0cda06431fcee2cce3c23636671ae02]
#    to [8b86a9609ef70775d0d2cbf7f4ae17d160748509]
#
# patch "etc/tune.c"
#  from [9cc60da474172eb1273756067d1676b9c1beac36]
#    to [279fc742cd93d888912d31aa4b75fddd40acd9b3]
#
# patch "logs/expt.log"
#  from [fdc7d0684f006f7cd60c501e68213974c165e332]
#    to [844591313c860202b913bffdd920a9025224f12d]
#
# patch "logs/expt_2k.log"
#  from [e3590c62739763a41c1a34365e595568d1ad6444]
#    to [cab3eff5681a7b6a61d89139b2a3fdf0873bd758]
#
# patch "logs/expt_2kl.log"
#  from [6302bb8eaffcc9d3dc8fd60dbe24c2c68c873984]
#    to [80ed576fe5c5e22386d6311eaee185bbc26c8665]
#
# patch "logs/expt_dr.log"
#  from [0c04f650971da4f1d1ecc94caf4598c61ecf8d7e]
#    to [daa8084e574da2483c25df823cd8187a6acbf8fb]
#
# patch "logs/index.html"
#  from [9dfaca0a0c5f26c88275c7e29a9b8fb7276954ea]
#    to [5f30550054b2895f971751df747c78d44f6598e3]
#
# patch "makefile"
#  from [0db3fd66a1f1ef47d182d20b71279c91070272da]
#    to [de414341231693d9e731aeccd57e4bedb8e61576]
#
# patch "makefile.bcc"
#  from [6dc71811ee3aeb409b7ced958e62abd55bd3eeda]
#    to [e33180b9565d150a8f535fd7b02e8236135a334a]
#
# patch "makefile.cygwin_dll"
#  from [488c52dd666e16a9c89e0016414a22b8efd687eb]
#    to [275e13f68f8caaa487491653d212d9c62b3bc025]
#
# patch "makefile.icc"
#  from [eb7a66a15792f0e46e27620b4351e367995953c7]
#    to [dc5d4b64291b633269d1188e6b1f3809b37fb373]
#
# patch "makefile.msvc"
#  from [37604182da728a3357ca462f509928d8ff10ed7c]
#    to [024637549319c0a6143c58401c2cb79893d701e9]
#
# patch "makefile.shared"
#  from [ea1c88425c89e89689fd2e5ea95ae0c7888cb2bf]
#    to [8c24ac3157bbc4e4cb6007f4d6d37102510bf7e7]
#
# patch "mtest/logtab.h"
#  from [129e0480989c9d1e36f287c5a1eb97cea42b2b52]
#    to [2946d54b88ca7516643cc60cbc849abd2f68a9b6]
#
# patch "mtest/mpi-config.h"
#  from [c4f05a0ca82cde231f973614d08bde9ee0a707ae]
#    to [bf052be25775701669c472e40e7a0857614cab3b]
#
# patch "mtest/mpi-types.h"
#  from [f93df694e834dc18f7fd0103c87c0cc316366d04]
#    to [b82ceb5f38175ba7c183b4fd26e9e709ca5cd885]
#
# patch "mtest/mpi.c"
#  from [8c0d35e1c5f6cbfe99f6147b85dcb7f40b8603b7]
#    to [d331154df2e6f868537b56bb4b5db8aaf675c950]
#
# patch "mtest/mpi.h"
#  from [4256d0c148b57666041afe30c664ba571b62852c]
#    to [a57526b17d78bd1ce8fa81d5001ce6fcc19f311d]
#
# patch "mtest/mtest.c"
#  from [924788f719398e30fb3ab846ced8aa3940264956]
#    to [0c8cbf2794a568809e0d9a0d4639a61ca4f2c7e5]
#
# patch "poster.pdf"
#  from [fbccdb53e134353586a0d798924d1ccdf891cb6b]
#    to [01a0677dcec311bb344998327dc554e964e4672f]
#
# patch "pre_gen/mpi.c"
#  from [e203f2d5fceec0ccc521ff44274ef4c3788e5c1e]
#    to [b2a784f7b7fc863048d03ce94b9cd0cfc03c199d]
#
# patch "tommath.h"
#  from [e18fb765c96711cccdb5c6ff11f43dbe00bf7295]
#    to [843992469bb93bf63e0478afe888aeae1e58544b]
#
# patch "tommath.pdf"
#  from [05c8ae7aa8f77d2f7e59c0c436ede5fc8fc25ad4]
#    to [7519cfd3a9634a16226dd99e61a245529900f000]
#
# patch "tommath.src"
#  from [a40b150bd8b162b53e0175cbf1e8b36db5358cb8]
#    to [2ec6452fc2990ba74420141e100763af52d3d77e]
#
# patch "tommath.tex"
#  from [e721fdf759d52b5923a7a7ec76538533174dc57b]
#    to [bb66cd9fc10b0baad24188c42e8ea7201bc7ae98]
#
# patch "tommath_class.h"
#  from [a91c35ab0e5d115c16d6c6c9f6a107d22ee31d55]
#    to [901cd5a1b7d073ac104c6b5a1ef3c4df2f880345]
#
# patch "tommath_superclass.h"
#  from [47527ad5ee97a9524e14b307da9796293b1f586f]
#    to [c353f7aa0e686a75f30e75d9b2f20af9e35cf6e8]
#
============================================================
--- mess.sh	ee34aef379627e97871efac71f93ebe600548bd7
+++ mess.sh	ee34aef379627e97871efac71f93ebe600548bd7
@@ -0,0 +1,4 @@
+#!/bin/bash
+if cvs log $1 >/dev/null 2>/dev/null; then exit 0; else echo "$1 shouldn't be here" ; exit 1; fi
+
+
============================================================
--- bn.ind	eb15c6226d253088d1c63b4d47035e0c2a829fe2
+++ bn.ind	b5b26c459959328cc7fa46592fc33f0b635758b5
@@ -1,82 +1,82 @@
 \begin{theindex}

-  \item mp\_add, \hyperpage{29}
-  \item mp\_add\_d, \hyperpage{52}
-  \item mp\_and, \hyperpage{29}
-  \item mp\_clear, \hyperpage{11}
-  \item mp\_clear\_multi, \hyperpage{12}
-  \item mp\_cmp, \hyperpage{24}
-  \item mp\_cmp\_d, \hyperpage{25}
+  \item mp\_add, \hyperpage{31}
+  \item mp\_add\_d, \hyperpage{56}
+  \item mp\_and, \hyperpage{31}
+  \item mp\_clear, \hyperpage{12}
+  \item mp\_clear\_multi, \hyperpage{13}
+  \item mp\_cmp, \hyperpage{25}
+  \item mp\_cmp\_d, \hyperpage{26}
   \item mp\_cmp\_mag, \hyperpage{23}
-  \item mp\_div, \hyperpage{30}
-  \item mp\_div\_2, \hyperpage{26}
-  \item mp\_div\_2d, \hyperpage{28}
-  \item mp\_div\_d, \hyperpage{52}
-  \item mp\_dr\_reduce, \hyperpage{40}
-  \item mp\_dr\_setup, \hyperpage{40}
-  \item MP\_EQ, \hyperpage{22}
-  \item mp\_error\_to\_string, \hyperpage{10}
-  \item mp\_expt\_d, \hyperpage{43}
-  \item mp\_exptmod, \hyperpage{43}
-  \item mp\_exteuclid, \hyperpage{51}
-  \item mp\_gcd, \hyperpage{51}
+  \item mp\_div, \hyperpage{32}
+  \item mp\_div\_2, \hyperpage{28}
+  \item mp\_div\_2d, \hyperpage{30}
+  \item mp\_div\_d, \hyperpage{56}
+  \item mp\_dr\_reduce, \hyperpage{45}
+  \item mp\_dr\_setup, \hyperpage{45}
+  \item MP\_EQ, \hyperpage{23}
+  \item mp\_error\_to\_string, \hyperpage{9}
+  \item mp\_expt\_d, \hyperpage{47}
+  \item mp\_exptmod, \hyperpage{47}
+  \item mp\_exteuclid, \hyperpage{55}
+  \item mp\_gcd, \hyperpage{55}
   \item mp\_get\_int, \hyperpage{20}
-  \item mp\_grow, \hyperpage{16}
-  \item MP\_GT, \hyperpage{22}
+  \item mp\_grow, \hyperpage{17}
+  \item MP\_GT, \hyperpage{23}
   \item mp\_init, \hyperpage{11}
-  \item mp\_init\_copy, \hyperpage{13}
-  \item mp\_init\_multi, \hyperpage{12}
+  \item mp\_init\_copy, \hyperpage{14}
+  \item mp\_init\_multi, \hyperpage{13}
   \item mp\_init\_set, \hyperpage{21}
   \item mp\_init\_set\_int, \hyperpage{21}
-  \item mp\_init\_size, \hyperpage{14}
+  \item mp\_init\_size, \hyperpage{15}
   \item mp\_int, \hyperpage{10}
-  \item mp\_invmod, \hyperpage{52}
-  \item mp\_jacobi, \hyperpage{52}
-  \item mp\_lcm, \hyperpage{51}
-  \item mp\_lshd, \hyperpage{28}
-  \item MP\_LT, \hyperpage{22}
+  \item mp\_invmod, \hyperpage{56}
+  \item mp\_jacobi, \hyperpage{56}
+  \item mp\_lcm, \hyperpage{56}
+  \item mp\_lshd, \hyperpage{30}
+  \item MP\_LT, \hyperpage{23}
   \item MP\_MEM, \hyperpage{9}
-  \item mp\_mod, \hyperpage{35}
-  \item mp\_mod\_d, \hyperpage{52}
-  \item mp\_montgomery\_calc\_normalization, \hyperpage{38}
-  \item mp\_montgomery\_reduce, \hyperpage{37}
-  \item mp\_montgomery\_setup, \hyperpage{37}
-  \item mp\_mul, \hyperpage{31}
-  \item mp\_mul\_2, \hyperpage{26}
-  \item mp\_mul\_2d, \hyperpage{28}
-  \item mp\_mul\_d, \hyperpage{52}
-  \item mp\_n\_root, \hyperpage{44}
-  \item mp\_neg, \hyperpage{29}
+  \item mp\_mod, \hyperpage{39}
+  \item mp\_mod\_d, \hyperpage{56}
+  \item mp\_montgomery\_calc\_normalization, \hyperpage{42}
+  \item mp\_montgomery\_reduce, \hyperpage{42}
+  \item mp\_montgomery\_setup, \hyperpage{42}
+  \item mp\_mul, \hyperpage{33}
+  \item mp\_mul\_2, \hyperpage{28}
+  \item mp\_mul\_2d, \hyperpage{29}
+  \item mp\_mul\_d, \hyperpage{56}
+  \item mp\_n\_root, \hyperpage{48}
+  \item mp\_neg, \hyperpage{31, 32}
   \item MP\_NO, \hyperpage{9}
   \item MP\_OKAY, \hyperpage{9}
-  \item mp\_or, \hyperpage{29}
-  \item mp\_prime\_fermat, \hyperpage{45}
-  \item mp\_prime\_is\_divisible, \hyperpage{45}
-  \item mp\_prime\_is\_prime, \hyperpage{46}
-  \item mp\_prime\_miller\_rabin, \hyperpage{45}
-  \item mp\_prime\_next\_prime, \hyperpage{46}
-  \item mp\_prime\_rabin\_miller\_trials, \hyperpage{46}
-  \item mp\_prime\_random, \hyperpage{47}
-  \item mp\_prime\_random\_ex, \hyperpage{47}
-  \item mp\_radix\_size, \hyperpage{49}
-  \item mp\_read\_radix, \hyperpage{49}
-  \item mp\_read\_unsigned\_bin, \hyperpage{50}
-  \item mp\_reduce, \hyperpage{36}
-  \item mp\_reduce\_2k, \hyperpage{41}
-  \item mp\_reduce\_2k\_setup, \hyperpage{41}
-  \item mp\_reduce\_setup, \hyperpage{36}
-  \item mp\_rshd, \hyperpage{28}
+  \item mp\_or, \hyperpage{31}
+  \item mp\_prime\_fermat, \hyperpage{49}
+  \item mp\_prime\_is\_divisible, \hyperpage{49}
+  \item mp\_prime\_is\_prime, \hyperpage{51}
+  \item mp\_prime\_miller\_rabin, \hyperpage{50}
+  \item mp\_prime\_next\_prime, \hyperpage{51}
+  \item mp\_prime\_rabin\_miller\_trials, \hyperpage{50}
+  \item mp\_prime\_random, \hyperpage{51}
+  \item mp\_prime\_random\_ex, \hyperpage{52}
+  \item mp\_radix\_size, \hyperpage{53}
+  \item mp\_read\_radix, \hyperpage{53}
+  \item mp\_read\_unsigned\_bin, \hyperpage{54}
+  \item mp\_reduce, \hyperpage{40}
+  \item mp\_reduce\_2k, \hyperpage{46}
+  \item mp\_reduce\_2k\_setup, \hyperpage{46}
+  \item mp\_reduce\_setup, \hyperpage{40}
+  \item mp\_rshd, \hyperpage{30}
   \item mp\_set, \hyperpage{19}
   \item mp\_set\_int, \hyperpage{20}
-  \item mp\_shrink, \hyperpage{15}
-  \item mp\_sqr, \hyperpage{33}
-  \item mp\_sub, \hyperpage{29}
-  \item mp\_sub\_d, \hyperpage{52}
-  \item mp\_to\_unsigned\_bin, \hyperpage{50}
-  \item mp\_toradix, \hyperpage{49}
-  \item mp\_unsigned\_bin\_size, \hyperpage{50}
+  \item mp\_shrink, \hyperpage{16}
+  \item mp\_sqr, \hyperpage{35}
+  \item mp\_sub, \hyperpage{31}
+  \item mp\_sub\_d, \hyperpage{56}
+  \item mp\_to\_unsigned\_bin, \hyperpage{54}
+  \item mp\_toradix, \hyperpage{53}
+  \item mp\_unsigned\_bin\_size, \hyperpage{54}
   \item MP\_VAL, \hyperpage{9}
-  \item mp\_xor, \hyperpage{29}
+  \item mp\_xor, \hyperpage{31}
   \item MP\_YES, \hyperpage{9}

 \end{theindex}
============================================================
# bn.pdf is binary
============================================================
--- bn.tex	20cadcede6073a9027d85eb340269f5f15737f36
+++ bn.tex	3cf40f63f99097eb88fcdd728a0d5495904e8b7e
@@ -1,4 +1,4 @@
-\documentclass[b5paper]{book}
+\documentclass[synpaper]{book}
 \usepackage{hyperref}
 \usepackage{makeidx}
 \usepackage{amssymb}
@@ -49,8 +49,8 @@
 \begin{document}
 \frontmatter
 \pagestyle{empty}
-\title{LibTomMath User Manual \\ v0.35}
-\author{Tom St Denis \\ tomstdenis@iahu.ca}
+\title{LibTomMath User Manual \\ v0.40}
+\author{Tom St Denis \\ tomstdenis@gmail.com}
 \maketitle
 This text, the library and the accompanying textbook are all hereby placed in the public domain.  This book has been
 formatted for B5 [176x250] paper using the \LaTeX{} {\em book} macro package.
============================================================
--- bn_error.c	a3f1d67e5952a5288a5e3b25ae1af448d0c55323
+++ bn_error.c	2d913fbe9f26b513548a5b439ce5a2fc0439bfab
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 static const struct {
@@ -41,3 +41,7 @@ char *mp_error_to_string(int code)
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_error.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_fast_mp_invmod.c	4d3634c512613a6a57a72c5664058c4a47e9a960
+++ bn_fast_mp_invmod.c	15975e4e1d66aeae5d3bf1a337139813bd97dc64
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* computes the modular inverse via binary extended euclidean algorithm,
@@ -142,3 +142,7 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v,
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_fast_mp_invmod.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_fast_mp_montgomery_reduce.c	78d8d5998865b41471663c55715fb1dd6752cee7
+++ bn_fast_mp_montgomery_reduce.c	4c83769796abded7a48eeceb017835692128d5fd
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* computes xR**-1 == x (mod N) via Montgomery Reduction
@@ -166,3 +166,7 @@ int fast_mp_montgomery_reduce (mp_int *
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_fast_mp_montgomery_reduce.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_fast_s_mp_mul_digs.c	9a92ee7590332a1db78b9d37171680e6b87e1670
+++ bn_fast_s_mp_mul_digs.c	8c7ec5242443c6bbdfe90b6421c6e1351dd775b3
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* Fast (comba) multiplier
@@ -70,6 +70,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_i
       /* execute loop */
       for (iz = 0; iz < iy; ++iz) {
          _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--);
+
       }

       /* store term */
@@ -77,11 +78,8 @@ int fast_s_mp_mul_digs (mp_int * a, mp_i

       /* make next carry */
       _W = _W >> ((mp_word)DIGIT_BIT);
-  }
+ }

-  /* store final carry */
-  W[ix] = (mp_digit)(_W & MP_MASK);
-
   /* setup dest */
   olduse  = c->used;
   c->used = pa;
@@ -103,3 +101,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_i
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_fast_s_mp_mul_digs.c,v $ */
+/* $Revision: 1.7 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_fast_s_mp_mul_high_digs.c	ceff3a71492dd8079556c72a83364f4930e9e733
+++ bn_fast_s_mp_mul_high_digs.c	58c0a62a1a4fd0eb6d9b66f51b57348225b6d65a
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* this is a modified version of fast_s_mul_digs that only produces
@@ -70,9 +70,6 @@ int fast_s_mp_mul_high_digs (mp_int * a,
       _W = _W >> ((mp_word)DIGIT_BIT);
   }

-  /* store final carry */
-  W[ix] = (mp_digit)(_W & MP_MASK);
-
   /* setup dest */
   olduse  = c->used;
   c->used = pa;
@@ -81,7 +78,7 @@ int fast_s_mp_mul_high_digs (mp_int * a,
     register mp_digit *tmpc;

     tmpc = c->dp + digs;
-    for (ix = digs; ix <= pa; ix++) {
+    for (ix = digs; ix < pa; ix++) {
       /* now extract the previous digit [below the carry] */
       *tmpc++ = W[ix];
     }
@@ -95,3 +92,7 @@ int fast_s_mp_mul_high_digs (mp_int * a,
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_fast_s_mp_mul_high_digs.c,v $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/11/14 03:46:25 $ */
============================================================
--- bn_fast_s_mp_sqr.c	eda475fe947ffc90906c7167eec15450c2209362
+++ bn_fast_s_mp_sqr.c	b18e62eb12ffb8e8f4a434a237c2efa75b73fdc4
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* the jist of squaring...
@@ -108,3 +108,7 @@ int fast_s_mp_sqr (mp_int * a, mp_int *
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_fast_s_mp_sqr.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_2expt.c	c0a974c10b34a7d5fa7e677ae3d1293a4e290138
+++ bn_mp_2expt.c	d02950375b877315d7b9f4c96acddcdd7cea623d
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* computes a = 2**b
@@ -42,3 +42,7 @@ mp_2expt (mp_int * a, int b)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_2expt.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_abs.c	5ee072348880edcf0c2830885697a4233734580d
+++ bn_mp_abs.c	cc89fc43ae13f246ad1ab978ed599c93d4cb01b9
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* b = |a|
@@ -37,3 +37,7 @@ mp_abs (mp_int * a, mp_int * b)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_abs.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_add.c	0cc7225dceeea5eb317eb215e4417ee0f23dd4ae
+++ bn_mp_add.c	f2289f13117e9016d82afcd94c2ab991a1e57802
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* high level addition (handles signs) */
@@ -47,3 +47,7 @@ int mp_add (mp_int * a, mp_int * b, mp_i
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_add.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_add_d.c	d6830e293314b416b519fede793966d4ecbfde57
+++ bn_mp_add_d.c	a9a93d171db95284326e1803d70cd16d5be92ac8
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* single digit addition */
@@ -40,6 +40,9 @@ mp_add_d (mp_int * a, mp_digit b, mp_int
      /* fix sign  */
      a->sign = c->sign = MP_NEG;

+     /* clamp */
+     mp_clamp(c);
+
      return res;
   }

@@ -103,3 +106,7 @@ mp_add_d (mp_int * a, mp_digit b, mp_int
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_add_d.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_addmod.c	b15c4348f1d5f51ccb10b50d1206032b4e0e0c4c
+++ bn_mp_addmod.c	e8276fd9681b60cc5846f410134bf0970974876a
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* d = a + b (mod c) */
@@ -35,3 +35,7 @@ mp_addmod (mp_int * a, mp_int * b, mp_in
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_addmod.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_and.c	74d28d927a0271c274f0ff8195651d793c2307a1
+++ bn_mp_and.c	f9d823300dfb664349710a9bfad2be4bdfc76b04
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* AND two ints together */
@@ -51,3 +51,7 @@ mp_and (mp_int * a, mp_int * b, mp_int *
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_and.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_clamp.c	7c26a55902cadb40f234df0f174b750102b05122
+++ bn_mp_clamp.c	89152494cc2db2aeb0950d4f97a46d69d51d0fbd
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* trim unused digits
@@ -38,3 +38,7 @@ mp_clamp (mp_int * a)
   }
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_clamp.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_clear.c	246c4a2b16e20f7d0a43f1fc990c3a7f1ead9bfb
+++ bn_mp_clear.c	2378b1b2751c869649011dc51b5e4626c20b22a4
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* clear one (frees)  */
@@ -38,3 +38,7 @@ mp_clear (mp_int * a)
   }
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_clear.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_clear_multi.c	30f79c92867e21713828f674e9f125602d1edbfb
+++ bn_mp_clear_multi.c	6d62953c54210dec638be9f5a2294f83a619b40e
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */
 #include <stdarg.h>

@@ -28,3 +28,7 @@ void mp_clear_multi(mp_int *mp, ...)
     va_end(args);
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_clear_multi.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_cmp.c	f48e439ef12bf49c92d8269958c09d2fb7e390ec
+++ bn_mp_cmp.c	d671443879ebd10881e72316c18461ed1db34433
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* compare two ints (signed)*/
@@ -37,3 +37,7 @@ mp_cmp (mp_int * a, mp_int * b)
   }
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_cmp.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_cmp_d.c	a3e0a785b17ac01577ef58cebd7df89baa4a0dc9
+++ bn_mp_cmp_d.c	1b074dab32ee11b2c4ee6962f456c61f56a79797
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* compare a digit */
@@ -38,3 +38,7 @@ int mp_cmp_d(mp_int * a, mp_digit b)
   }
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_cmp_d.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_cmp_mag.c	a0698d9635cf3832841c8cc50639af3caa3d02c4
+++ bn_mp_cmp_mag.c	b86add5ee03e1e98f3d2050b7a2226835e8e9f63
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* compare maginitude of two ints (unsigned) */
@@ -49,3 +49,7 @@ int mp_cmp_mag (mp_int * a, mp_int * b)
   return MP_EQ;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_cmp_mag.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_cnt_lsb.c	3d6446de20143460fada1208b56c20fdcb5a0f89
+++ bn_mp_cnt_lsb.c	6a13ed21775156012c18bc7fe2a96a4b13668afe
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 static const int lnz[16] = {
@@ -47,3 +47,7 @@ int mp_cnt_lsb(mp_int *a)
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_cnt_lsb.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_copy.c	a548ebca4bf8db0dca759222dfa976b97d551c89
+++ bn_mp_copy.c	d56eca4a86a1aced85aa6d4349460326416a87cf
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* copy, b = a */
@@ -62,3 +62,7 @@ mp_copy (mp_int * a, mp_int * b)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_copy.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_count_bits.c	40adf953ce3210d33f9723e6f724e4700a807718
+++ bn_mp_count_bits.c	460d18db977e52240bdc2255a0cd130f837ba2e4
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* returns the number of bits in an int */
@@ -39,3 +39,7 @@ mp_count_bits (mp_int * a)
   return r;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_count_bits.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_div.c	0f214a2ee7c1cfd6152ebd473d2f04db67f2f86c
+++ bn_mp_div.c	1603878fe4fe2c8c763a985369744f1d526f586e
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 #ifdef BN_MP_DIV_SMALL
@@ -286,3 +286,7 @@ LBL_Q:mp_clear (&q);
 #endif

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_div.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_div_2.c	e57a17c6b78085f9e5eef4df072218919a1888b6
+++ bn_mp_div_2.c	d584eb2131c23d44f7d8a1c58fe0330520742961
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* b = a/2 */
@@ -62,3 +62,7 @@ int mp_div_2(mp_int * a, mp_int * b)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_div_2.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_div_2d.c	58636c779564cc44fdd8ccf9b75f01f047fb45e8
+++ bn_mp_div_2d.c	814b62178fc9d469011d1291209c976b1c5689aa
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* shift right by a certain bit count (store quotient in c, optional remainder in d) */
@@ -91,3 +91,7 @@ int mp_div_2d (mp_int * a, int b, mp_int
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_div_2d.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_div_3.c	1d32a597de97e1ae46dc5b399c9dc9f6a2068475
+++ bn_mp_div_3.c	d96605d29c8e0bd8edbd72120db01e97138b71b4
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* divide by three (based on routine from MPI and the GMP manual) */
@@ -73,3 +73,7 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digi
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_div_3.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_div_d.c	d7f4600af77c0ec3d063e71f1ea76bb6da0f882f
+++ bn_mp_div_d.c	cbdcd35ed87ee6231ba332aea9b4999057e95726
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 static int s_is_power_of_two(mp_digit b, int *p)
@@ -104,3 +104,7 @@ int mp_div_d (mp_int * a, mp_digit b, mp
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_div_d.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_dr_is_modulus.c	66009ac52e299147a27b8562fcaeef9ff806b8f0
+++ bn_mp_dr_is_modulus.c	94797f18971c49db29fe3a5068525e903386896e
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* determines if a number is a valid DR modulus */
@@ -37,3 +37,7 @@ int mp_dr_is_modulus(mp_int *a)
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_dr_is_modulus.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_dr_reduce.c	e66ad3324fbe632c9168616227cab4bafada767a
+++ bn_mp_dr_reduce.c	7290d18987f613cdb2a6b5f22efa6c5faeebb850
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* reduce "x" in place modulo "n" using the Diminished Radix algorithm.
@@ -88,3 +88,7 @@ top:
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_dr_reduce.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_dr_setup.c	bd378fd2525c0d744ffeccebc38703c189f4a140
+++ bn_mp_dr_setup.c	d5f860f0fa662e85db3871a63ea7026318140f51
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* determines the setup value */
@@ -26,3 +26,7 @@ void mp_dr_setup(mp_int *a, mp_digit *d)
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_dr_setup.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_exch.c	acfc6896a26538be3832eba6ff1d4d17a0b2fae2
+++ bn_mp_exch.c	7f77882503c78291246802dfdc5951e85b83e5dc
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* swap the elements of two integers, for cases where you can't simply swap the
@@ -28,3 +28,7 @@ mp_exch (mp_int * a, mp_int * b)
   *b = t;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_exch.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_expt_d.c	b7adb8028ffe97d74f17a2c3e4ee85aa222ffe0f
+++ bn_mp_expt_d.c	261f9a3fb03d75be6dfaa0d6001b39b292e08fd1
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* calculate c = a**b  using a square-multiply algorithm */
@@ -51,3 +51,7 @@ int mp_expt_d (mp_int * a, mp_digit b, m
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_expt_d.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_exptmod.c	5834ec7efb5ce20b64f84e8015eaa59bfd93f090
+++ bn_mp_exptmod.c	db7933b21337396fa608bb6f2ca1f04fa7915198
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */


@@ -66,7 +66,7 @@ int mp_exptmod (mp_int * G, mp_int * X,
   }

 /* modified diminished radix reduction */
-#if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C)
+#if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && defined(BN_S_MP_EXPTMOD_C)
   if (mp_reduce_is_2k_l(P) == MP_YES) {
      return s_mp_exptmod(G, X, P, Y, 1);
   }
@@ -106,3 +106,7 @@ int mp_exptmod (mp_int * G, mp_int * X,
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_exptmod.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_exptmod_fast.c	0c597499c614a4fc38dbf06574749138133f69b2
+++ bn_mp_exptmod_fast.c	5a692f134deeab0992612206c16f8bf970b5088c
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85
@@ -315,3 +315,7 @@ LBL_M:
 }
 #endif

+
+/* $Source: /cvs/libtom/libtommath/bn_mp_exptmod_fast.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_exteuclid.c	84910598afbed46c88cd0802b8c2607c8ea9e1d0
+++ bn_mp_exteuclid.c	2e2e7f55da00258ed0bae27ce268ae1235b5d6b2
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* Extended euclidean algorithm of (a, b) produces
@@ -76,3 +76,7 @@ _ERR: mp_clear_multi(&u1, &u2, &u3, &v1,
    return err;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_exteuclid.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_fread.c	4e80ea1d33795bf3aac96f439e182f56c46992d7
+++ bn_mp_fread.c	0671107a9cfa26d3518db90f3c6adf72a9365564
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* read a bigint from a file stream in ASCII */
@@ -61,3 +61,7 @@ int mp_fread(mp_int *a, int radix, FILE
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_fread.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_fwrite.c	3923546490c8d8ea313e3a75ed030bb5f637a14b
+++ bn_mp_fwrite.c	199e089ebf312e694f5afb241c0d6e38a7a06062
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 int mp_fwrite(mp_int *a, int radix, FILE *stream)
@@ -46,3 +46,7 @@ int mp_fwrite(mp_int *a, int radix, FILE
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_fwrite.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_gcd.c	a5ec727015fd307450f7718c481285dd1599d5d0
+++ bn_mp_gcd.c	bf556ea29d2e32c27105cd6f8ff69c4da406ba3a
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* Greatest Common Divisor using the binary method */
@@ -22,21 +22,13 @@ int mp_gcd (mp_int * a, mp_int * b, mp_i
   int     k, u_lsb, v_lsb, res;

   /* either zero than gcd is the largest */
-  if (mp_iszero (a) == 1 && mp_iszero (b) == 0) {
+  if (mp_iszero (a) == MP_YES) {
     return mp_abs (b, c);
   }
-  if (mp_iszero (a) == 0 && mp_iszero (b) == 1) {
+  if (mp_iszero (b) == MP_YES) {
     return mp_abs (a, c);
   }

-  /* optimized.  At this point if a == 0 then
-   * b must equal zero too
-   */
-  if (mp_iszero (a) == 1) {
-    mp_zero(c);
-    return MP_OKAY;
-  }
-
   /* get copies of a and b we can modify */
   if ((res = mp_init_copy (&u, a)) != MP_OKAY) {
     return res;
@@ -107,3 +99,7 @@ LBL_U:mp_clear (&v);
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_gcd.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_get_int.c	c161ac67fec2fda9279c294f69845fd44cabfa6d
+++ bn_mp_get_int.c	e56841a81a3b93ec8afe25f144f8990b5b27e5b7
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* get the lower 32-bits of an mp_int */
@@ -39,3 +39,7 @@ unsigned long mp_get_int(mp_int * a)
   return res & 0xFFFFFFFFUL;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_get_int.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_grow.c	5d24eb35c5e6eeb36e58dc477f570f308e31b86c
+++ bn_mp_grow.c	371fba672eba9a36894e37f7c87333eca9d13a58
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* grow as required */
@@ -51,3 +51,7 @@ int mp_grow (mp_int * a, int size)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_grow.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_init.c	dc9416c8eef1a2aec31f655efbf69f30366707ec
+++ bn_mp_init.c	78b37a5252d18b46f9b32108d733071f351aeaf5
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* init a new mp_int */
@@ -40,3 +40,7 @@ int mp_init (mp_int * a)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_init.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_init_copy.c	85088498a8625eb86dd85679e1f39c7757561fa2
+++ bn_mp_init_copy.c	fd7c20c0ee3473615de23c59074cf5c6757a20ca
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* creates "a" then copies b into it */
@@ -26,3 +26,7 @@ int mp_init_copy (mp_int * a, mp_int * b
   return mp_copy (b, a);
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_init_copy.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_init_multi.c	b1635102a3be4451303a739b6f164f73d10ca561
+++ bn_mp_init_multi.c	7eb256888f319d1f22a2077840b00144a635a360
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */
 #include <stdarg.h>

@@ -53,3 +53,7 @@ int mp_init_multi(mp_int *mp, ...)
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_init_multi.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_init_set.c	53918f753d6f18c1e0fc608b8b67ada7fc25af3b
+++ bn_mp_init_set.c	cc8de44fe1c250b7fd3c3c34764eeb6479442307
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* initialize and set a digit */
@@ -26,3 +26,7 @@ int mp_init_set (mp_int * a, mp_digit b)
   return err;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_init_set.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_init_set_int.c	1772b10c31bf67011748664d7ed6541d9cad0ac6
+++ bn_mp_init_set_int.c	62b0c86e524c47885c0acef1c0b98dc9d43120bd
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* initialize and set a digit */
@@ -25,3 +25,7 @@ int mp_init_set_int (mp_int * a, unsigne
   return mp_set_int(a, b);
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_init_set_int.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_init_size.c	f343728fd0b919c0551ee4fb955c7b7348084917
+++ bn_mp_init_size.c	7f3cd6fbba38b36e824d4fa6bfc71384e1fc6150
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* init an mp_init for a given size */
@@ -42,3 +42,7 @@ int mp_init_size (mp_int * a, int size)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_init_size.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_invmod.c	05e43c05923465c284cccf8707ee1a59ed911233
+++ bn_mp_invmod.c	ce1865904090004db508933d7085a1af7e908b78
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* hac 14.61, pp608 */
@@ -37,3 +37,7 @@ int mp_invmod (mp_int * a, mp_int * b, m
   return MP_VAL;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_invmod.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_invmod_slow.c	0e68e06289ca853df2e27007a793f251eeb6db76
+++ bn_mp_invmod_slow.c	1df4033bc1245af3306017c814f91956404f9d17
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* hac 14.61, pp608 */
@@ -169,3 +169,7 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v,
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_invmod_slow.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_is_square.c	e905ec883178a2185809f2c902bac355e5816bad
+++ bn_mp_is_square.c	1b3b3d62e0920e8ea1fdb4ab9ef75fdc1675d5d6
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* Check if remainders are possible squares - fast exclude non-squares */
@@ -103,3 +103,7 @@ ERR:mp_clear(&t);
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_is_square.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_jacobi.c	9c41eb9191d5875db6dd10ef168fedbe621a3b2a
+++ bn_mp_jacobi.c	8b6a59e14a516bb223dd5b89c6212480d3e6b046
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* computes the jacobi c = (a | n) (or Legendre if n is prime)
@@ -99,3 +99,7 @@ LBL_A1:mp_clear (&a1);
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_jacobi.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_karatsuba_mul.c	7bed1bacfcdcc8d1c5962ad4bcc6ef3c1f55bea9
+++ bn_mp_karatsuba_mul.c	d12ad7521ac06b66055b94595f5ee8c73198859d
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* c = |a| * |b| using Karatsuba Multiplication using
@@ -26,12 +26,12 @@
  * b = b1 * B**n + b0
  *
  * Then, a * b =>
-   a1b1 * B**2n + ((a1 - a0)(b1 - b0) + a0b0 + a1b1) * B + a0b0
+   a1b1 * B**2n + ((a1 + a0)(b1 + b0) - (a0b0 + a1b1)) * B + a0b0
  *
  * Note that a1b1 and a0b0 are used twice and only need to be
  * computed once.  So in total three half size (half # of
  * digit) multiplications are performed, a0b0, a1b1 and
- * (a1-b1)(a0-b0)
+ * (a1+b1)(a0+b0)
  *
  * Note that a multiplication of half the digits requires
  * 1/4th the number of single precision multiplications so in
@@ -122,19 +122,19 @@ int mp_karatsuba_mul (mp_int * a, mp_int
   if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY)
     goto X1Y1;          /* x1y1 = x1*y1 */

-  /* now calc x1-x0 and y1-y0 */
-  if (mp_sub (&x1, &x0, &t1) != MP_OKAY)
+  /* now calc x1+x0 and y1+y0 */
+  if (s_mp_add (&x1, &x0, &t1) != MP_OKAY)
     goto X1Y1;          /* t1 = x1 - x0 */
-  if (mp_sub (&y1, &y0, &x0) != MP_OKAY)
+  if (s_mp_add (&y1, &y0, &x0) != MP_OKAY)
     goto X1Y1;          /* t2 = y1 - y0 */
   if (mp_mul (&t1, &x0, &t1) != MP_OKAY)
-    goto X1Y1;          /* t1 = (x1 - x0) * (y1 - y0) */
+    goto X1Y1;          /* t1 = (x1 + x0) * (y1 + y0) */

   /* add x0y0 */
   if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY)
     goto X1Y1;          /* t2 = x0y0 + x1y1 */
-  if (mp_sub (&x0, &t1, &t1) != MP_OKAY)
-    goto X1Y1;          /* t1 = x0y0 + x1y1 - (x1-x0)*(y1-y0) */
+  if (s_mp_sub (&t1, &x0, &t1) != MP_OKAY)
+    goto X1Y1;          /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */

   /* shift by B */
   if (mp_lshd (&t1, B) != MP_OKAY)
@@ -161,3 +161,7 @@ ERR:
   return err;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_karatsuba_mul.c,v $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_karatsuba_sqr.c	32ce87d5ec2f68aea40bea22927f5a3f632c47b5
+++ bn_mp_karatsuba_sqr.c	cb25e7157ae4c7432461857852bf8bf43b124755
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* Karatsuba squaring, computes b = a*a using three
@@ -80,8 +80,8 @@ int mp_karatsuba_sqr (mp_int * a, mp_int
   if (mp_sqr (&x1, &x1x1) != MP_OKAY)
     goto X1X1;           /* x1x1 = x1*x1 */

-  /* now calc (x1-x0)**2 */
-  if (mp_sub (&x1, &x0, &t1) != MP_OKAY)
+  /* now calc (x1+x0)**2 */
+  if (s_mp_add (&x1, &x0, &t1) != MP_OKAY)
     goto X1X1;           /* t1 = x1 - x0 */
   if (mp_sqr (&t1, &t1) != MP_OKAY)
     goto X1X1;           /* t1 = (x1 - x0) * (x1 - x0) */
@@ -89,8 +89,8 @@ int mp_karatsuba_sqr (mp_int * a, mp_int
   /* add x0y0 */
   if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY)
     goto X1X1;           /* t2 = x0x0 + x1x1 */
-  if (mp_sub (&t2, &t1, &t1) != MP_OKAY)
-    goto X1X1;           /* t1 = x0x0 + x1x1 - (x1-x0)*(x1-x0) */
+  if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY)
+    goto X1X1;           /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */

   /* shift by B */
   if (mp_lshd (&t1, B) != MP_OKAY)
@@ -115,3 +115,7 @@ ERR:
   return err;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_karatsuba_sqr.c,v $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_lcm.c	ae6e40952e57e849e762a25ce87385e02fb4bdcd
+++ bn_mp_lcm.c	2efc953f9b2bf277bb46d07bde7ea65497ab65d9
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* computes least common multiple as |a*b|/(a, b) */
@@ -54,3 +54,7 @@ LBL_T:
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_lcm.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_lshd.c	0c04c3e6d8491249a27227826faeae84c966a94f
+++ bn_mp_lshd.c	1be9d6059f7990723ab18ad01c84eef2dcb743a6
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* shift left a certain amount of digits */
@@ -61,3 +61,7 @@ int mp_lshd (mp_int * a, int b)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_lshd.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_mod.c	c8090d320496ca60b99764b9335ba865c36cbfed
+++ bn_mp_mod.c	3bed12926c4d019853f2b4dac814a7505580380e
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* c = a mod b, 0 <= c < b */
@@ -42,3 +42,7 @@ mp_mod (mp_int * a, mp_int * b, mp_int *
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_mod.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_mod_2d.c	e0e5f0ab899aae9477bf97785f85320ad0b78865
+++ bn_mp_mod_2d.c	39b5088c61a702e45117c046a246c0ba3457acec
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* calc a value mod 2**b */
@@ -49,3 +49,7 @@ mp_mod_2d (mp_int * a, int b, mp_int * c
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_mod_2d.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_mod_d.c	57cd7a01f1616d22ebced526e91159b1d242e0f9
+++ bn_mp_mod_d.c	6df502c9569a11c797e90478d2a8909ba0d1247c
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 int
@@ -21,3 +21,7 @@ mp_mod_d (mp_int * a, mp_digit b, mp_dig
   return mp_div_d(a, b, NULL, c);
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_mod_d.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_montgomery_calc_normalization.c	41769e061872600b8d99328e343fe770b7b3aec4
+++ bn_mp_montgomery_calc_normalization.c	87b5ed6813882ce20a7cfd650969495219105276
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /*
@@ -53,3 +53,7 @@ int mp_montgomery_calc_normalization (mp
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_montgomery_calc_normalization.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_montgomery_reduce.c	0b42eac9d7346004d688cbe3063e947ea1893f3f
+++ bn_mp_montgomery_reduce.c	a57d1c56341758bafd5640de7816ff2f7d9641cb
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* computes xR**-1 == x (mod N) via Montgomery Reduction */
@@ -112,3 +112,7 @@ mp_montgomery_reduce (mp_int * x, mp_int
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_montgomery_reduce.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_montgomery_setup.c	0ddf17c06f6f5dc9fd7311284277b7a87a3cfc27
+++ bn_mp_montgomery_setup.c	63ee332ae3a63047da7a388f8ca254b0cd4957a4
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* setups the montgomery reduction stuff */
@@ -48,8 +48,12 @@ mp_montgomery_setup (mp_int * n, mp_digi
 #endif

   /* rho = -1/m mod b */
-  *rho = (((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
+  *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;

   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_montgomery_setup.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/12/04 21:34:03 $ */
============================================================
--- bn_mp_mul.c	cb9292558d6b699232dfe1d24d6b134b265aec30
+++ bn_mp_mul.c	f95da85da87525e95e09c97272ee1c70420b2fda
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* high level multiplication (handles sign) */
@@ -60,3 +60,7 @@ int mp_mul (mp_int * a, mp_int * b, mp_i
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_mul.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_mul_2.c	e7df32645d7a80e3badc2c696caf09d438932742
+++ bn_mp_mul_2.c	551cba350d6670dd37afa3ff3f928002b60257e2
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* b = a*2 */
@@ -76,3 +76,7 @@ int mp_mul_2(mp_int * a, mp_int * b)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_mul_2.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_mul_2d.c	2d59d8ba0c487c42e75e24cd6808147fee6041ff
+++ bn_mp_mul_2d.c	aad4f65c8fe2dfbdffd0dbea052515346b2c1345
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* shift left by a certain bit count */
@@ -79,3 +79,7 @@ int mp_mul_2d (mp_int * a, int b, mp_int
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_mul_2d.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_mul_d.c	684e50bde0381306076b4b64d2ecbab99b7af195
+++ bn_mp_mul_d.c	5ccc5289b208ab817dbb8d966b279c30fe0270aa
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* multiply by a digit */
@@ -73,3 +73,7 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_mul_d.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_mulmod.c	958738a570b35415e919d6c6e55adbce7ff59f55
+++ bn_mp_mulmod.c	935d0f5903589ddf62f42fc691cb2f83aa2832c4
@@ -12,12 +12,11 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* d = a * b (mod c) */
-int
-mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
+int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
 {
   int     res;
   mp_int  t;
@@ -35,3 +34,7 @@ mp_mulmod (mp_int * a, mp_int * b, mp_in
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_mulmod.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_n_root.c	ceda8bdd58d2fb45707be024bc9ad46ceb44a337
+++ bn_mp_n_root.c	7cd8f559d867362d24bc0d3b468e94c8520b92e6
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* find the n'th root of an integer
@@ -126,3 +126,7 @@ LBL_T1:mp_clear (&t1);
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_n_root.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_neg.c	02cb8735d235feb2f3016b581f23d6da582f8765
+++ bn_mp_neg.c	1f6e366f84f62e9790cd32a2197ac01ab15f18d3
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* b = -a */
@@ -34,3 +34,7 @@ int mp_neg (mp_int * a, mp_int * b)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_neg.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_or.c	01c1a84d9dcba644c61f69a3c00164f5f3346599
+++ bn_mp_or.c	7172bc3a4b5683959d2b4780fd2b1bc7d8edb3c1
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* OR two ints together */
@@ -44,3 +44,7 @@ int mp_or (mp_int * a, mp_int * b, mp_in
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_or.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_prime_fermat.c	bed25e3d7aef4e9ce0bd9642626e082b7bc02e73
+++ bn_mp_prime_fermat.c	d6a54db5584a3b7557d4aff7b0dc30ebdf28a731
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* performs one Fermat test.
@@ -56,3 +56,7 @@ LBL_T:mp_clear (&t);
   return err;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_prime_fermat.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_prime_is_divisible.c	ac6f9ad19e8ee7c27df8dab72b160090de3f88e5
+++ bn_mp_prime_is_divisible.c	efff6a4fe42fffe8f6d30ff6b240194cd7c46e72
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* determines if an integers is divisible by one
@@ -44,3 +44,7 @@ int mp_prime_is_divisible (mp_int * a, i
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_prime_is_divisible.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_prime_is_prime.c	616c045068c12c0d7cd8a73080ef55da4e501493
+++ bn_mp_prime_is_prime.c	dc21e8dade254b50b4339e7b33e28793cc2051b1
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* performs a variable number of rounds of Miller-Rabin
@@ -77,3 +77,7 @@ LBL_B:mp_clear (&b);
   return err;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_prime_is_prime.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_prime_miller_rabin.c	e893c60f539dce9136d4afe96650b4e5a649876b
+++ bn_mp_prime_miller_rabin.c	d59e75a31931262d9d08121a0fc78e93ae7628d2
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* Miller-Rabin test of "a" to the base of "b" as described in
@@ -97,3 +97,7 @@ LBL_N1:mp_clear (&n1);
   return err;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_prime_miller_rabin.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_prime_next_prime.c	cc04aebd4d5b5e203b330e0f4a8180c48be6af13
+++ bn_mp_prime_next_prime.c	d0f2cc0de0f3f223bdf94c4b717a14875d131614
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* finds the next prime after the number "a" using "t" trials
@@ -164,3 +164,7 @@ LBL_ERR:
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_prime_next_prime.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_prime_rabin_miller_trials.c	93963170cbd3a50b33dc5f1dd76ccdfd935c239c
+++ bn_mp_prime_rabin_miller_trials.c	b0421d46d35a8f5ee2a448e246732e6953529948
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */


@@ -46,3 +46,7 @@ int mp_prime_rabin_miller_trials(int siz


 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_prime_rabin_miller_trials.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_prime_random_ex.c	4cba143b51b505f3c881caf21f5879695d0dcefa
+++ bn_mp_prime_random_ex.c	f1a195af61c7430bd490c9fac1e5a6ca813817bb
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* makes a truly random prime of a given size (bits),
@@ -62,10 +62,8 @@ int mp_prime_random_ex(mp_int *a, int t,
    maskOR_msb        = 0;
    maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0;
    if (flags & LTM_PRIME_2MSB_ON) {
-      maskOR_msb     |= 1 << ((size - 2) & 7);
-   } else if (flags & LTM_PRIME_2MSB_OFF) {
-      maskAND        &= ~(1 << ((size - 2) & 7));
-   }
+      maskOR_msb       |= 0x80 >> ((9 - size) & 7);
+   }

    /* get the maskOR_lsb */
    maskOR_lsb         = 1;
@@ -121,3 +119,7 @@ error:


 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_prime_random_ex.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_radix_size.c	cea57d1d767181e6a51d13d3dd79684a4e62482a
+++ bn_mp_radix_size.c	c4c793794ffb15a3995382cfbbfc6e014e9449f1
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* returns size of ASCII reprensentation */
@@ -36,7 +36,7 @@ int mp_radix_size (mp_int * a, int radix
   }

   if (mp_iszero(a) == MP_YES) {
-     *size = 2;
+    *size = 2;
     return MP_OKAY;
   }

@@ -72,3 +72,7 @@ int mp_radix_size (mp_int * a, int radix
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_radix_size.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_radix_smap.c	9b2641767d4071696aa72126a339bd5450163b9e
+++ bn_mp_radix_smap.c	90acb63521808ba2825dacbf29401f79a06efcc2
@@ -12,9 +12,13 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* chars used in radix conversions */
 const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_radix_smap.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_rand.c	21e113ee13fd97a003bb05376e3bf1c706469d43
+++ bn_mp_rand.c	aa66e8277829f6ecd05ca0c3c91b209c844bd4a7
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* makes a pseudo-random int of a given size */
@@ -49,3 +49,7 @@ mp_rand (mp_int * a, int digits)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_rand.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_read_radix.c	a761d92fa0571ee25a4d8e25029b65ed715f5c41
+++ bn_mp_read_radix.c	cb0ec976374b9be1ef0066b884fafea58f6d3eee
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* read a string [ASCII] in a given radix */
@@ -21,6 +21,9 @@ int mp_read_radix (mp_int * a, const cha
   int     y, res, neg;
   char    ch;

+  /* zero the digit bignum */
+  mp_zero(a);
+
   /* make sure the radix is ok */
   if (radix < 2 || radix > 64) {
     return MP_VAL;
@@ -76,3 +79,7 @@ int mp_read_radix (mp_int * a, const cha
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_read_radix.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_read_signed_bin.c	5e3b2483fb9e04ac544331b7a46df0263e3a6cd0
+++ bn_mp_read_signed_bin.c	46e0eb1eeb55a3c156f04219b12f82aa7c64b1ba
@@ -12,12 +12,11 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* read signed bin, big endian, first byte is 0==positive or 1==negative */
-int
-mp_read_signed_bin (mp_int * a, unsigned char *b, int c)
+int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c)
 {
   int     res;

@@ -36,3 +35,7 @@ mp_read_signed_bin (mp_int * a, unsigned
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_read_signed_bin.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_read_unsigned_bin.c	15a5dc9e2dd8a6fe5a7b53c52c4ecb4babbdd1d5
+++ bn_mp_read_unsigned_bin.c	55c99cff4309d0b894cbbe9dbfee85bd206eeb63
@@ -12,12 +12,11 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* reads a unsigned char array, assumes the msb is stored first [big endian] */
-int
-mp_read_unsigned_bin (mp_int * a, unsigned char *b, int c)
+int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c)
 {
   int     res;

@@ -50,3 +49,7 @@ mp_read_unsigned_bin (mp_int * a, unsign
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_read_unsigned_bin.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_reduce.c	22c1ae63de48d5cc0e48db4bcadef234f025e060
+++ bn_mp_reduce.c	9c18643caba6d8f2895c5fc474040c640516997b
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* reduces x mod m, assumes 0 < x < m**2, mu is
@@ -94,3 +94,7 @@ CLEANUP:
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_reduce.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_reduce_2k.c	3a75893da1c3a1c868056cb31e118a3683200bd5
+++ bn_mp_reduce_2k.c	85e52ad760353d6e2e869459d713cecf49eaef4b
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* reduces a modulo n where n is of the form 2**p - d */
@@ -55,3 +55,7 @@ ERR:
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_2k.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_reduce_2k_l.c	18cbea4d1de3dcd4ae121ef87f750fd71b936d65
+++ bn_mp_reduce_2k_l.c	05a3e5ac63757258558201d23442cf0a22706b4c
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* reduces a modulo n where n is of the form 2**p - d
@@ -56,3 +56,7 @@ ERR:
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_2k_l.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_reduce_2k_setup.c	94f2c64d767763bc4c38322b408d768ca2aa4ecc
+++ bn_mp_reduce_2k_setup.c	2cba08eed631dfc432f8248373e6d23b77283180
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* determines the setup value */
@@ -41,3 +41,7 @@ int mp_reduce_2k_setup(mp_int *a, mp_dig
    return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_2k_setup.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_reduce_2k_setup_l.c	2f7604831262ef985d2d84fff4079f660e9d4355
+++ bn_mp_reduce_2k_setup_l.c	3b5c4f5c810be907d8a1278715629afae0eff683
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* determines the setup value */
@@ -38,3 +38,7 @@ ERR:
    return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_2k_setup_l.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_reduce_is_2k.c	4d4b366051978336c6ab81f3e987b0aa19c16812
+++ bn_mp_reduce_is_2k.c	63e0be9bf4893e8b1748b59881d5c8dfd07f977b
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* determines if mp_reduce_2k can be used */
@@ -46,3 +46,7 @@ int mp_reduce_is_2k(mp_int *a)
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_is_2k.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_reduce_is_2k_l.c	f8a3ff10225afdfb3aa25c9de44066343247722a
+++ bn_mp_reduce_is_2k_l.c	0d61c2db7ed32d9e04049f132f1e3b83dc1cba24
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* determines if reduce_2k_l can be used */
@@ -38,3 +38,7 @@ int mp_reduce_is_2k_l(mp_int *a)
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_is_2k_l.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_reduce_setup.c	c0d6b73b259cda2c962f44710c16a7942f6adbfc
+++ bn_mp_reduce_setup.c	17d0c225ecb4671353a9158de6d0eb189e704bdf
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* pre-calculate the value required for Barrett reduction
@@ -28,3 +28,7 @@ int mp_reduce_setup (mp_int * a, mp_int
   return mp_div (a, b, a, NULL);
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_reduce_setup.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_rshd.c	f3d16d9373f3707a2024da60481cfcb91484a34d
+++ bn_mp_rshd.c	01550999b6f4d046203f0ba9fa69e28441063075
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* shift right a certain amount of digits */
@@ -66,3 +66,7 @@ void mp_rshd (mp_int * a, int b)
   a->used -= b;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_rshd.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_set.c	a9535a1aa1f54c47f3bb503c74d03b7202f682a0
+++ bn_mp_set.c	b9720c95ebba5888000331272a9b363ac60f757f
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* set to a digit */
@@ -23,3 +23,7 @@ void mp_set (mp_int * a, mp_digit b)
   a->used  = (a->dp[0] != 0) ? 1 : 0;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_set.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_set_int.c	f969f32a9ce516009747993ccd66e03e17aff3f2
+++ bn_mp_set_int.c	b5eb6b13ba3e4f03c52574fab0dd85b8b915924f
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* set a 32-bit const */
@@ -42,3 +42,7 @@ int mp_set_int (mp_int * a, unsigned lon
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_set_int.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_shrink.c	1349448a8f2a625e7817074996951d5a2d1ec158
+++ bn_mp_shrink.c	2a97caa488bf03b698501431831788b7096dde65
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* shrink a bignum */
@@ -29,3 +29,7 @@ int mp_shrink (mp_int * a)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_shrink.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_signed_bin_size.c	9ad18efcb95355ea048e428c9a1808cf3e44de82
+++ bn_mp_signed_bin_size.c	095c4525cb020eb504d55ae5c48e4c52654a0a1b
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* get the size for an signed equivalent */
@@ -21,3 +21,7 @@ int mp_signed_bin_size (mp_int * a)
   return 1 + mp_unsigned_bin_size (a);
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_signed_bin_size.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_sqr.c	093d797ab504fa4cfb271b47a8c10075b2441b9f
+++ bn_mp_sqr.c	0f2296767c878d8019e13c07fd449560955fc024
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* computes b = a*a */
@@ -52,3 +52,7 @@ if (a->used >= KARATSUBA_SQR_CUTOFF) {
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_sqr.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_sqrmod.c	2d316f2f768b25e981f2e62c0bb245cb4dfc8ec8
+++ bn_mp_sqrmod.c	a0dd26072bdd106242f6fd655a30188cfb25ea38
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* c = a * a (mod b) */
@@ -35,3 +35,7 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_in
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_sqrmod.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_sqrt.c	9d312eb9205cadcc089d54d19d712238dbf6d03c
+++ bn_mp_sqrt.c	450813392fbfbe44bbae85535fb8b998eb8184ce
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* this function is less generic than mp_n_root, simpler and faster */
@@ -75,3 +75,7 @@ E2: mp_clear(&t1);
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_sqrt.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_sub.c	c5092e05763947b6dc2e9fa0858dc3750bac02fe
+++ bn_mp_sub.c	a33a08150a286b0039173cca2a41315b2091365d
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* high level subtraction (handles signs) */
@@ -53,3 +53,7 @@ mp_sub (mp_int * a, mp_int * b, mp_int *
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_sub.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_sub_d.c	e80435db75b1dc7f60a2b3f6d27204113017d849
+++ bn_mp_sub_d.c	bfedcdb1837eaea36cc8016f412d64837f34f8e1
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* single digit subtraction */
@@ -36,6 +36,10 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int
      a->sign = MP_ZPOS;
      res     = mp_add_d(a, b, c);
      a->sign = c->sign = MP_NEG;
+
+     /* clamp */
+     mp_clamp(c);
+
      return res;
   }

@@ -83,3 +87,7 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_sub_d.c,v $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_submod.c	72847e4cc7457fd16feda88a9a22461c9cc6467a
+++ bn_mp_submod.c	fa8ab8b897cac02d06e7b4b1a9b9a3053a40e858
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* d = a - b (mod c) */
@@ -36,3 +36,7 @@ mp_submod (mp_int * a, mp_int * b, mp_in
   return res;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_submod.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_to_signed_bin.c	37639284a790d77339bcd7f53e66a18017563dd6
+++ bn_mp_to_signed_bin.c	b5f2791e69cca9974bef85270825055442f8b1cd
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* store in signed [big endian] format */
@@ -27,3 +27,7 @@ int mp_to_signed_bin (mp_int * a, unsign
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_to_signed_bin.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_to_signed_bin_n.c	c3aea4a9e1164e03d1d58338de680a6f55b5ad8f
+++ bn_mp_to_signed_bin_n.c	7c0825814f330b851e34e7bd494780800c8cd761
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* store in signed [big endian] format */
@@ -25,3 +25,7 @@ int mp_to_signed_bin_n (mp_int * a, unsi
    return mp_to_signed_bin(a, b);
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_to_signed_bin_n.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_to_unsigned_bin.c	efb1eee1129615146646f646378a25742c9a6492
+++ bn_mp_to_unsigned_bin.c	a4065f821ee4c734de19f31be4d596c612622b72
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* store in unsigned [big endian] format */
@@ -42,3 +42,7 @@ int mp_to_unsigned_bin (mp_int * a, unsi
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_to_unsigned_bin.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_to_unsigned_bin_n.c	90b468fd50ea8c8151e0f40e6aa8ac302ec2fe46
+++ bn_mp_to_unsigned_bin_n.c	7bb5466e439b1f52f095ae2acbe150e342b21dc5
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* store in unsigned [big endian] format */
@@ -25,3 +25,7 @@ int mp_to_unsigned_bin_n (mp_int * a, un
    return mp_to_unsigned_bin(a, b);
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_to_unsigned_bin_n.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_toom_mul.c	8a45c9922034269d563cbdbd1b55d772ccc06056
+++ bn_mp_toom_mul.c	963f922d61caf8828638f9b990020406ec22ae1f
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* multiplication using the Toom-Cook 3-way algorithm
@@ -278,3 +278,7 @@ ERR:
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_toom_mul.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_toom_sqr.c	496802f1dbcf4a358fb38b7458609f209b5435cd
+++ bn_mp_toom_sqr.c	a40b43897c5e23520f99ceaa59bf939eb5bac1ed
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* squaring using Toom-Cook 3-way algorithm */
@@ -220,3 +220,7 @@ ERR:
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_toom_sqr.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_toradix.c	78a3ed650fec464f1229d14ea550b3703d3ef8d1
+++ bn_mp_toradix.c	e945e74e11ac54e91af44216023f55656cf7f650
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* stores a bignum as a ASCII string in a given radix (2..64) */
@@ -69,3 +69,7 @@ int mp_toradix (mp_int * a, char *str, i
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_toradix.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_toradix_n.c	1a2704322409b2e9f54e9f7e41ef69be2ae5e4c9
+++ bn_mp_toradix_n.c	17b42cd6147e873d7834a05c342f937b391426f6
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* stores a bignum as a ASCII string in a given radix (2..64)
@@ -27,12 +27,12 @@ int mp_toradix_n(mp_int * a, char *str,
   char   *_s = str;

   /* check range of the maxlen, radix */
-  if (maxlen < 3 || radix < 2 || radix > 64) {
+  if (maxlen < 2 || radix < 2 || radix > 64) {
     return MP_VAL;
   }

   /* quick out if its zero */
-  if (mp_iszero(a) == 1) {
+  if (mp_iszero(a) == MP_YES) {
      *str++ = '0';
      *str = '\0';
      return MP_OKAY;
@@ -57,21 +57,20 @@ int mp_toradix_n(mp_int * a, char *str,

   digs = 0;
   while (mp_iszero (&t) == 0) {
+    if (--maxlen < 1) {
+       /* no more room */
+       break;
+    }
     if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) {
       mp_clear (&t);
       return res;
     }
     *str++ = mp_s_rmap[d];
     ++digs;
-
-    if (--maxlen == 1) {
-       /* no more room */
-       break;
-    }
   }

   /* reverse the digits of the string.  In this case _s points
-   * to the first digit [exluding the sign] of the number]
+   * to the first digit [exluding the sign] of the number
    */
   bn_reverse ((unsigned char *)_s, digs);

@@ -83,3 +82,7 @@ int mp_toradix_n(mp_int * a, char *str,
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_toradix_n.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_unsigned_bin_size.c	8b1963305618f9f8effe51212c9794d59e8d6c24
+++ bn_mp_unsigned_bin_size.c	8e2ac8bf6a9f3a1de0ef11cec7730ffbc1e6f1a8
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* get the size for an unsigned equivalent */
@@ -22,3 +22,7 @@ int mp_unsigned_bin_size (mp_int * a)
   return (size / 8 + ((size & 7) != 0 ? 1 : 0));
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_unsigned_bin_size.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_xor.c	6a3de9432fe1ad939de000694be657772cd913e7
+++ bn_mp_xor.c	937f73fe8252c4bbdc7f60d2d8a80396e0c5e971
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* XOR two ints together */
@@ -45,3 +45,7 @@ mp_xor (mp_int * a, mp_int * b, mp_int *
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_xor.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_mp_zero.c	4247063811e504255b015c2cc19acb28d2a304e4
+++ bn_mp_zero.c	9c936f75b20687b223129734ebd93e04db6bdf00
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* set to zero */
@@ -30,3 +30,7 @@ void mp_zero (mp_int * a)
   }
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_mp_zero.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_prime_tab.c	fec54b5cd76b20913620ffe6922c6a37ee96e1b7
+++ bn_prime_tab.c	45021011858d4ff6abc198aa591f731a41fa9aa9
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */
 const mp_digit ltm_prime_tab[] = {
   0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013,
@@ -55,3 +55,7 @@ const mp_digit ltm_prime_tab[] = {
 #endif
 };
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_prime_tab.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_reverse.c	dd999dcbec79713c226d741f97af41ec6ed7e58f
+++ bn_reverse.c	137f7c2e7abb88f8b99699187d460a216d2edef1
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* reverse an array, used for radix code */
@@ -33,3 +33,7 @@ bn_reverse (unsigned char *s, int len)
   }
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_reverse.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_s_mp_add.c	e16a196df2c5a2a1ba9c51d184105791f7151e6c
+++ bn_s_mp_add.c	5ccb09709881715f8114ec5bd47b86b13bd2982c
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* low level addition, based on HAC pp.594, Algorithm 14.7 */
@@ -103,3 +103,7 @@ s_mp_add (mp_int * a, mp_int * b, mp_int
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_s_mp_add.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_s_mp_exptmod.c	7ac1accce85a140678573008fcdd67f2834737ed
+++ bn_s_mp_exptmod.c	a6a69525a2db4382684510dbb71bcbcbc20cb053
@@ -12,9 +12,8 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */
-
 #ifdef MP_LOW_MEM
    #define TAB_SIZE 32
 #else
@@ -247,3 +246,7 @@ LBL_M:
   return err;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_s_mp_exptmod.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_s_mp_mul_digs.c	d312dd371b770bf210c2d96f267247163ab15e0f
+++ bn_s_mp_mul_digs.c	709d778c346b50939bb7c8a49b5b44be5845bae9
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* multiplies |a| * |b| and only computes upto digs digits of result
@@ -84,3 +84,7 @@ int s_mp_mul_digs (mp_int * a, mp_int *
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_s_mp_mul_digs.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_s_mp_mul_high_digs.c	7fedd32cbf39b73ee19e2c4f84708d46e6698375
+++ bn_s_mp_mul_high_digs.c	f590816a055898ebeb40cd5826147faf32e0d844
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* multiplies |a| * |b| and does not compute the lower digs digits
@@ -75,3 +75,7 @@ s_mp_mul_high_digs (mp_int * a, mp_int *
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_s_mp_mul_high_digs.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_s_mp_sqr.c	eba4101c1f1ff9dc11fadf942075e3e0fff40737
+++ bn_s_mp_sqr.c	dc3edf5189c48351f73dd0b0df23c60ac23d78c8
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */
@@ -78,3 +78,7 @@ int s_mp_sqr (mp_int * a, mp_int * b)
   return MP_OKAY;
 }
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_s_mp_sqr.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bn_s_mp_sub.c	46e30a7f53648000600b31472e9f6f8463145196
+++ bn_s_mp_sub.c	3b4ddc0ab104634daee083067a0368bcc611daf9
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */
@@ -83,3 +83,7 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int
 }

 #endif
+
+/* $Source: /cvs/libtom/libtommath/bn_s_mp_sub.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- bncore.c	2a706b0ca7b0d41a6ef37bc33c26d2d2a4338b7e
+++ bncore.c	10ead291d5f52c4d162e40e497f53f6d639a70e1
@@ -12,7 +12,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, tomstdenis@iahu.ca, http://math.libtomcrypt.org
+ * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
  */

 /* Known optimal configurations
@@ -20,13 +20,17 @@
  CPU                    /Compiler     /MUL CUTOFF/SQR CUTOFF
 -------------------------------------------------------------
  Intel P4 Northwood     /GCC v3.4.1   /        88/       128/LTM 0.32 ;-)
- AMD Athlon64           /GCC v3.4.4   /        74/       124/LTM 0.34
+ AMD Athlon64           /GCC v3.4.4   /        80/       120/LTM 0.35

 */

-int     KARATSUBA_MUL_CUTOFF = 74,      /* Min. number of digits before Karatsuba multiplication is used. */
-        KARATSUBA_SQR_CUTOFF = 124,     /* Min. number of digits before Karatsuba squaring is used. */
+int     KARATSUBA_MUL_CUTOFF = 80,      /* Min. number of digits before Karatsuba multiplication is used. */
+        KARATSUBA_SQR_CUTOFF = 120,     /* Min. number of digits before Karatsuba squaring is used. */

         TOOM_MUL_CUTOFF      = 350,      /* no optimal values of these are known yet so set em high */
         TOOM_SQR_CUTOFF      = 400;
 #endif
+
+/* $Source: /cvs/libtom/libtommath/bncore.c,v $ */
+/* $Revision: 1.4 $ */
+/* $Date: 2006/03/31 14:18:44 $ */
============================================================
--- booker.pl	f5935051a27a7a963ac1730d44d2de8f682e12e6
+++ booker.pl	b00c5b2be0d8233baf482d7422b360606fc961bc
@@ -82,13 +82,16 @@ while (<IN>) {
          # scan till next end of comment, e.g. skip license
          while (<SRC>) {
             $text[$line++] = $_;
-            last if ($_ =~ /math\.libtomcrypt\.org/);
+            last if ($_ =~ /math\.libtomcrypt\.com/);
          }
          <SRC>;
       }

       $inline = 0;
       while (<SRC>) {
+      next if ($_ =~ /\$Source/);
+      next if ($_ =~ /\$Revision/);
+      next if ($_ =~ /\$Date/);
          $text[$line++] = $_;
          ++$inline;
          chomp($_);
@@ -218,7 +221,7 @@ while (<IN>) {
                      $str = "chapter eight";
                   } elsif ($a == 9) {
                      $str = "chapter nine";
-                  } elsif ($a == 2) {
+                  } elsif ($a == 10) {
                      $str = "chapter ten";
                   }
                } else {
============================================================
--- changes.txt	686b8da0e27120cb775f6960c80f1efc7b80940d
+++ changes.txt	aafc04f83cde62256b1525b5457971f64616e499
@@ -1,3 +1,36 @@
+December 24th, 2006
+v0.40  -- Updated makefile to properly support LIBNAME
+       -- Fixed bug in fast_s_mp_mul_high_digs() which overflowed (line 83), thanks Valgrind!
+
+April 4th, 2006
+v0.39  -- Jim Wigginton pointed out my Montgomery examples in figures 6.4 and 6.6 were off by one, k should be 9 not 8
+       -- Bruce Guenter suggested I use --tag=CC for libtool builds where the compiler may think it's C++.
+       -- "mm" from sci.crypt pointed out that my mp_gcd was sub-optimal (I also updated and corrected the book)
+       -- updated some of the @@ tags in tommath.src to reflect source changes.
+       -- updated email and url info in all source files
+
+Jan 26th, 2006
+v0.38  -- broken makefile.shared fixed
+       -- removed some carry stores that were not required [updated text]
+
+November 18th, 2005
+v0.37  -- [Don Porter] reported on a TCL list [HEY SEND ME BUGREPORTS ALREADY!!!] that mp_add_d() would compute -0 with some inputs.  Fixed.
+       -- [rinick@gmail.com] reported the makefile.bcc was messed up.  Fixed.
+       -- [Kevin Kenny] reported some issues with mp_toradix_n().  Now it doesn't require a min of 3 chars of output.
+       -- Made the make command renamable.  Wee
+
+August 1st, 2005
+v0.36  -- LTM_PRIME_2MSB_ON was fixed and the "OFF" flag was removed.
+       -- [Peter LaDow] found a typo in the XREALLOC macro
+       -- [Peter LaDow] pointed out that mp_read_(un)signed_bin should have "const" on the input
+       -- Ported LTC patch to fix the prime_random_ex() function to get the bitsize correct [and the maskOR flags]
+       -- Kevin Kenny pointed out a stray //
+       -- David Hulton pointed out a typo in the textbook [mp_montgomery_setup() pseudo-code]
+       -- Neal Hamilton (Elliptic Semiconductor) pointed out that my Karatsuba notation was backwards and that I could use
+          unsigned operations in the routine.
+       -- Paul Schmidt pointed out a linking error in mp_exptmod() when BN_S_MP_EXPTMOD_C is undefined (and another for read_radix)
+       -- Updated makefiles to be way more flexible
+
 March 12th, 2005
 v0.35  -- Stupid XOR function missing line again... oops.
        -- Fixed bug in invmod not handling negative inputs correctly [Wolfgang Ehrhardt]
============================================================
--- demo/demo.c	ad8e1506fbbd176371eece0e73edc6696b4ab79d
+++ demo/demo.c	709dafa2cd6efd826d038844380305cfd42d67ab
@@ -389,8 +389,8 @@ printf("compare no compare!\n"); exit(EX
       sub_d_n = 0;

    /* force KARA and TOOM to enable despite cutoffs */
-   KARATSUBA_SQR_CUTOFF = KARATSUBA_MUL_CUTOFF = 110;
-   TOOM_SQR_CUTOFF = TOOM_MUL_CUTOFF = 150;
+   KARATSUBA_SQR_CUTOFF = KARATSUBA_MUL_CUTOFF = 8;
+   TOOM_SQR_CUTOFF = TOOM_MUL_CUTOFF = 16;

    for (;;) {
       /* randomly clear and re-init one variable, this has the affect of triming the alloc space */
@@ -734,3 +734,7 @@ printf("compare no compare!\n"); exit(EX
    }
    return 0;
 }
+
+/* $Source: /cvs/libtom/libtommath/demo/demo.c,v $ */
+/* $Revision: 1.3 $ */
+/* $Date: 2005/06/24 11:32:07 $ */
============================================================
--- demo/timing.c	495dc5a5ca04a74a7ac7146d3c40c1c0cde360a2
+++ demo/timing.c	b75910c66587af2b0222534851c5503e01811a00
@@ -313,3 +313,7 @@ int main(void)

    return 0;
 }
+
+/* $Source: /cvs/libtom/libtommath/demo/timing.c,v $ */
+/* $Revision: 1.2 $ */
+/* $Date: 2005/05/05 14:38:47 $ */
============================================================
--- etc/2kprime.c	8916b4a19cfcec43ec1788ca54b59d2