# # # delete "botan/bit_ops.cpp" # # add_file "botan/bswap.h" # content [5e24b138da4667230c49d5e5f3c45b21c6056bd6] # # add_file "botan/mp_monty.cpp" # content [33694e1fb2774e2d95624cbeb38193bdc3bfb998] # # add_file "botan/rotate.h" # content [c556758219a6041aa6e2be1c782d4dab7995fd6f] # # add_file "botan/xor_buf.h" # content [aa2b268ccaceae615e1e77416779c261887e6e2a] # # patch "Makefile.am" # from [07bfa4dd3c1d93b5899c5f9ed42c7c7ee731594a] # to [a0fe85510172035d9dc17976db02c8023c3b9219] # # patch "NEWS" # from [f938e20a873113af2497031a37bab22e30ea4974] # to [1c9857dd94c6cc1c9d2b3da5dc6bc87a9808383f] # # patch "botan/README.botan-monotone" # from [4172ef8bb447c415dbfbb176d03812db4cb40083] # to [2b46a541b1e8a459c932dfaefe3939277fe15172] # # patch "botan/aes.cpp" # from [ee57662b8c25279ccec727e53defdbeec940d5ae] # to [d552018bad9dd54cb18ca227c45349b889c13990] # # patch "botan/arc4.cpp" # from [6bd2acf410cc71a9820b4f4ed56695853dc3fcd4] # to [74a6d9b8912449b724c9bdeb95120f92a3ed746f] # # patch "botan/base.h" # from [24b5e5a658b03e4df9d33b74f2c7688335b2cbdf] # to [05278b47d0de8be6db86bf131322c1c3061edcc3] # # patch "botan/big_ops2.cpp" # from [ebefb574797f9c9a40e4d4babc18cffdfe1b7c2f] # to [e0e8b7f57820f2f6555b3dfd1955192c17a6e8cd] # # patch "botan/bigint.cpp" # from [d67da926001bf17ae8d4a34f99e07558223b7b6f] # to [4613be2d770dddbcf23ab1b0b2a2a4dd2d8a2022] # # patch "botan/bigint.h" # from [8517de135a204372bbded7af96c868548a160804] # to [5973cc4eb8bc4c2a551202355079a63f18452536] # # patch "botan/bit_ops.h" # from [249e2d04932f769955d4053a0485f1763674ef3c] # to [18c672469499579e580c4472298a4360a856b691] # # patch "botan/buf_es.cpp" # from [aa507bb49b93b77a65b3cba83c3aeee1edf99026] # to [878e61561f7086b50eae304697c78959b6d5807b] # # patch "botan/build.h" # from [1a6f3b52e909f21e56dc8e6d2e071be7b3ee2af5] # to [5313fb8a3db14e96229525ebd837a8577c13855c] # # patch "botan/cbc.cpp" # from [33122cb0d77783a79d55322a5648591266c1765d] # to [0889fddd4a74f3cad9bd61181e088e370e0de902] # # patch "botan/cbc_mac.cpp" # from [96970348caef5cdb8d60f6c7dfefa050004b5178] # to [600a104430b0dd2e5ef32d337555d8f04ed94b8d] # # patch "botan/cfb.cpp" # from [6e0107157eb3e92bf7a82d463c772f7677b7287e] # to [c33073c28cb45c1a402f459d94d4b6dac2689717] # # patch "botan/credits.txt" # from [b6cbe9978c715b9058fdd94c6a7fd0a5f6449aee] # to [655b55732eda3066427f50f0cac912597f492427] # # patch "botan/ctr.cpp" # from [78262b094f35ee9092e248f1701368d3d5a85f34] # to [b1601ec09907ba48a8eda08af77573ab70d166ab] # # patch "botan/cts.cpp" # from [5fdb172ec30924590a61f9eb900eec313e397118] # to [eb09c8f82f41044bc2ab389327e64a9ac275b659] # # patch "botan/def_alg.cpp" # from [6d7f05989c62b3e34d3c013628bb263bced56dba] # to [265f8696b911b86cfbb355cac53c152455be28db] # # patch "botan/des.cpp" # from [0dcc4fe670b5d81990b4693999995001299d2da9] # to [33a628add92df63d32424353246c99fb482002b1] # # patch "botan/dl_group.cpp" # from [6f64d08dc43b6c9d0f9dfe369e5ee4ede2b5993d] # to [70c693c16e71e465ea5fa3da46bc947983767b85] # # patch "botan/dl_group.h" # from [6dfe2e3864e5231ea2ac9e6431b584eaf303db4d] # to [497418b4599cf597dc8a55fa960eb6bbddd06fc8] # # patch "botan/dlies.cpp" # from [bb2698ee8127bb35cd21bb89d4cd05127e4b8431] # to [7f1b9b022c969360743bb20fdc9cf63c2cae96c2] # # patch "botan/dsa_gen.cpp" # from [bfe2b174d12d0a5e65574a81091b938ed1b55f22] # to [ce07c28b68b320a87de64946a69513841bad6d5f] # # patch "botan/eax.cpp" # from [2094aba50694d8729ef706893dece9038cc357eb] # to [15aab5f154c916cf0c6e4964b35e9c9989f628d5] # # patch "botan/engine.cpp" # from [c9919382acf830b62e8911d9364251d314557c57] # to [8202fd83d55e8928f509f14ffb5c8727289f3017] # # patch "botan/exceptn.h" # from [6c8eb39d95fc61a0a1bf2201f053811c61e9623d] # to [7c29a02497b65a17270ba34c606b99629ad2d05f] # # patch "botan/get_enc.cpp" # from [c2e4f0bd43c299fc1ddfd177d67b361f7e975a9a] # to [6463ffc2f99fdf284c26d3ccf6569aef9f7f8c7b] # # patch "botan/hmac.cpp" # from [95864b3c32b51ea57eecb60eaac4c7af77265d05] # to [ea3d0d7b82ab2b6785a42fc3e8519013b1876ab5] # # patch "botan/info.txt" # from [178e88903d71f7c580f1a94ef9bfcc5116b2f6a8] # to [2545fa94e8f50cade2a63bda5a1027f5c19f7194] # # patch "botan/loadstor.h" # from [4dddb134024c8e16cbce6b72cbce823750146023] # to [49dc502217d6af461c739c6e33c1ab3d7e3bd55d] # # patch "botan/mem_pool.cpp" # from [0853e76a2dd2cf52e8fa894270cc5dadd4aa211b] # to [23230305d388340130aa2f95ec3c70edadcc9584] # # patch "botan/mgf1.cpp" # from [70180df9bdb3539116bfdb8e90b94079d0ea70cd] # to [5000a9822ac26112c18bdfa243b0eeb7aa23693f] # # patch "botan/mgf1.h" # from [7359b8d5d3e3ff0daf8f2d23b40581ce64e7ff72] # to [7776068de7479ee101ffb6e47348a12065d8e961] # # patch "botan/mp_asm.cpp" # from [2bcf481048ef5cc53b3479118ecfeca9b6da659b] # to [0eaa67b409564a44a6e9dd633199be84c5af5a1b] # # patch "botan/mp_comba.cpp" # from [12dec4af4a5d52af45e4fe6bd2308f682a7bbb06] # to [54f6ef968f19aa0519a7f160a36a999c0432223e] # # patch "botan/mp_core.h" # from [d2ffb425026eef1911de3486d44c044871047f14] # to [9852a75f527eefd3e527c229ca0cc8254f6cac1f] # # patch "botan/mp_karat.cpp" # from [bd9ddd196f33f94792828a24547d82ef35e95a60] # to [5fcd683a3bca97b5ccdd54e81b334f35aded5605] # # patch "botan/mp_misc.cpp" # from [ff006a9904ada45f0db8ca54f3ba1a6c06ffcf1d] # to [8273a346609d43aebbd2d6e80b4393a5b8b3d12b] # # patch "botan/mp_mulop.cpp" # from [200cfac1b97b27df16831d19eb69645c1a2c261b] # to [a2ed3fef04ba7328023cba1f053aecbd341eccc5] # # patch "botan/mp_shift.cpp" # from [262775e5dbf0aeadd5db4badd126586cb36811fb] # to [743c830923bf6a453520ddc726f5f248975a3074] # # patch "botan/numthry.cpp" # from [26bbca21b1899d7087075f15f7f67e7607faf17c] # to [e936502b2b5badb8796d8310c6eb8988892eee2c] # # patch "botan/ofb.cpp" # from [2709b09b27e6a7bb97f2de2fd6d52147df2cce25] # to [681c98dfee9f23190273dac33b15a156cfdffd0a] # # patch "botan/pkcs5.cpp" # from [2e2f477f3f38ceae9f7fff0d52c12d4b32da6af1] # to [2166d0b83a9f24484582a1082b3173a1af79aa91] # # patch "botan/policy.cpp" # from [9d526c4dbe618044a2e577238d93418d07105cfe] # to [7a812bca46419bfee2b0ae6243950a47448a78b6] # # patch "botan/primes.cpp" # from [b59b2733974c522887b7c271fff8975502e613dd] # to [d3f6a25e1bb8734a71e24c6df0a35e7d66ddce55] # # patch "botan/pubkey.h" # from [0247408d58d07d5f440ad7850fe51b7ef2ee99c6] # to [e4865d610b63f28b9c531f0ec39666da9da2c30c] # # patch "botan/randpool.cpp" # from [5bb4f7eb52feaeb4765b28deffe9ece75360503f] # to [0e268299e1cacd6828323786637fe3b3db84c94e] # # patch "botan/rsa.cpp" # from [cb60f3202e08edaf7232aaeef434c80b2277a765] # to [d72a3996d9cad6b2b0e9a57169588db05889d331] # # patch "botan/secmem.h" # from [c48a5f061675316513a401c61bf8472434700a0c] # to [a418b80e88b96c9eefecce580ce3e37d623878e0] # # patch "botan/symkey.cpp" # from [adb7a25bf9a2ac40a8452841264c3fa107e9e169] # to [efe2e7138ff6446b841f7497cd2d6a5040118cbd] # # patch "botan/thanks.txt" # from [93da5eb93daf816bacf92d9cc834f872bd5e3f23] # to [25adffa4ebf208a08ead80fbce865a0d26541439] # # patch "botan/ui.h" # from [edc430aa1261dacfab65cf5bf004f0ba1c264340] # to [97d42335be645d069e4a23c78781726ca1bdbd0c] # # patch "botan/util.cpp" # from [22c31923a7cfbe9a5f5d0ec9dcb8cfe2e4e9648d] # to [eb2b4db0bff74cce366fde7f7e6c34f930cdb58b] # # patch "botan/x931_rng.cpp" # from [9ef7dc6b27bd1b5186d94c696a2cbf393b323420] # to [2b9ec05c85c31eab16269186014707ba3a7c36b1] # # patch "transforms.cc" # from [737711aeeaf9f03df41eef35d8b6842d5f72a7fe] # to [2092c216aedf25334650b90041aaafd22cefb243] # ============================================================ --- botan/bswap.h 5e24b138da4667230c49d5e5f3c45b21c6056bd6 +++ botan/bswap.h 5e24b138da4667230c49d5e5f3c45b21c6056bd6 @@ -0,0 +1,39 @@ +/************************************************* +* Byte Swapping Operations Header File * +* (C) 1999-2008 Jack Lloyd * +*************************************************/ + +#ifndef BOTAN_BSWAP_H__ +#define BOTAN_BSWAP_H__ + +#include +#include + +namespace Botan { + +/************************************************* +* Byte Swapping Functions * +*************************************************/ +inline u16bit reverse_bytes(u16bit input) + { + return rotate_left(input, 8); + } + +inline u32bit reverse_bytes(u32bit input) + { + input = ((input & 0xFF00FF00) >> 8) | ((input & 0x00FF00FF) << 8); + return rotate_left(input, 16); + } + +inline u64bit reverse_bytes(u64bit input) + { + u32bit hi = ((input >> 40) & 0x00FF00FF) | ((input >> 24) & 0xFF00FF00); + u32bit lo = ((input & 0xFF00FF00) >> 8) | ((input & 0x00FF00FF) << 8); + hi = (hi << 16) | (hi >> 16); + lo = (lo << 16) | (lo >> 16); + return (static_cast(lo) << 32) | hi; + } + +} + +#endif ============================================================ --- botan/mp_monty.cpp 33694e1fb2774e2d95624cbeb38193bdc3bfb998 +++ botan/mp_monty.cpp 33694e1fb2774e2d95624cbeb38193bdc3bfb998 @@ -0,0 +1,76 @@ +/************************************************* +* Montgomery Reduction Source File * +* (C) 1999-2008 Jack Lloyd * +* 2006 Luca Piccarreta * +*************************************************/ + +#include +#include +#include + +namespace Botan { + +extern "C" { + +/************************************************* +* Montgomery Reduction Algorithm * +*************************************************/ +void bigint_monty_redc(word z[], u32bit z_size, + const word x[], u32bit x_size, word u) + { + const u32bit blocks_of_8 = x_size - (x_size % 8); + + for(u32bit i = 0; i != x_size; ++i) + { + word* z_i = z + i; + + const word y = z_i[0] * u; + + word carry = 0; + + for(u32bit j = 0; j != blocks_of_8; j += 8) + carry = word8_madd3(z_i + j, x + j, y, carry); + + for(u32bit j = blocks_of_8; j != x_size; ++j) + z_i[j] = word_madd3(x[j], y, z_i[j], &carry); + + word z_sum = z_i[x_size] + carry; + carry = (z_sum < z_i[x_size]); + z_i[x_size] = z_sum; + + for(u32bit j = x_size + 1; carry && j != z_size - i; ++j) + { + ++z_i[j]; + carry = !z_i[j]; + } + } + + // Check if z[x_size...x_size+1] >= x[0...x_size] using bigint_cmp (inlined) + if(!z[x_size + x_size]) + { + for(u32bit i = x_size; i > 0; --i) + { + if(z[x_size + i - 1] > x[i-1]) + break; + + if(z[x_size + i - 1] < x[i-1]) + return; + } + } + + // If the compare above is true, subtract using bigint_sub2 (inlined) + word carry = 0; + + for(u32bit i = 0; i != blocks_of_8; i += 8) + carry = word8_sub2(z + x_size + i, x + i, carry); + + for(u32bit i = blocks_of_8; i != x_size; ++i) + z[x_size + i] = word_sub(z[x_size + i], x[i], &carry); + + if(carry) + --z[x_size+x_size]; + } + +} + +} ============================================================ --- botan/rotate.h c556758219a6041aa6e2be1c782d4dab7995fd6f +++ botan/rotate.h c556758219a6041aa6e2be1c782d4dab7995fd6f @@ -0,0 +1,28 @@ +/************************************************* +* Word Rotation Operations Header File * +* (C) 1999-2008 Jack Lloyd * +*************************************************/ + +#ifndef BOTAN_WORD_ROTATE_H__ +#define BOTAN_WORD_ROTATE_H__ + +#include + +namespace Botan { + +/************************************************* +* Word Rotation Functions * +*************************************************/ +template inline T rotate_left(T input, u32bit rot) + { + return static_cast((input << rot) | (input >> (8*sizeof(T)-rot)));; + } + +template inline T rotate_right(T input, u32bit rot) + { + return static_cast((input >> rot) | (input << (8*sizeof(T)-rot))); + } + +} + +#endif ============================================================ --- botan/xor_buf.h aa2b268ccaceae615e1e77416779c261887e6e2a +++ botan/xor_buf.h aa2b268ccaceae615e1e77416779c261887e6e2a @@ -0,0 +1,65 @@ +/************************************************* +* Xor Operations Header File * +* (C) 1999-2008 Jack Lloyd * +*************************************************/ + +#ifndef BOTAN_XOR_BUF_H__ +#define BOTAN_XOR_BUF_H__ + +#include + +namespace Botan { + +/************************************************* +* XOR Arrays * +*************************************************/ +inline void xor_buf(byte out[], const byte in[], u32bit length) + { + while(length >= 8) + { +#if BOTAN_UNALIGNED_LOADSTOR_OK + *reinterpret_cast(out) ^= *reinterpret_cast(in); +#else + out[0] ^= in[0]; out[1] ^= in[1]; + out[2] ^= in[2]; out[3] ^= in[3]; + out[4] ^= in[4]; out[5] ^= in[5]; + out[6] ^= in[6]; out[7] ^= in[7]; +#endif + + out += 8; in += 8; length -= 8; + } + for(u32bit j = 0; j != length; ++j) + out[j] ^= in[j]; + } + +/************************************************* +* XOR Arrays * +*************************************************/ +inline void xor_buf(byte out[], + const byte in[], + const byte in2[], + u32bit length) + { + while(length >= 8) + { +#if BOTAN_UNALIGNED_LOADSTOR_OK + *reinterpret_cast(out) = + *reinterpret_cast(in) ^ + *reinterpret_cast(in2); +#else + out[0] = in[0] ^ in2[0]; out[1] = in[1] ^ in2[1]; + out[2] = in[2] ^ in2[2]; out[3] = in[3] ^ in2[3]; + out[4] = in[4] ^ in2[4]; out[5] = in[5] ^ in2[5]; + out[6] = in[6] ^ in2[6]; out[7] = in[7] ^ in2[7]; +#endif + + in += 8; in2 += 8; out += 8; length -= 8; + } + + for(u32bit j = 0; j != length; ++j) + out[j] = in[j] ^ in2[j]; + } + +} + +#endif ============================================================ --- Makefile.am 07bfa4dd3c1d93b5899c5f9ed42c7c7ee731594a +++ Makefile.am a0fe85510172035d9dc17976db02c8023c3b9219 @@ -113,7 +113,7 @@ BOTAN_SOURCES = \ botan/base.cpp botan/basefilt.cpp botan/ber_dec.cpp \ botan/big_code.cpp botan/bigint.cpp botan/big_io.cpp \ botan/big_ops2.cpp botan/big_ops3.cpp botan/big_rand.cpp \ - botan/bit_ops.cpp botan/blinding.cpp botan/buf_es.cpp \ + botan/blinding.cpp botan/buf_es.cpp \ botan/buf_filt.cpp botan/cbc.cpp botan/cbc_mac.cpp \ botan/certstor.cpp botan/cfb.cpp botan/charset.cpp \ botan/crc32.cpp botan/crl_ent.cpp botan/ctr.cpp botan/cts.cpp \ @@ -136,6 +136,7 @@ BOTAN_SOURCES = \ botan/mgf1.cpp botan/mlock.cpp botan/modebase.cpp \ botan/mode_pad.cpp botan/modules.cpp botan/mp_asm.cpp \ botan/mp_comba.cpp botan/mp_karat.cpp botan/mp_misc.cpp \ + botan/mp_monty.cpp \ botan/mp_mulop.cpp botan/mp_numth.cpp botan/mp_shift.cpp \ botan/mutex.cpp botan/noekeon.cpp botan/numthry.cpp \ botan/ofb.cpp botan/oids.cpp botan/out_buf.cpp \ @@ -159,6 +160,7 @@ BOTAN_SOURCES = \ botan/asn1_int.h botan/asn1_obj.h botan/asn1_oid.h \ botan/base64.h botan/basefilt.h botan/base.h botan/ber_dec.h \ botan/bigint.h botan/bit_ops.h botan/blinding.h botan/botan.h \ + botan/bswap.h \ botan/buf_es.h botan/buf_filt.h botan/build.h botan/cbc.h \ botan/cbc_mac.h botan/certstor.h botan/cfb.h botan/charset.h \ botan/crc32.h botan/crl_ent.h botan/ctr.h botan/cts.h \ @@ -180,13 +182,15 @@ BOTAN_SOURCES = \ botan/pk_algs.h botan/pk_core.h botan/pkcs10.h botan/pkcs5.h \ botan/pkcs8.h botan/pk_keys.h botan/pk_ops.h botan/pk_util.h \ botan/pow_mod.h botan/pubkey.h botan/randpool.h botan/reducer.h \ - botan/rng.h botan/rsa.h botan/s2k.h botan/secmem.h \ + botan/rng.h botan/rotate.h botan/rsa.h botan/s2k.h \ + botan/secmem.h \ botan/secqueue.h botan/selftest.h botan/sha160.h botan/sha256.h \ botan/stl_util.h botan/symkey.h botan/timers.h botan/types.h \ botan/ui.h botan/util.h botan/version.h botan/x509_ca.h \ botan/x509cert.h botan/x509_crl.h botan/x509_ext.h \ botan/x509find.h botan/x509_key.h botan/x509_obj.h \ - botan/x509self.h botan/x509stor.h botan/x931_rng.h + botan/x509self.h botan/x509stor.h botan/x931_rng.h \ + botan/xor_buf.h # windows only: botan/es_capi.h botan/es_capi.cpp botan/es_win32.{cpp,h} @@ -399,8 +403,8 @@ lib3rdparty_a_CPPFLAGS = AM_LDFLAGS = lib3rdparty_a_CPPFLAGS = -lib3rdparty_a_CFLAGS = $(AM_CFLAGS) $(LIB3RDPARTY_CFLAGS) -lib3rdparty_a_CXXFLAGS = $(AM_CXXFLAGS) $(LIB3RDPARTY_CXXFLAGS) +lib3rdparty_a_CFLAGS = $(AM_CFLAGS) $(LIB3RDPARTY_CFLAGS) -fpermissive +lib3rdparty_a_CXXFLAGS = $(AM_CXXFLAGS) $(LIB3RDPARTY_CXXFLAGS) -fpermissive mtn_LDFLAGS = mtn_CPPFLAGS = -I$(top_srcdir)/lua ============================================================ --- NEWS f938e20a873113af2497031a37bab22e30ea4974 +++ NEWS 1c9857dd94c6cc1c9d2b3da5dc6bc87a9808383f @@ -24,7 +24,7 @@ Internal - - Update Botan to 1.7.9. + - Update Botan to 1.7.12. Wed Sep 3 21:13:18 UTC 2008 ============================================================ --- botan/README.botan-monotone 4172ef8bb447c415dbfbb176d03812db4cb40083 +++ botan/README.botan-monotone 2b46a541b1e8a459c932dfaefe3939277fe15172 @@ -8,20 +8,33 @@ Steps to update net.venge.monotone.botan Steps to update net.venge.monotone.botan with net.randombit.net: -1) "mtn pull randombit.net net.randombit.botan" +1) Pull the newest revisions of botan and of the staging branch: -2) "mtn propagate net.randombit.botan au.asn.ucc.matt.botan.monotone-2" + mtn pull randombit.net net.randombit.botan + mtn pull bluegap.ch au.asn.ucc.matt.botan.monotone-2 -3) "mtn up" in an a.a.u.m.b.monotone-2 workspace. - In a n.v.m.botan botan/ dir, do "rm *". - Then copy the entire contents (no subdirs though) from the staging - branch's root dir to the botan/ dir. +2) Propagate from a tagged botan release version to the staging branch: -4) "mtn ls unknown botan/" and "mtn ls missing botan/" in n.v.m.botan. If + mtn explicit_merge t:1.7.12 h:au.asn.ucc.matt.botan.monotone-2 \ + au.asn.ucc.matt.botan.monotone-2 + +3) Update the botan files of monotone from the staging branch. + + * Update an a.a.u.m.b.monotone-2 workspace "mtn up" + * In a n.v.m.botan botan/ dir, do "rm *". + * Then copy the entire contents (no subdirs though) from the staging + branch's root dir to the botan/ dir, i.e.: + "cp $BOTAN_STAGING/* $MTN_BOTAN/botan/" + +4) Make sure monotone tracks the botan files properly + + "mtn ls unknown botan/" and "mtn ls missing botan/" in n.v.m.botan. If there are obviously renamed files, use "mtn rename" to fix them. - Otherwise add/drop files as appropriate. Also fix up Makefile.am. + Otherwise add/drop files as appropriate. Also fix up Makefile.am -4) make check in n.v.m.botan. If it succeeds, commit. If there are problems, +5) Make monotone work with the upgraded botan library + + "make check" in n.v.m.botan. If it succeeds, commit. If there are problems, copy the changes back to the staging branch and commit there as well. You might need to move some files from Attic/src/ to / in the staging branch. ============================================================ --- botan/aes.cpp ee57662b8c25279ccec727e53defdbeec940d5ae +++ botan/aes.cpp d552018bad9dd54cb18ca227c45349b889c13990 @@ -5,7 +5,6 @@ #include #include -#include namespace Botan { ============================================================ --- botan/arc4.cpp 6bd2acf410cc71a9820b4f4ed56695853dc3fcd4 +++ botan/arc4.cpp 74a6d9b8912449b724c9bdeb95120f92a3ed746f @@ -4,7 +4,7 @@ *************************************************/ #include -#include +#include #include namespace Botan { ============================================================ --- botan/base.h 24b5e5a658b03e4df9d33b74f2c7688335b2cbdf +++ botan/base.h 05278b47d0de8be6db86bf131322c1c3061edcc3 @@ -101,6 +101,7 @@ class BOTAN_DLL BufferedComputation BufferedComputation(u32bit); virtual ~BufferedComputation() {} private: + BufferedComputation& operator=(const BufferedComputation&); virtual void add_data(const byte[], u32bit) = 0; virtual void final_result(byte[]) = 0; }; @@ -119,6 +120,8 @@ class BOTAN_DLL HashFunction : public Bu HashFunction(u32bit, u32bit = 0); virtual ~HashFunction() {} + private: + HashFunction& operator=(const HashFunction&); }; /************************************************* ============================================================ --- botan/big_ops2.cpp ebefb574797f9c9a40e4d4babc18cffdfe1b7c2f +++ botan/big_ops2.cpp e0e8b7f57820f2f6555b3dfd1955192c17a6e8cd @@ -30,12 +30,12 @@ BigInt& BigInt::operator+=(const BigInt& { SecureVector z(reg_size - 1); bigint_sub3(z, y.data(), reg_size - 1, data(), x_sw); - copy_mem(reg.begin(), z.begin(), z.size()); + copy_mem(get_reg().begin(), z.begin(), z.size()); set_sign(y.sign()); } else if(relative_size == 0) { - reg.clear(); + get_reg().clear(); set_sign(Positive); } else if(relative_size > 0) @@ -63,7 +63,7 @@ BigInt& BigInt::operator-=(const BigInt& { SecureVector z(reg_size - 1); bigint_sub3(z, y.data(), reg_size - 1, data(), x_sw); - copy_mem(reg.begin(), z.begin(), z.size()); + copy_mem(get_reg().begin(), z.begin(), z.size()); } else bigint_add2(get_reg(), reg_size - 1, y.data(), y_sw); @@ -74,7 +74,7 @@ BigInt& BigInt::operator-=(const BigInt& { if(sign() == y.sign()) { - reg.clear(); + get_reg().clear(); set_sign(Positive); } else @@ -101,7 +101,7 @@ BigInt& BigInt::operator*=(const BigInt& if(x_sw == 0 || y_sw == 0) { - reg.clear(); + get_reg().clear(); set_sign(Positive); } else if(x_sw == 1 && y_sw) @@ -161,7 +161,7 @@ word BigInt::operator%=(word mod) word result = (word_at(0) & (mod - 1)); clear(); grow_to(2); - reg[0] = result; + get_reg()[0] = result; return result; } @@ -173,9 +173,9 @@ word BigInt::operator%=(word mod) grow_to(2); if(remainder && sign() == BigInt::Negative) - reg[0] = mod - remainder; + get_reg()[0] = mod - remainder; else - reg[0] = remainder; + get_reg()[0] = remainder; set_sign(BigInt::Positive); ============================================================ --- botan/bigint.cpp d67da926001bf17ae8d4a34f99e07558223b7b6f +++ botan/bigint.cpp 4613be2d770dddbcf23ab1b0b2a2a4dd2d8a2022 @@ -1,6 +1,6 @@ /************************************************* * BigInt Base Source File * -* (C) 1999-2007 Jack Lloyd * +* (C) 1999-2008 Jack Lloyd * *************************************************/ #include @@ -103,14 +103,14 @@ void BigInt::swap(BigInt& other) *************************************************/ void BigInt::swap(BigInt& other) { - std::swap(reg, other.reg); + reg.swap(other.reg); std::swap(signedness, other.signedness); } /************************************************* * Grow the internal storage * *************************************************/ -void BigInt::grow_reg(u32bit n) const +void BigInt::grow_reg(u32bit n) { reg.grow_to(round_up(size() + n, 8)); } @@ -118,7 +118,7 @@ void BigInt::grow_reg(u32bit n) const /************************************************* * Grow the internal storage * *************************************************/ -void BigInt::grow_to(u32bit n) const +void BigInt::grow_to(u32bit n) { if(n > size()) reg.grow_to(round_up(n, 8)); @@ -235,25 +235,6 @@ void BigInt::mask_bits(u32bit n) } /************************************************* -* Count the significant words * -*************************************************/ -u32bit BigInt::sig_words() const - { - const word* x = data(); - u32bit top_set = size(); - - while(top_set >= 4) - { - word sum = x[top_set-1] | x[top_set-2] | x[top_set-3] | x[top_set-4]; - if(sum) break; - else top_set -= 4; - } - while(top_set && (x[top_set-1] == 0)) - top_set--; - return top_set; - } - -/************************************************* * Count how many bytes are being used * *************************************************/ u32bit BigInt::bytes() const @@ -298,16 +279,6 @@ u32bit BigInt::encoded_size(Base base) c } /************************************************* -* Return true if this number is zero * -*************************************************/ -bool BigInt::is_zero() const - { - for(u32bit j = 0; j != size(); ++j) - if(reg[j]) return false; - return true; - } - -/************************************************* * Set the sign * *************************************************/ void BigInt::set_sign(Sign s) @@ -347,23 +318,6 @@ BigInt BigInt::operator-() const } /************************************************* -* Return a reference to the indexed word * -*************************************************/ -word& BigInt::operator[](u32bit index) - { - reg.grow_to(index+1); - return reg[index]; - } - -/************************************************* -* Return the value of the indexed word * -*************************************************/ -word BigInt::operator[](u32bit index) const - { - return (index < size()) ? reg[index] : 0; - } - -/************************************************* * Return the absolute value of this number * *************************************************/ BigInt BigInt::abs() const @@ -389,6 +343,7 @@ void BigInt::binary_decode(const byte bu void BigInt::binary_decode(const byte buf[], u32bit length) { const u32bit WORD_BYTES = sizeof(word); + reg.create(round_up((length / WORD_BYTES) + 1, 8)); for(u32bit j = 0; j != length / WORD_BYTES; ++j) ============================================================ --- botan/bigint.h 8517de135a204372bbded7af96c868548a160804 +++ botan/bigint.h 5973cc4eb8bc4c2a551202355079a63f18452536 @@ -1,6 +1,6 @@ /************************************************* * BigInt Header File * -* (C) 1999-2007 Jack Lloyd * +* (C) 1999-2008 Jack Lloyd * *************************************************/ #ifndef BOTAN_BIGINT_H__ @@ -47,8 +47,18 @@ class BOTAN_DLL BigInt s32bit cmp(const BigInt&, bool = true) const; bool is_even() const { return (get_bit(0) == 0); } bool is_odd() const { return (get_bit(0) == 1); } + + bool is_zero() const + { + const u32bit sw = sig_words(); + + for(u32bit i = 0; i != sw; ++i) + if(reg[i]) + return false; + return true; + } + bool is_nonzero() const { return (!is_zero()); } - bool is_zero() const; void set_bit(u32bit); void clear_bit(u32bit); @@ -57,8 +67,10 @@ class BOTAN_DLL BigInt bool get_bit(u32bit) const; u32bit get_substring(u32bit, u32bit) const; byte byte_at(u32bit) const; + + // same as operator[], remove this word word_at(u32bit n) const - { return ((n < size()) ? reg[n] : 0); } + { return ((n < size()) ? get_reg()[n] : 0); } u32bit to_u32bit() const; @@ -70,19 +82,32 @@ class BOTAN_DLL BigInt void set_sign(Sign); BigInt abs() const; - u32bit size() const { return reg.size(); } - u32bit sig_words() const; + u32bit size() const { return get_reg().size(); } + + u32bit sig_words() const + { + const word* x = reg.begin(); + u32bit sig = reg.size(); + + while(sig && (x[sig-1] == 0)) + sig--; + return sig; + } + u32bit bytes() const; u32bit bits() const; const word* data() const { return reg.begin(); } SecureVector& get_reg() { return reg; } - void grow_reg(u32bit) const; + const SecureVector& get_reg() const { return reg; } - word& operator[](u32bit); - word operator[](u32bit) const; - void clear() { reg.clear(); } + void grow_reg(u32bit); + void grow_to(u32bit); + word& operator[](u32bit i) { return reg[i]; } + word operator[](u32bit i) const { return reg[i]; } + void clear() { get_reg().clear(); } + void randomize(RandomNumberGenerator& rng, u32bit n); void binary_encode(byte[]) const; @@ -107,7 +132,6 @@ class BOTAN_DLL BigInt BigInt(Sign, u32bit); BigInt(NumberType, u32bit); private: - void grow_to(u32bit) const; SecureVector reg; Sign signedness; }; ============================================================ --- botan/bit_ops.h 249e2d04932f769955d4053a0485f1763674ef3c +++ botan/bit_ops.h 18c672469499579e580c4472298a4360a856b691 @@ -11,84 +11,78 @@ namespace Botan { namespace Botan { /************************************************* -* Word Rotation Functions * +* Return true iff arg is 2**n for some n > 0 * +* T should be an unsigned integer type * *************************************************/ -template inline T rotate_left(T input, u32bit rot) +template +inline bool power_of_2(T arg) { - return static_cast((input << rot) | (input >> (8*sizeof(T)-rot)));; + return ((arg != 0 && arg != 1) && ((arg & (arg-1)) == 0)); } -template inline T rotate_right(T input, u32bit rot) - { - return static_cast((input >> rot) | (input << (8*sizeof(T)-rot))); - } - /************************************************* -* Byte Swapping Functions * +* Return the index of the highest set bit +* T is an unsigned integer type *************************************************/ -inline u16bit reverse_bytes(u16bit input) +template +inline u32bit high_bit(T n) { - return rotate_left(input, 8); + for(u32bit i = 8*sizeof(T); i > 0; --i) + if((n >> (i - 1)) & 0x01) + return i; + return 0; } -inline u32bit reverse_bytes(u32bit input) +/************************************************* +* Return the index of the lowest set bit * +*************************************************/ +template +inline u32bit low_bit(T n) { - input = ((input & 0xFF00FF00) >> 8) | ((input & 0x00FF00FF) << 8); - return rotate_left(input, 16); + for(u32bit i = 0; i != 8*sizeof(T); ++i) + if((n >> i) & 0x01) + return (i + 1); + return 0; } -inline u64bit reverse_bytes(u64bit input) - { - u32bit hi = ((input >> 40) & 0x00FF00FF) | ((input >> 24) & 0xFF00FF00); - u32bit lo = ((input & 0xFF00FF00) >> 8) | ((input & 0x00FF00FF) << 8); - hi = (hi << 16) | (hi >> 16); - lo = (lo << 16) | (lo >> 16); - return (static_cast(lo) << 32) | hi; - } - /************************************************* -* XOR Arrays * +* Return the number of significant bytes in n * *************************************************/ -inline void xor_buf(byte data[], const byte mask[], u32bit length) +template +inline u32bit significant_bytes(T n) { - while(length >= 8) - { - data[0] ^= mask[0]; data[1] ^= mask[1]; - data[2] ^= mask[2]; data[3] ^= mask[3]; - data[4] ^= mask[4]; data[5] ^= mask[5]; - data[6] ^= mask[6]; data[7] ^= mask[7]; - data += 8; mask += 8; length -= 8; - } - for(u32bit j = 0; j != length; ++j) - data[j] ^= mask[j]; + for(u32bit j = 0; j != sizeof(T); ++j) + if(get_byte(j, n)) + return sizeof(T)-j; + return 0; } /************************************************* -* XOR Arrays * +* Return the Hamming weight of n * *************************************************/ -inline void xor_buf(byte out[], const byte in[], - const byte mask[], u32bit length) +template +inline u32bit hamming_weight(T n) { - while(length >= 8) - { - out[0] = in[0] ^ mask[0]; out[1] = in[1] ^ mask[1]; - out[2] = in[2] ^ mask[2]; out[3] = in[3] ^ mask[3]; - out[4] = in[4] ^ mask[4]; out[5] = in[5] ^ mask[5]; - out[6] = in[6] ^ mask[6]; out[7] = in[7] ^ mask[7]; - in += 8; out += 8; mask += 8; length -= 8; - } - for(u32bit j = 0; j != length; ++j) - out[j] = in[j] ^ mask[j]; + const byte NIBBLE_WEIGHTS[] = { + 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; + + u32bit weight = 0; + for(u32bit i = 0; i != 2*sizeof(T); ++i) + weight += NIBBLE_WEIGHTS[(n >> (4*i)) & 0x0F]; + return weight; } /************************************************* -* Simple Bit Manipulation * +* Count the trailing zero bits in n * *************************************************/ -bool power_of_2(u64bit); -u32bit high_bit(u64bit); -u32bit low_bit(u64bit); -u32bit significant_bytes(u64bit); -u32bit hamming_weight(u64bit); +template +inline u32bit ctz(T n) + { + for(int i = 0; i != 8*sizeof(T); ++i) + if((n >> i) & 0x01) + return i; + return 8*sizeof(T); + } } ============================================================ --- botan/buf_es.cpp aa507bb49b93b77a65b3cba83c3aeee1edf99026 +++ botan/buf_es.cpp 878e61561f7086b50eae304697c78959b6d5807b @@ -4,7 +4,7 @@ *************************************************/ #include -#include +#include #include #include ============================================================ --- botan/build.h 1a6f3b52e909f21e56dc8e6d2e071be7b3ee2af5 +++ botan/build.h 5313fb8a3db14e96229525ebd837a8577c13855c @@ -8,7 +8,7 @@ #define BOTAN_VERSION_MAJOR 1 #define BOTAN_VERSION_MINOR 7 -#define BOTAN_VERSION_PATCH 9 +#define BOTAN_VERSION_PATCH 12 #define BOTAN_MP_WORD_BITS 32 #define BOTAN_DEFAULT_BUFFER_SIZE 4096 ============================================================ --- botan/cbc.cpp 33122cb0d77783a79d55322a5648591266c1765d +++ botan/cbc.cpp 0889fddd4a74f3cad9bd61181e088e370e0de902 @@ -5,7 +5,7 @@ #include #include -#include +#include #include namespace Botan { ============================================================ --- botan/cbc_mac.cpp 96970348caef5cdb8d60f6c7dfefa050004b5178 +++ botan/cbc_mac.cpp 600a104430b0dd2e5ef32d337555d8f04ed94b8d @@ -5,7 +5,7 @@ #include #include -#include +#include #include namespace Botan { ============================================================ --- botan/cfb.cpp 6e0107157eb3e92bf7a82d463c772f7677b7287e +++ botan/cfb.cpp c33073c28cb45c1a402f459d94d4b6dac2689717 @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include namespace Botan { ============================================================ --- botan/credits.txt b6cbe9978c715b9058fdd94c6a7fd0a5f6449aee +++ botan/credits.txt 655b55732eda3066427f50f0cac912597f492427 @@ -44,6 +44,10 @@ N: Joel Low D: DLL symbol visibility +N: Vaclav Ovsik +E: address@hidden +D: Perl XS module + N: Luca Piccarreta E: address@hidden D: x86/amd64 assembler, BigInt optimizations, Win32 mutex module ============================================================ --- botan/ctr.cpp 78262b094f35ee9092e248f1701368d3d5a85f34 +++ botan/ctr.cpp b1601ec09907ba48a8eda08af77573ab70d166ab @@ -5,7 +5,7 @@ #include #include -#include +#include #include namespace Botan { ============================================================ --- botan/cts.cpp 5fdb172ec30924590a61f9eb900eec313e397118 +++ botan/cts.cpp eb09c8f82f41044bc2ab389327e64a9ac275b659 @@ -5,7 +5,7 @@ #include #include -#include +#include #include namespace Botan { ============================================================ --- botan/def_alg.cpp 6d7f05989c62b3e34d3c013628bb263bced56dba +++ botan/def_alg.cpp 265f8696b911b86cfbb355cac53c152455be28db @@ -12,6 +12,9 @@ #include #include +#if 0 // disable salsa for monotone +#include +#endif #include #include @@ -86,6 +89,15 @@ Default_Engine::find_block_cipher(const HANDLE_TYPE_NO_ARGS("TripleDES", TripleDES); HANDLE_TYPE_NO_ARGS("Noekeon", Noekeon); +#if 0 // disable Luby-Rackoff for monotone + if(algo_name == "Luby-Rackoff" && name.size() >= 2) + { + HashFunction* hash = find_hash(name[1]); + if(hash) + return new LubyRackoff(hash); + } +#endif + return 0; } @@ -102,6 +114,9 @@ Default_Engine::find_stream_cipher(const HANDLE_TYPE_ONE_U32BIT("ARC4", ARC4, 0); HANDLE_TYPE_ONE_U32BIT("RC4_drop", ARC4, 768); +#if 0 // disable salsa for monotone + HANDLE_TYPE_NO_ARGS("Salsa20", Salsa20); +#endif return 0; } ============================================================ --- botan/des.cpp 0dcc4fe670b5d81990b4693999995001299d2da9 +++ botan/des.cpp 33a628add92df63d32424353246c99fb482002b1 @@ -5,7 +5,7 @@ #include #include -#include +#include namespace Botan { ============================================================ --- botan/dl_group.cpp 6f64d08dc43b6c9d0f9dfe369e5ee4ede2b5993d +++ botan/dl_group.cpp 70c693c16e71e465ea5fa3da46bc947983767b85 @@ -87,7 +87,7 @@ DL_Group::DL_Group(RandomNumberGenerator const MemoryRegion& seed, u32bit pbits, u32bit qbits) { if(!generate_dsa_primes(rng, p, q, pbits, qbits, seed)) - throw Invalid_Argument("DL_Group: The seed/counter given does not " + throw Invalid_Argument("DL_Group: The seed given does not " "generate a DSA group"); g = make_dsa_generator(p, q); ============================================================ --- botan/dl_group.h 6dfe2e3864e5231ea2ac9e6431b584eaf303db4d +++ botan/dl_group.h 497418b4599cf597dc8a55fa960eb6bbddd06fc8 @@ -17,11 +17,31 @@ class BOTAN_DLL DL_Group class BOTAN_DLL DL_Group { public: + static SecureVector + generate_dsa_primes(RandomNumberGenerator& rng, + BigInt& p, BigInt& q, + u32bit pbits, u32bit qbits); + + static bool generate_dsa_primes(RandomNumberGenerator& rng, + BigInt& p_out, BigInt& q_out, + u32bit p_bits, u32bit q_bits, + const MemoryRegion& seed); + const BigInt& get_p() const; const BigInt& get_q() const; const BigInt& get_g() const; - enum Format { ANSI_X9_42, ANSI_X9_57, PKCS_3 }; + enum Format { + ANSI_X9_42, + ANSI_X9_57, + PKCS_3, + + DSA_PARAMETERS = ANSI_X9_57, + DH_PARAMETERS = ANSI_X9_42, + X942_DH_PARAMETERS = ANSI_X9_42, + PKCS3_DH_PARAMETERS = PKCS_3 + }; + enum PrimeType { Strong, Prime_Subgroup, DSA_Kosherizer }; bool verify_group(RandomNumberGenerator& rng, bool) const; @@ -38,20 +58,11 @@ class BOTAN_DLL DL_Group DL_Group(RandomNumberGenerator& rng, const MemoryRegion&, u32bit = 1024, u32bit = 0); - DL_Group(const BigInt&, const BigInt&); - DL_Group(const BigInt&, const BigInt&, const BigInt&); + DL_Group(const BigInt& p, const BigInt& g); + DL_Group(const BigInt& p, const BigInt& g, const BigInt& q); private: static BigInt make_dsa_generator(const BigInt&, const BigInt&); - static SecureVector - generate_dsa_primes(RandomNumberGenerator& rng, - BigInt& p, BigInt& q, - u32bit pbits, u32bit qbits); - - static bool generate_dsa_primes(RandomNumberGenerator&, - BigInt&, BigInt&, u32bit, u32bit, - const MemoryRegion&); - void init_check() const; void initialize(const BigInt&, const BigInt&, const BigInt&); bool initialized; ============================================================ --- botan/dlies.cpp bb2698ee8127bb35cd21bb89d4cd05127e4b8431 +++ botan/dlies.cpp 7f1b9b022c969360743bb20fdc9cf63c2cae96c2 @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include namespace Botan { ============================================================ --- botan/dsa_gen.cpp bfe2b174d12d0a5e65574a81091b938ed1b55f22 +++ botan/dsa_gen.cpp ce07c28b68b320a87de64946a69513841bad6d5f @@ -19,12 +19,15 @@ bool fips186_3_valid_size(u32bit pbits, *************************************************/ bool fips186_3_valid_size(u32bit pbits, u32bit qbits) { - if(pbits == 1024 && qbits == 160) - return true; - if(pbits == 2048 && (qbits == 224 || qbits == 256)) - return true; - if(pbits == 3072 && qbits == 256) - return true; + if(qbits == 160) + return (pbits == 512 || pbits == 768 || pbits == 1024); + + if(qbits == 224) + return (pbits == 2048); + + if(qbits == 256) + return (pbits == 2048 || pbits == 3072); + return false; } ============================================================ --- botan/eax.cpp 2094aba50694d8729ef706893dece9038cc357eb +++ botan/eax.cpp 15aab5f154c916cf0c6e4964b35e9c9989f628d5 @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include ============================================================ --- botan/engine.cpp c9919382acf830b62e8911d9364251d314557c57 +++ botan/engine.cpp 8202fd83d55e8928f509f14ffb5c8727289f3017 @@ -350,7 +350,10 @@ Keyed_Filter* get_cipher(const std::stri { Keyed_Filter* cipher = get_cipher(algo_spec, direction); cipher->set_key(key); - cipher->set_iv(iv); + + if(iv.length()) + cipher->set_iv(iv); + return cipher; } ============================================================ --- botan/exceptn.h 6c8eb39d95fc61a0a1bf2201f053811c61e9623d +++ botan/exceptn.h 7c29a02497b65a17270ba34c606b99629ad2d05f @@ -190,15 +190,6 @@ struct BOTAN_DLL Self_Test_Failure : pub Internal_Error("Self test failed: " + err) {} }; -/************************************************* -* Memory Allocation Exception * -*************************************************/ -struct BOTAN_DLL Memory_Exhaustion : public Exception - { - Memory_Exhaustion() : - Exception("Ran out of memory, allocation failed") {} - }; - } #endif ============================================================ --- botan/get_enc.cpp c2e4f0bd43c299fc1ddfd177d67b361f7e975a9a +++ botan/get_enc.cpp 6463ffc2f99fdf284c26d3ccf6569aef9f7f8c7b @@ -123,7 +123,7 @@ MGF* get_mgf(const std::string& algo_spe if(mgf_name == "MGF1") { if(name.size() == 2) - return new MGF1(name[1]); + return new MGF1(get_hash(name[1])); } else throw Algorithm_Not_Found(algo_spec); ============================================================ --- botan/hmac.cpp 95864b3c32b51ea57eecb60eaac4c7af77265d05 +++ botan/hmac.cpp ea3d0d7b82ab2b6785a42fc3e8519013b1876ab5 @@ -6,7 +6,7 @@ #include #include -#include +#include namespace Botan { ============================================================ --- botan/info.txt 178e88903d71f7c580f1a94ef9bfcc5116b2f6a8 +++ botan/info.txt 2545fa94e8f50cade2a63bda5a1027f5c19f7194 @@ -1,33 +1,34 @@ -Botan is a C++ class library for performing a wide variety of cryptographic -operations, including encryption, hashing, authentication, public key -encryption and signatures, and creating and using X.509v3 certificates and -CRLs. PKCS #8 private keys (including PKCS #5 encryption) and PKCS #10 -certificate requests are also included. As well as various modes, padding -schemes, and so forth, Botan supports the following basic cryptographic -algorithms: +Botan is a C++ class library for performing a wide variety of +cryptographic operations, including encryption, hashing, +authentication, public key encryption and signatures, and creating and +using X.509v3 certificates and CRLs. PKCS #8 private keys (including +PKCS #5 encryption) and PKCS #10 certificate requests are also +included. As well as various modes, padding schemes, and so forth, +Botan supports the following basic cryptographic algorithms: * Public Key Algorithms: Diffie-Hellman, DSA, ElGamal, Nyberg-Rueppel, Rabin-Williams, RSA -* Block Ciphers: AES, Blowfish, CAST-128, CAST-256, DES/DESX/TripleDES, GOST, - IDEA, KASUMI, Lion, Luby-Rackoff, MARS, MISTY1, RC2, RC5, RC6, SAFER-SK, - SEED, Serpent, Skipjack, Square, TEA, Twofish, XTEA +* Block Ciphers: AES, Blowfish, CAST-128, CAST-256, DES, DESX, + TripleDES, GOST, IDEA, KASUMI, Noekeon, Lion, Luby-Rackoff, MARS, + MISTY1, RC2, RC5, RC6, SAFER-SK, SEED, Serpent, Skipjack, Square, + TEA, Twofish, XTEA -* Stream Ciphers: ARC4, WiderWake4+1, Turing +* Stream Ciphers: ARC4, WiderWake4+1, Salsa20, Turing * Hash Functions: HAS-160, MD2, MD4, MD5, RIPEMD-128, RIPEMD-160, SHA-160, SHA-256, SHA-384, SHA-512, Tiger, Whirlpool * MACs: ANSI X9.19 MAC, CMAC, HMAC -For build instructions, read 'doc/building.pdf'. The license can be found in -'doc/license.txt', and the ChangeLog is in 'doc/log.txt'. +For build instructions, read 'doc/building.pdf'. The license can be +found in 'doc/license.txt', and the ChangeLog is in 'doc/log.txt'. -Check http://botan.randombit.net/ for announcements and news. If you'll be -developing code using Botan, consider joining the mailing lists; links to -subscriptions forms and the archives can be found on the web page. Feel free to -contact me with any questions or comments. +Check http://botan.randombit.net/ for announcements and news. If +you'll be developing code using Botan, consider joining the mailing +lists; links to subscriptions forms and the archives can be found on +the web page. Feel free to contact me with any questions or comments. Regards, Jack Lloyd (address@hidden) ============================================================ --- botan/loadstor.h 4dddb134024c8e16cbce6b72cbce823750146023 +++ botan/loadstor.h 49dc502217d6af461c739c6e33c1ab3d7e3bd55d @@ -8,11 +8,11 @@ #define BOTAN_LOAD_STORE_H__ #include +#include +#include #if BOTAN_TARGET_UNALIGNED_LOADSTOR_OK -#include - #if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN) #define BOTAN_ENDIAN_N2B(x) (x) ============================================================ --- botan/mem_pool.cpp 0853e76a2dd2cf52e8fa894270cc5dadd4aa211b +++ botan/mem_pool.cpp 23230305d388340130aa2f95ec3c70edadcc9584 @@ -9,10 +9,24 @@ #include #include #include +#include namespace Botan { +namespace { + /************************************************* +* Memory Allocation Exception * +*************************************************/ +struct Memory_Exhaustion : public std::bad_alloc + { + const char* what() + { return "Ran out of memory, allocation failed"; } + }; + +} + +/************************************************* * Memory_Block Constructor * *************************************************/ Pooling_Allocator::Memory_Block::Memory_Block(void* buf) ============================================================ --- botan/mgf1.cpp 70180df9bdb3539116bfdb8e90b94079d0ea70cd +++ botan/mgf1.cpp 5000a9822ac26112c18bdfa243b0eeb7aa23693f @@ -4,9 +4,8 @@ *************************************************/ #include -#include #include -#include +#include #include #include @@ -20,8 +19,6 @@ void MGF1::mask(const byte in[], u32bit { u32bit counter = 0; - std::auto_ptr hash(get_hash(hash_name)); - while(out_len) { hash->update(in, in_len); @@ -41,10 +38,18 @@ void MGF1::mask(const byte in[], u32bit /************************************************* * MGF1 Constructor * *************************************************/ -MGF1::MGF1(const std::string& h_name) : hash_name(h_name) +MGF1::MGF1(HashFunction* h) : hash(h) { - if(!have_hash(hash_name)) - throw Algorithm_Not_Found(hash_name); + if(!hash) + throw Invalid_Argument("MGF1 given null hash object"); } +/************************************************* +* MGF1 Destructor * +*************************************************/ +MGF1::~MGF1() + { + delete hash; + } + } ============================================================ --- botan/mgf1.h 7359b8d5d3e3ff0daf8f2d23b40581ce64e7ff72 +++ botan/mgf1.h 7776068de7479ee101ffb6e47348a12065d8e961 @@ -11,15 +11,21 @@ namespace Botan { namespace Botan { /************************************************* -* MGF1 * +* MGF1 (Mask Generation Function) * *************************************************/ class BOTAN_DLL MGF1 : public MGF { public: void mask(const byte[], u32bit, byte[], u32bit) const; - MGF1(const std::string&); + + /** + MGF1 constructor: takes ownership of hash + */ + MGF1(HashFunction* hash); + + ~MGF1(); private: - const std::string hash_name; + HashFunction* hash; }; } ============================================================ --- botan/mp_asm.cpp 2bcf481048ef5cc53b3479118ecfeca9b6da659b +++ botan/mp_asm.cpp 0eaa67b409564a44a6e9dd633199be84c5af5a1b @@ -172,35 +172,6 @@ void bigint_linmul3(word z[], const word z[x_size] = carry; } -/************************************************* -* Montgomery Reduction Algorithm * -*************************************************/ -void bigint_monty_redc(word z[], u32bit z_size, - const word x[], u32bit x_size, word u) - { - for(u32bit j = 0; j != x_size; ++j) - { - word* z_j = z + j; - - const word y = z_j[0] * u; - - word carry = bigint_mul_add_words(z_j, x, x_size, y); - - word z_sum = z_j[x_size] + carry; - carry = (z_sum < z_j[x_size]); - z_j[x_size] = z_sum; - - for(u32bit k = x_size + 1; carry && k != z_size - j; ++k) - { - ++z_j[k]; - carry = !z_j[k]; - } - } - - if(bigint_cmp(z + x_size, x_size + 1, x, x_size) >= 0) - bigint_sub2(z + x_size, x_size + 1, x, x_size); - } - } } ============================================================ --- botan/mp_comba.cpp 12dec4af4a5d52af45e4fe6bd2308f682a7bbb06 +++ botan/mp_comba.cpp 54f6ef968f19aa0519a7f160a36a999c0432223e @@ -11,6 +11,39 @@ extern "C" { extern "C" { /************************************************* +* Comba 4x4 Squaring * +*************************************************/ +void bigint_comba_sqr4(word z[8], const word x[4]) + { + word w2 = 0, w1 = 0, w0 = 0; + + word3_muladd(&w2, &w1, &w0, x[0], x[0]); + z[0] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[1]); + z[1] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[2]); + word3_muladd(&w2, &w1, &w0, x[1], x[1]); + z[2] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[3]); + word3_muladd_2(&w2, &w1, &w0, x[1], x[2]); + z[3] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[1], x[3]); + word3_muladd(&w2, &w1, &w0, x[2], x[2]); + z[4] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[2], x[3]); + z[5] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[3], x[3]); + z[6] = w0; + z[7] = w1; + } + +/************************************************* * Comba 4x4 Multiplication * *************************************************/ void bigint_comba_mul4(word z[8], const word x[4], const word y[4]) @@ -50,6 +83,58 @@ void bigint_comba_mul4(word z[8], const } /************************************************* +* Comba 6x6 Squaring * +*************************************************/ +void bigint_comba_sqr6(word z[12], const word x[6]) + { + word w2 = 0, w1 = 0, w0 = 0; + + word3_muladd(&w2, &w1, &w0, x[0], x[0]); + z[0] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[1]); + z[1] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[2]); + word3_muladd(&w2, &w1, &w0, x[1], x[1]); + z[2] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[3]); + word3_muladd_2(&w2, &w1, &w0, x[1], x[2]); + z[3] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[4]); + word3_muladd_2(&w2, &w1, &w0, x[1], x[3]); + word3_muladd(&w2, &w1, &w0, x[2], x[2]); + z[4] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[5]); + word3_muladd_2(&w2, &w1, &w0, x[1], x[4]); + word3_muladd_2(&w2, &w1, &w0, x[2], x[3]); + z[5] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[1], x[5]); + word3_muladd_2(&w2, &w1, &w0, x[2], x[4]); + word3_muladd(&w2, &w1, &w0, x[3], x[3]); + z[6] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[2], x[5]); + word3_muladd_2(&w2, &w1, &w0, x[3], x[4]); + z[7] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[3], x[5]); + word3_muladd(&w2, &w1, &w0, x[4], x[4]); + z[8] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[4], x[5]); + z[9] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[5], x[5]); + z[10] = w0; + z[11] = w1; + } + +/************************************************* * Comba 6x6 Multiplication * *************************************************/ void bigint_comba_mul6(word z[12], const word x[6], const word y[6]) @@ -117,6 +202,81 @@ void bigint_comba_mul6(word z[12], const } /************************************************* +* Comba 8x8 Squaring * +*************************************************/ +void bigint_comba_sqr8(word z[16], const word x[8]) + { + word w2 = 0, w1 = 0, w0 = 0; + + word3_muladd(&w2, &w1, &w0, x[0], x[0]); + z[0] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[1]); + z[1] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[2]); + word3_muladd(&w2, &w1, &w0, x[1], x[1]); + z[2] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[3]); + word3_muladd_2(&w2, &w1, &w0, x[1], x[2]); + z[3] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[4]); + word3_muladd_2(&w2, &w1, &w0, x[1], x[3]); + word3_muladd(&w2, &w1, &w0, x[2], x[2]); + z[4] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[5]); + word3_muladd_2(&w2, &w1, &w0, x[1], x[4]); + word3_muladd_2(&w2, &w1, &w0, x[2], x[3]); + z[5] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[6]); + word3_muladd_2(&w2, &w1, &w0, x[1], x[5]); + word3_muladd_2(&w2, &w1, &w0, x[2], x[4]); + word3_muladd(&w2, &w1, &w0, x[3], x[3]); + z[6] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[0], x[7]); + word3_muladd_2(&w2, &w1, &w0, x[1], x[6]); + word3_muladd_2(&w2, &w1, &w0, x[2], x[5]); + word3_muladd_2(&w2, &w1, &w0, x[3], x[4]); + z[7] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[1], x[7]); + word3_muladd_2(&w2, &w1, &w0, x[2], x[6]); + word3_muladd_2(&w2, &w1, &w0, x[3], x[5]); + word3_muladd(&w2, &w1, &w0, x[4], x[4]); + z[8] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[2], x[7]); + word3_muladd_2(&w2, &w1, &w0, x[3], x[6]); + word3_muladd_2(&w2, &w1, &w0, x[4], x[5]); + z[9] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[3], x[7]); + word3_muladd_2(&w2, &w1, &w0, x[4], x[6]); + word3_muladd(&w2, &w1, &w0, x[5], x[5]); + z[10] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[4], x[7]); + word3_muladd_2(&w2, &w1, &w0, x[5], x[6]); + z[11] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[5], x[7]); + word3_muladd(&w2, &w1, &w0, x[6], x[6]); + z[12] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[6], x[7]); + z[13] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[7], x[7]); + z[14] = w0; + z[15] = w1; + } + +/************************************************* * Comba 8x8 Multiplication * *************************************************/ void bigint_comba_mul8(word z[16], const word x[8], const word y[8]) @@ -220,163 +380,537 @@ void bigint_comba_mul8(word z[16], const } /************************************************* -* Comba 4x4 Squaring * +* Comba 16x16 Squaring * *************************************************/ -void bigint_comba_sqr4(word z[8], const word x[4]) +void bigint_comba_sqr16(word z[32], const word x[16]) { word w2 = 0, w1 = 0, w0 = 0; - word3_muladd(&w2, &w1, &w0, x[0], x[0]); - z[0] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]); + z[ 0] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[1]); - z[1] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 1]); + z[ 1] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[2]); - word3_muladd(&w2, &w1, &w0, x[1], x[1]); - z[2] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 2]); + word3_muladd(&w2, &w1, &w0, x[ 1], x[ 1]); + z[ 2] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[3]); - word3_muladd_2(&w2, &w1, &w0, x[1], x[2]); - z[3] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 2]); + z[ 3] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[1], x[3]); - word3_muladd(&w2, &w1, &w0, x[2], x[2]); - z[4] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 4]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 3]); + word3_muladd(&w2, &w1, &w0, x[ 2], x[ 2]); + z[ 4] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[2], x[3]); - z[5] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 5]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 4]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 3]); + z[ 5] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd(&w2, &w1, &w0, x[3], x[3]); - z[6] = w0; - z[7] = w1; - } + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 6]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 5]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 4]); + word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]); + z[ 6] = w0; w0 = w1; w1 = w2; w2 = 0; -/************************************************* -* Comba 6x6 Squaring * -*************************************************/ -void bigint_comba_sqr6(word z[12], const word x[6]) - { - word w2 = 0, w1 = 0, w0 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 7]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 6]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 5]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 4]); + z[ 7] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd(&w2, &w1, &w0, x[0], x[0]); - z[0] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 8]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 7]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 6]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 5]); + word3_muladd(&w2, &w1, &w0, x[ 4], x[ 4]); + z[ 8] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[1]); - z[1] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 9]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 8]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 7]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 6]); + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 5]); + z[ 9] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[2]); - word3_muladd(&w2, &w1, &w0, x[1], x[1]); - z[2] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[10]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 9]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 8]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 7]); + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 6]); + word3_muladd(&w2, &w1, &w0, x[ 5], x[ 5]); + z[10] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[3]); - word3_muladd_2(&w2, &w1, &w0, x[1], x[2]); - z[3] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[11]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[10]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 9]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 8]); + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 7]); + word3_muladd_2(&w2, &w1, &w0, x[ 5], x[ 6]); + z[11] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[4]); - word3_muladd_2(&w2, &w1, &w0, x[1], x[3]); - word3_muladd(&w2, &w1, &w0, x[2], x[2]); - z[4] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[12]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[11]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[10]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 9]); + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 8]); + word3_muladd_2(&w2, &w1, &w0, x[ 5], x[ 7]); + word3_muladd(&w2, &w1, &w0, x[ 6], x[ 6]); + z[12] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[5]); - word3_muladd_2(&w2, &w1, &w0, x[1], x[4]); - word3_muladd_2(&w2, &w1, &w0, x[2], x[3]); - z[5] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[12]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[11]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[10]); + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 9]); + word3_muladd_2(&w2, &w1, &w0, x[ 5], x[ 8]); + word3_muladd_2(&w2, &w1, &w0, x[ 6], x[ 7]); + z[13] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[1], x[5]); - word3_muladd_2(&w2, &w1, &w0, x[2], x[4]); - word3_muladd(&w2, &w1, &w0, x[3], x[3]); - z[6] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[12]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[11]); + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[10]); + word3_muladd_2(&w2, &w1, &w0, x[ 5], x[ 9]); + word3_muladd_2(&w2, &w1, &w0, x[ 6], x[ 8]); + word3_muladd(&w2, &w1, &w0, x[ 7], x[ 7]); + z[14] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[2], x[5]); - word3_muladd_2(&w2, &w1, &w0, x[3], x[4]); - z[7] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 0], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[12]); + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[11]); + word3_muladd_2(&w2, &w1, &w0, x[ 5], x[10]); + word3_muladd_2(&w2, &w1, &w0, x[ 6], x[ 9]); + word3_muladd_2(&w2, &w1, &w0, x[ 7], x[ 8]); + z[15] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[3], x[5]); - word3_muladd(&w2, &w1, &w0, x[4], x[4]); - z[8] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 1], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[12]); + word3_muladd_2(&w2, &w1, &w0, x[ 5], x[11]); + word3_muladd_2(&w2, &w1, &w0, x[ 6], x[10]); + word3_muladd_2(&w2, &w1, &w0, x[ 7], x[ 9]); + word3_muladd(&w2, &w1, &w0, x[ 8], x[ 8]); + z[16] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[4], x[5]); - z[9] = w0; w0 = w1; w1 = w2; w2 = 0; + word3_muladd_2(&w2, &w1, &w0, x[ 2], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[ 5], x[12]); + word3_muladd_2(&w2, &w1, &w0, x[ 6], x[11]); + word3_muladd_2(&w2, &w1, &w0, x[ 7], x[10]); + word3_muladd_2(&w2, &w1, &w0, x[ 8], x[ 9]); + z[17] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd(&w2, &w1, &w0, x[5], x[5]); - z[10] = w0; - z[11] = w1; + word3_muladd_2(&w2, &w1, &w0, x[ 3], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[ 5], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[ 6], x[12]); + word3_muladd_2(&w2, &w1, &w0, x[ 7], x[11]); + word3_muladd_2(&w2, &w1, &w0, x[ 8], x[10]); + word3_muladd(&w2, &w1, &w0, x[ 9], x[ 9]); + z[18] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[ 4], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[ 5], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[ 6], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[ 7], x[12]); + word3_muladd_2(&w2, &w1, &w0, x[ 8], x[11]); + word3_muladd_2(&w2, &w1, &w0, x[ 9], x[10]); + z[19] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[ 5], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[ 6], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[ 7], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[ 8], x[12]); + word3_muladd_2(&w2, &w1, &w0, x[ 9], x[11]); + word3_muladd(&w2, &w1, &w0, x[10], x[10]); + z[20] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[ 6], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[ 7], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[ 8], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[ 9], x[12]); + word3_muladd_2(&w2, &w1, &w0, x[10], x[11]); + z[21] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[ 7], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[ 8], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[ 9], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[10], x[12]); + word3_muladd(&w2, &w1, &w0, x[11], x[11]); + z[22] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[ 8], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[ 9], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[10], x[13]); + word3_muladd_2(&w2, &w1, &w0, x[11], x[12]); + z[23] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[ 9], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[10], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[11], x[13]); + word3_muladd(&w2, &w1, &w0, x[12], x[12]); + z[24] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[10], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[11], x[14]); + word3_muladd_2(&w2, &w1, &w0, x[12], x[13]); + z[25] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[11], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[12], x[14]); + word3_muladd(&w2, &w1, &w0, x[13], x[13]); + z[26] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[12], x[15]); + word3_muladd_2(&w2, &w1, &w0, x[13], x[14]); + z[27] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[13], x[15]); + word3_muladd(&w2, &w1, &w0, x[14], x[14]); + z[28] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd_2(&w2, &w1, &w0, x[14], x[15]); + z[29] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[15], x[15]); + z[30] = w0; + z[31] = w1; } /************************************************* -* Comba 8x8 Squaring * +* Comba 16x16 Multiplication * *************************************************/ -void bigint_comba_sqr8(word z[16], const word x[8]) +void bigint_comba_mul16(word z[32], const word x[16], const word y[16]) { word w2 = 0, w1 = 0, w0 = 0; - word3_muladd(&w2, &w1, &w0, x[0], x[0]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[ 0]); z[0] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[1]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[ 0]); z[1] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[2]); - word3_muladd(&w2, &w1, &w0, x[1], x[1]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[ 0]); z[2] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[3]); - word3_muladd_2(&w2, &w1, &w0, x[1], x[2]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[ 0]); z[3] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[4]); - word3_muladd_2(&w2, &w1, &w0, x[1], x[3]); - word3_muladd(&w2, &w1, &w0, x[2], x[2]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[ 0]); z[4] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[5]); - word3_muladd_2(&w2, &w1, &w0, x[1], x[4]); - word3_muladd_2(&w2, &w1, &w0, x[2], x[3]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[ 0]); z[5] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[6]); - word3_muladd_2(&w2, &w1, &w0, x[1], x[5]); - word3_muladd_2(&w2, &w1, &w0, x[2], x[4]); - word3_muladd(&w2, &w1, &w0, x[3], x[3]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[ 0]); z[6] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[0], x[7]); - word3_muladd_2(&w2, &w1, &w0, x[1], x[6]); - word3_muladd_2(&w2, &w1, &w0, x[2], x[5]); - word3_muladd_2(&w2, &w1, &w0, x[3], x[4]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[ 0]); z[7] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[1], x[7]); - word3_muladd_2(&w2, &w1, &w0, x[2], x[6]); - word3_muladd_2(&w2, &w1, &w0, x[3], x[5]); - word3_muladd(&w2, &w1, &w0, x[4], x[4]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[ 0]); z[8] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[2], x[7]); - word3_muladd_2(&w2, &w1, &w0, x[3], x[6]); - word3_muladd_2(&w2, &w1, &w0, x[4], x[5]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[ 0]); z[9] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[3], x[7]); - word3_muladd_2(&w2, &w1, &w0, x[4], x[6]); - word3_muladd(&w2, &w1, &w0, x[5], x[5]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[10]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[10], y[ 0]); z[10] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[4], x[7]); - word3_muladd_2(&w2, &w1, &w0, x[5], x[6]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[11]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[10]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[10], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[11], y[ 0]); z[11] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[5], x[7]); - word3_muladd(&w2, &w1, &w0, x[6], x[6]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[12]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[11]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[10]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[10], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[11], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[12], y[ 0]); z[12] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd_2(&w2, &w1, &w0, x[6], x[7]); + word3_muladd(&w2, &w1, &w0, x[ 0], y[13]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[12]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[11]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[10]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[10], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[11], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[12], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[13], y[ 0]); z[13] = w0; w0 = w1; w1 = w2; w2 = 0; - word3_muladd(&w2, &w1, &w0, x[7], x[7]); - z[14] = w0; - z[15] = w1; + word3_muladd(&w2, &w1, &w0, x[ 0], y[14]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[13]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[12]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[11]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[10]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[10], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[11], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[12], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[13], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[14], y[ 0]); + z[14] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[ 0], y[15]); + word3_muladd(&w2, &w1, &w0, x[ 1], y[14]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[13]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[12]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[11]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[10]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[10], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[11], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[12], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[13], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[14], y[ 1]); + word3_muladd(&w2, &w1, &w0, x[15], y[ 0]); + z[15] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[ 1], y[15]); + word3_muladd(&w2, &w1, &w0, x[ 2], y[14]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[13]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[12]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[11]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[10]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[10], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[11], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[12], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[13], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[14], y[ 2]); + word3_muladd(&w2, &w1, &w0, x[15], y[ 1]); + z[16] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[ 2], y[15]); + word3_muladd(&w2, &w1, &w0, x[ 3], y[14]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[13]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[12]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[11]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[10]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[10], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[11], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[12], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[13], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[14], y[ 3]); + word3_muladd(&w2, &w1, &w0, x[15], y[ 2]); + z[17] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[ 3], y[15]); + word3_muladd(&w2, &w1, &w0, x[ 4], y[14]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[13]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[12]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[11]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[10]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[10], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[11], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[12], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[13], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[14], y[ 4]); + word3_muladd(&w2, &w1, &w0, x[15], y[ 3]); + z[18] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[ 4], y[15]); + word3_muladd(&w2, &w1, &w0, x[ 5], y[14]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[13]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[12]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[11]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[10]); + word3_muladd(&w2, &w1, &w0, x[10], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[11], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[12], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[13], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[14], y[ 5]); + word3_muladd(&w2, &w1, &w0, x[15], y[ 4]); + z[19] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[ 5], y[15]); + word3_muladd(&w2, &w1, &w0, x[ 6], y[14]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[13]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[12]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[11]); + word3_muladd(&w2, &w1, &w0, x[10], y[10]); + word3_muladd(&w2, &w1, &w0, x[11], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[12], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[13], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[14], y[ 6]); + word3_muladd(&w2, &w1, &w0, x[15], y[ 5]); + z[20] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[ 6], y[15]); + word3_muladd(&w2, &w1, &w0, x[ 7], y[14]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[13]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[12]); + word3_muladd(&w2, &w1, &w0, x[10], y[11]); + word3_muladd(&w2, &w1, &w0, x[11], y[10]); + word3_muladd(&w2, &w1, &w0, x[12], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[13], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[14], y[ 7]); + word3_muladd(&w2, &w1, &w0, x[15], y[ 6]); + z[21] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[ 7], y[15]); + word3_muladd(&w2, &w1, &w0, x[ 8], y[14]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[13]); + word3_muladd(&w2, &w1, &w0, x[10], y[12]); + word3_muladd(&w2, &w1, &w0, x[11], y[11]); + word3_muladd(&w2, &w1, &w0, x[12], y[10]); + word3_muladd(&w2, &w1, &w0, x[13], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[14], y[ 8]); + word3_muladd(&w2, &w1, &w0, x[15], y[ 7]); + z[22] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[ 8], y[15]); + word3_muladd(&w2, &w1, &w0, x[ 9], y[14]); + word3_muladd(&w2, &w1, &w0, x[10], y[13]); + word3_muladd(&w2, &w1, &w0, x[11], y[12]); + word3_muladd(&w2, &w1, &w0, x[12], y[11]); + word3_muladd(&w2, &w1, &w0, x[13], y[10]); + word3_muladd(&w2, &w1, &w0, x[14], y[ 9]); + word3_muladd(&w2, &w1, &w0, x[15], y[ 8]); + z[23] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[ 9], y[15]); + word3_muladd(&w2, &w1, &w0, x[10], y[14]); + word3_muladd(&w2, &w1, &w0, x[11], y[13]); + word3_muladd(&w2, &w1, &w0, x[12], y[12]); + word3_muladd(&w2, &w1, &w0, x[13], y[11]); + word3_muladd(&w2, &w1, &w0, x[14], y[10]); + word3_muladd(&w2, &w1, &w0, x[15], y[ 9]); + z[24] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[10], y[15]); + word3_muladd(&w2, &w1, &w0, x[11], y[14]); + word3_muladd(&w2, &w1, &w0, x[12], y[13]); + word3_muladd(&w2, &w1, &w0, x[13], y[12]); + word3_muladd(&w2, &w1, &w0, x[14], y[11]); + word3_muladd(&w2, &w1, &w0, x[15], y[10]); + z[25] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[11], y[15]); + word3_muladd(&w2, &w1, &w0, x[12], y[14]); + word3_muladd(&w2, &w1, &w0, x[13], y[13]); + word3_muladd(&w2, &w1, &w0, x[14], y[12]); + word3_muladd(&w2, &w1, &w0, x[15], y[11]); + z[26] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[12], y[15]); + word3_muladd(&w2, &w1, &w0, x[13], y[14]); + word3_muladd(&w2, &w1, &w0, x[14], y[13]); + word3_muladd(&w2, &w1, &w0, x[15], y[12]); + z[27] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[13], y[15]); + word3_muladd(&w2, &w1, &w0, x[14], y[14]); + word3_muladd(&w2, &w1, &w0, x[15], y[13]); + z[28] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[14], y[15]); + word3_muladd(&w2, &w1, &w0, x[15], y[14]); + z[29] = w0; w0 = w1; w1 = w2; w2 = 0; + + word3_muladd(&w2, &w1, &w0, x[15], y[15]); + z[30] = w0; + z[31] = w1; } } ============================================================ --- botan/mp_core.h d2ffb425026eef1911de3486d44c044871047f14 +++ botan/mp_core.h 9852a75f527eefd3e527c229ca0cc8254f6cac1f @@ -38,10 +38,15 @@ void bigint_shr2(word[], const word[], u void bigint_shr2(word[], const word[], u32bit, u32bit, u32bit); /************************************************* -* Multiplication and Squaring Operations * +* Simple O(N^2) Multiplication and Squaring * *************************************************/ -word bigint_mul_add_words(word[], const word[], u32bit, word); +void bigint_simple_mul(word z[], const word x[], u32bit x_size, + const word y[], u32bit y_size); +void bigint_simple_sqr(word z[], const word x[], u32bit x_size); +/************************************************* +* Linear Multiply * +*************************************************/ void bigint_linmul2(word[], u32bit, word); void bigint_linmul3(word[], const word[], u32bit, word); void bigint_linmul_add(word[], u32bit, const word[], u32bit, word); @@ -66,10 +71,13 @@ void bigint_comba_mul8(word[16], const w void bigint_comba_mul4(word[8], const word[4], const word[4]); void bigint_comba_mul6(word[12], const word[6], const word[6]); void bigint_comba_mul8(word[16], const word[8], const word[8]); +void bigint_comba_mul16(word[32], const word[16], const word[16]); void bigint_comba_sqr4(word[8], const word[4]); void bigint_comba_sqr6(word[12], const word[6]); void bigint_comba_sqr8(word[16], const word[8]); +void bigint_comba_sqr8(word[32], const word[16]); +void bigint_comba_sqr16(word[64], const word[32]); } ============================================================ --- botan/mp_karat.cpp bd9ddd196f33f94792828a24547d82ef35e95a60 +++ botan/mp_karat.cpp 5fcd683a3bca97b5ccdd54e81b334f35aded5605 @@ -5,47 +5,25 @@ #include #include +#include namespace Botan { namespace { /************************************************* -* Simple O(N^2) Multiplication * -*************************************************/ -void bigint_simple_mul(word z[], const word x[], u32bit x_size, - const word y[], u32bit y_size) - { - clear_mem(z, x_size + y_size); - - for(u32bit j = 0; j != x_size; ++j) - z[j+y_size] = bigint_mul_add_words(z + j, y, y_size, x[j]); - } - -/************************************************* -* Simple O(N^2) Squaring * -*************************************************/ -void bigint_simple_sqr(word z[], const word x[], u32bit x_size) - { - clear_mem(z, 2*x_size); - - for(u32bit j = 0; j != x_size; ++j) - z[j+x_size] = bigint_mul_add_words(z + j, x, x_size, x[j]); - } - -/************************************************* * Karatsuba Multiplication Operation * *************************************************/ void karatsuba_mul(word z[], const word x[], const word y[], u32bit N, word workspace[]) { - const u32bit KARATSUBA_MUL_LOWER_SIZE = BOTAN_KARAT_MUL_THRESHOLD; - if(N == 6) bigint_comba_mul6(z, x, y); else if(N == 8) bigint_comba_mul8(z, x, y); - else if(N < KARATSUBA_MUL_LOWER_SIZE || N % 2) + else if(N == 16) + bigint_comba_mul16(z, x, y); + else if(N < BOTAN_KARAT_MUL_THRESHOLD || N % 2) bigint_simple_mul(z, x, N, y, N); else { @@ -81,10 +59,31 @@ void karatsuba_mul(word z[], const word karatsuba_mul(z0, x0, y0, N2, workspace+N); karatsuba_mul(z1, x1, y1, N2, workspace+N); - word carry = bigint_add3_nc(workspace+N, z0, N, z1, N); - carry += bigint_add2_nc(z + N2, N, workspace + N, N); - bigint_add2_nc(z + N + N2, N2, &carry, 1); + const u32bit blocks_of_8 = N - (N % 8); + word carry = 0; + + for(u32bit j = 0; j != blocks_of_8; j += 8) + carry = word8_add3(workspace + N + j, z0 + j, z1 + j, carry); + + for(u32bit j = blocks_of_8; j != N; ++j) + workspace[N + j] = word_add(z0[j], z1[j], &carry); + + word carry2 = 0; + + for(u32bit j = 0; j != blocks_of_8; j += 8) + carry2 = word8_add2(z + N2 + j, workspace + N + j, carry2); + + for(u32bit j = blocks_of_8; j != N; ++j) + z[N2 + j] = word_add(z[N2 + j], workspace[N + j], &carry2); + + z[N + N2] = word_add(z[N + N2], carry2, &carry); + + if(carry) + for(u32bit j = 1; j != N2; ++j) + if(++z[N + N2 + j]) + break; + if((cmp0 == cmp1) || (cmp0 == 0) || (cmp1 == 0)) bigint_add2(z + N2, 2*N-N2, workspace, N); else @@ -97,13 +96,13 @@ void karatsuba_sqr(word z[], const word *************************************************/ void karatsuba_sqr(word z[], const word x[], u32bit N, word workspace[]) { - const u32bit KARATSUBA_SQR_LOWER_SIZE = BOTAN_KARAT_SQR_THRESHOLD; - if(N == 6) bigint_comba_sqr6(z, x); else if(N == 8) bigint_comba_sqr8(z, x); - else if(N < KARATSUBA_SQR_LOWER_SIZE || N % 2) + else if(N == 16) + bigint_comba_sqr16(z, x); + else if(N < BOTAN_KARAT_SQR_THRESHOLD || N % 2) bigint_simple_sqr(z, x, N); else { @@ -131,10 +130,31 @@ void karatsuba_sqr(word z[], const word karatsuba_sqr(z0, x0, N2, workspace+N); karatsuba_sqr(z1, x1, N2, workspace+N); - word carry = bigint_add3_nc(workspace+N, z0, N, z1, N); - carry += bigint_add2_nc(z + N2, N, workspace + N, N); - bigint_add2_nc(z + N + N2, N2, &carry, 1); + const u32bit blocks_of_8 = N - (N % 8); + word carry = 0; + + for(u32bit j = 0; j != blocks_of_8; j += 8) + carry = word8_add3(workspace + N + j, z0 + j, z1 + j, carry); + + for(u32bit j = blocks_of_8; j != N; ++j) + workspace[N + j] = word_add(z0[j], z1[j], &carry); + + word carry2 = 0; + + for(u32bit j = 0; j != blocks_of_8; j += 8) + carry2 = word8_add2(z + N2 + j, workspace + N + j, carry2); + + for(u32bit j = blocks_of_8; j != N; ++j) + z[N2 + j] = word_add(z[N2 + j], workspace[N + j], &carry2); + + z[N + N2] = word_add(z[N + N2], carry2, &carry); + + if(carry) + for(u32bit j = 1; j != N2; ++j) + if(++z[N + N2 + j]) + break; + if(cmp == 0) bigint_add2(z + N2, 2*N-N2, workspace, N); else @@ -214,97 +234,101 @@ u32bit karatsuba_size(u32bit z_size, u32 return 0; } +} + /************************************************* -* Handle small operand multiplies * +* Multiplication Algorithm Dispatcher * *************************************************/ -void handle_small_mul(word z[], u32bit z_size, - const word x[], u32bit x_size, u32bit x_sw, - const word y[], u32bit y_size, u32bit y_sw) +void bigint_mul(word z[], u32bit z_size, word workspace[], + const word x[], u32bit x_size, u32bit x_sw, + const word y[], u32bit y_size, u32bit y_sw) { - if(x_sw == 1) bigint_linmul3(z, y, y_sw, x[0]); - else if(y_sw == 1) bigint_linmul3(z, x, x_sw, y[0]); - + if(x_sw == 1) + { + bigint_linmul3(z, y, y_sw, x[0]); + } + else if(y_sw == 1) + { + bigint_linmul3(z, x, x_sw, y[0]); + } else if(x_sw <= 4 && x_size >= 4 && y_sw <= 4 && y_size >= 4 && z_size >= 8) + { bigint_comba_mul4(z, x, y); - + } else if(x_sw <= 6 && x_size >= 6 && y_sw <= 6 && y_size >= 6 && z_size >= 12) + { bigint_comba_mul6(z, x, y); - + } else if(x_sw <= 8 && x_size >= 8 && y_sw <= 8 && y_size >= 8 && z_size >= 16) + { bigint_comba_mul8(z, x, y); - + } + else if(x_sw <= 16 && x_size >= 16 && + y_sw <= 16 && y_size >= 16 && z_size >= 32) + { + bigint_comba_mul16(z, x, y); + } + else if(x_sw < BOTAN_KARAT_MUL_THRESHOLD || y_sw < BOTAN_KARAT_MUL_THRESHOLD) + bigint_simple_mul(z, x, x_sw, y, y_sw); else - bigint_simple_mul(z, x, x_sw, y, y_sw); + { + const u32bit N = karatsuba_size(z_size, x_size, x_sw, y_size, y_sw); + + if(N) + { + clear_mem(workspace, 2*N); + karatsuba_mul(z, x, y, N, workspace); + } + else + bigint_simple_mul(z, x, x_sw, y, y_sw); + } } /************************************************* -* Handle small operand squarings * +* Squaring Algorithm Dispatcher * *************************************************/ -void handle_small_sqr(word z[], u32bit z_size, - const word x[], u32bit x_size, u32bit x_sw) +void bigint_sqr(word z[], u32bit z_size, word workspace[], + const word x[], u32bit x_size, u32bit x_sw) { if(x_sw == 1) + { bigint_linmul3(z, x, x_sw, x[0]); + } else if(x_sw <= 4 && x_size >= 4 && z_size >= 8) + { bigint_comba_sqr4(z, x); + } else if(x_sw <= 6 && x_size >= 6 && z_size >= 12) + { bigint_comba_sqr6(z, x); + } else if(x_sw <= 8 && x_size >= 8 && z_size >= 16) + { bigint_comba_sqr8(z, x); - else - bigint_simple_sqr(z, x, x_sw); - } - -} - -/************************************************* -* Multiplication Algorithm Dispatcher * -*************************************************/ -void bigint_mul(word z[], u32bit z_size, word workspace[], - const word x[], u32bit x_size, u32bit x_sw, - const word y[], u32bit y_size, u32bit y_sw) - { - if(x_size <= 8 || y_size <= 8) + } + else if(x_sw <= 16 && x_size >= 16 && z_size >= 32) { - handle_small_mul(z, z_size, x, x_size, x_sw, y, y_size, y_sw); - return; + bigint_comba_sqr16(z, x); } - - const u32bit N = karatsuba_size(z_size, x_size, x_sw, y_size, y_sw); - - if(N) + else if(x_size < BOTAN_KARAT_SQR_THRESHOLD) { - clear_mem(workspace, 2*N); - karatsuba_mul(z, x, y, N, workspace); + bigint_simple_sqr(z, x, x_sw); } else - bigint_simple_mul(z, x, x_sw, y, y_sw); - } - -/************************************************* -* Squaring Algorithm Dispatcher * -*************************************************/ -void bigint_sqr(word z[], u32bit z_size, word workspace[], - const word x[], u32bit x_size, u32bit x_sw) - { - if(x_size <= 8 || x_sw <= 8) { - handle_small_sqr(z, z_size, x, x_size, x_sw); - return; - } + const u32bit N = karatsuba_size(z_size, x_size, x_sw); - const u32bit N = karatsuba_size(z_size, x_size, x_sw); - - if(N) - { - clear_mem(workspace, 2*N); - karatsuba_sqr(z, x, N, workspace); + if(N) + { + clear_mem(workspace, 2*N); + karatsuba_sqr(z, x, N, workspace); + } + else + bigint_simple_sqr(z, x, x_sw); } - else - bigint_simple_sqr(z, x, x_sw); } } ============================================================ --- botan/mp_misc.cpp ff006a9904ada45f0db8ca54f3ba1a6c06ffcf1d +++ botan/mp_misc.cpp 8273a346609d43aebbd2d6e80b4393a5b8b3d12b @@ -87,33 +87,6 @@ word bigint_modop(word n1, word n0, word return (n0-z); } -/************************************************* -* Do a word*word->2-word Multiply * -*************************************************/ -void bigint_wordmul(word a, word b, word* out_low, word* out_high) - { - const u32bit MP_HWORD_BITS = MP_WORD_BITS / 2; - const word MP_HWORD_MASK = ((word)1 << MP_HWORD_BITS) - 1; - - const word a_hi = (a >> MP_HWORD_BITS); - const word a_lo = (a & MP_HWORD_MASK); - const word b_hi = (b >> MP_HWORD_BITS); - const word b_lo = (b & MP_HWORD_MASK); - - word x0 = a_hi * b_hi; - word x1 = a_lo * b_hi; - word x2 = a_hi * b_lo; - word x3 = a_lo * b_lo; - - x2 += x3 >> (MP_HWORD_BITS); - x2 += x1; - if(x2 < x1) - x0 += ((word)1 << MP_HWORD_BITS); - - *out_high = x0 + (x2 >> MP_HWORD_BITS); - *out_low = ((x2 & MP_HWORD_MASK) << MP_HWORD_BITS) + (x3 & MP_HWORD_MASK); - } - } } ============================================================ --- botan/mp_mulop.cpp 200cfac1b97b27df16831d19eb69645c1a2c261b +++ botan/mp_mulop.cpp a2ed3fef04ba7328023cba1f053aecbd341eccc5 @@ -1,34 +1,72 @@ /************************************************* -* Multiply/Add Algorithm Source File * +* Simple O(N^2) Multiplication and Squaring * * (C) 1999-2008 Jack Lloyd * *************************************************/ #include #include #include +#include namespace Botan { extern "C" { /************************************************* -* Multiply/Add Words * +* Simple O(N^2) Multiplication * *************************************************/ -word bigint_mul_add_words(word z[], const word x[], u32bit x_size, word y) +void bigint_simple_mul(word z[], const word x[], u32bit x_size, + const word y[], u32bit y_size) { - const u32bit blocks = x_size - (x_size % 8); + const u32bit x_size_8 = x_size - (x_size % 8); - word carry = 0; + clear_mem(z, x_size + y_size); - for(u32bit j = 0; j != blocks; j += 8) - carry = word8_madd3(z + j, x + j, y, carry); + for(u32bit i = 0; i != y_size; ++i) + { + const word y_i = y[i]; - for(u32bit j = blocks; j != x_size; ++j) - z[j] = word_madd3(x[j], y, z[j], &carry); + word carry = 0; - return carry; + for(u32bit j = 0; j != x_size_8; j += 8) + carry = word8_madd3(z + i + j, x + j, y_i, carry); + + for(u32bit j = x_size_8; j != x_size; ++j) + z[i+j] = word_madd3(x[j], y_i, z[i+j], &carry); + + z[x_size+i] = carry; + } } +/************************************************* +* Simple O(N^2) Squaring + +This is exactly the same algorithm as bigint_simple_mul, +however because C/C++ compilers suck at alias analysis it +is good to have the version where the compiler knows +that x == y +*************************************************/ +void bigint_simple_sqr(word z[], const word x[], u32bit x_size) + { + const u32bit x_size_8 = x_size - (x_size % 8); + + clear_mem(z, 2*x_size); + + for(u32bit i = 0; i != x_size; ++i) + { + const word x_i = x[i]; + word carry = 0; + + for(u32bit j = 0; j != x_size_8; j += 8) + carry = word8_madd3(z + i + j, x + j, x_i, carry); + + for(u32bit j = x_size_8; j != x_size; ++j) + z[i+j] = word_madd3(x[j], x_i, z[i+j], &carry); + + z[x_size+i] = carry; + } + } + } } ============================================================ --- botan/mp_shift.cpp 262775e5dbf0aeadd5db4badd126586cb36811fb +++ botan/mp_shift.cpp 743c830923bf6a453520ddc726f5f248975a3074 @@ -47,21 +47,45 @@ void bigint_shr1(word x[], u32bit x_size if(word_shift) { - for(u32bit j = 0; j != x_size - word_shift; ++j) - x[j] = x[j + word_shift]; - for(u32bit j = x_size - word_shift; j != x_size; ++j) - x[j] = 0; + copy_mem(x, x + word_shift, x_size - word_shift); + clear_mem(x + x_size - word_shift, word_shift); } if(bit_shift) { word carry = 0; - for(u32bit j = x_size - word_shift; j > 0; --j) + + u32bit top = x_size - word_shift; + + while(top >= 4) { - word temp = x[j-1]; - x[j-1] = (temp >> bit_shift) | carry; - carry = (temp << (MP_WORD_BITS - bit_shift)); + word w = x[top-1]; + x[top-1] = (w >> bit_shift) | carry; + carry = (w << (MP_WORD_BITS - bit_shift)); + + w = x[top-2]; + x[top-2] = (w >> bit_shift) | carry; + carry = (w << (MP_WORD_BITS - bit_shift)); + + w = x[top-3]; + x[top-3] = (w >> bit_shift) | carry; + carry = (w << (MP_WORD_BITS - bit_shift)); + + w = x[top-4]; + x[top-4] = (w >> bit_shift) | carry; + carry = (w << (MP_WORD_BITS - bit_shift)); + + top -= 4; } + + while(top) + { + word w = x[top-1]; + x[top-1] = (w >> bit_shift) | carry; + carry = (w << (MP_WORD_BITS - bit_shift)); + + top--; + } } } @@ -78,9 +102,9 @@ void bigint_shl2(word y[], const word x[ word carry = 0; for(u32bit j = word_shift; j != x_size + word_shift + 1; ++j) { - word temp = y[j]; - y[j] = (temp << bit_shift) | carry; - carry = (temp >> (MP_WORD_BITS - bit_shift)); + word w = y[j]; + y[j] = (w << bit_shift) | carry; + carry = (w >> (MP_WORD_BITS - bit_shift)); } } } @@ -100,9 +124,9 @@ void bigint_shr2(word y[], const word x[ word carry = 0; for(u32bit j = x_size - word_shift; j > 0; --j) { - word temp = y[j-1]; - y[j-1] = (temp >> bit_shift) | carry; - carry = (temp << (MP_WORD_BITS - bit_shift)); + word w = y[j-1]; + y[j-1] = (w >> bit_shift) | carry; + carry = (w << (MP_WORD_BITS - bit_shift)); } } } ============================================================ --- botan/numthry.cpp 26bbca21b1899d7087075f15f7f67e7607faf17c +++ botan/numthry.cpp e936502b2b5badb8796d8310c6eb8988892eee2c @@ -1,9 +1,10 @@ /************************************************* * Number Theory Source File * -* (C) 1999-2007 Jack Lloyd * +* (C) 1999-2008 Jack Lloyd * *************************************************/ #include +#include #include namespace Botan { @@ -73,12 +74,27 @@ u32bit low_zero_bits(const BigInt& n) *************************************************/ u32bit low_zero_bits(const BigInt& n) { - if(n.is_zero()) return 0; + if(n.is_negative() || n.is_zero()) return 0; - u32bit bits = 0, max_bits = n.bits(); - while((n.get_bit(bits) == 0) && bits < max_bits) - ++bits; - return bits; + u32bit low_zero = 0; + + if(n.is_positive() && n.is_nonzero()) + { + for(u32bit i = 0; i != n.size(); ++i) + { + word x = n[i]; + + if(x) + { + low_zero += ctz(x); + break; + } + else + low_zero += BOTAN_MP_WORD_BITS; + } + } + + return low_zero; } /************************************************* ============================================================ --- botan/ofb.cpp 2709b09b27e6a7bb97f2de2fd6d52147df2cce25 +++ botan/ofb.cpp 681c98dfee9f23190273dac33b15a156cfdffd0a @@ -5,7 +5,7 @@ #include #include -#include +#include #include namespace Botan { ============================================================ --- botan/pkcs5.cpp 2e2f477f3f38ceae9f7fff0d52c12d4b32da6af1 +++ botan/pkcs5.cpp 2166d0b83a9f24484582a1082b3173a1af79aa91 @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include ============================================================ --- botan/policy.cpp 9d526c4dbe618044a2e577238d93418d07105cfe +++ botan/policy.cpp 7a812bca46419bfee2b0ae6243950a47448a78b6 @@ -242,128 +242,248 @@ void set_default_dl_groups(Library_State void set_default_dl_groups(Library_State& config) { config.set("dl", "modp/ietf/768", - "-----BEGIN X942 DH PARAMETERS-----" - "MIHIAmEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxObIlFK" - "CHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjo2IP//" - "////////AgECAmB//////////+SH7VEQtGEaYmMxRcBuDmiUgScERTPmOgEF31Md" - "ic2RKKUEPMcaAm73yozZ5p0hjZgVhTb5L4obp/Catrao4SLyQtq7MS8/Y3omIXTT" - "HRsQf/////////8=" - "-----END X942 DH PARAMETERS-----"); + "-----BEGIN X942 DH PARAMETERS-----" + "MIHIAmEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxObIlFK" + "CHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjo2IP//" + "////////AgECAmB//////////+SH7VEQtGEaYmMxRcBuDmiUgScERTPmOgEF31Md" + "ic2RKKUEPMcaAm73yozZ5p0hjZgVhTb5L4obp/Catrao4SLyQtq7MS8/Y3omIXTT" + "HRsQf/////////8=" + "-----END X942 DH PARAMETERS-----"); config.set("dl", "modp/ietf/1024", - "-----BEGIN X942 DH PARAMETERS-----" - "MIIBCgKBgQD//////////8kP2qIhaMI0xMZii4DcHNEpAk4IimfMdAILvqY7E5si" - "UUoIeY40BN3vlRmzzTpDGzArCm3yXxQ3T+E1bW1RwkXkhbV2Yl5+xvRMQummN+1r" - "C/9ctvQGt+3uOGv7Womfpa6fJBF8Sx/mSShmUezmU4H//////////wIBAgKBgH//" - "////////5IftURC0YRpiYzFFwG4OaJSBJwRFM+Y6AQXfUx2JzZEopQQ8xxoCbvfK" - "jNnmnSGNmBWFNvkvihun8Jq2tqjhIvJC2rsxLz9jeiYhdNMb9rWF/65begNb9vcc" - "Nf2tRM/S10+SCL4lj/MklDMo9nMpwP//////////" - "-----END X942 DH PARAMETERS-----"); + "-----BEGIN X942 DH PARAMETERS-----" + "MIIBCgKBgQD//////////8kP2qIhaMI0xMZii4DcHNEpAk4IimfMdAILvqY7E5si" + "UUoIeY40BN3vlRmzzTpDGzArCm3yXxQ3T+E1bW1RwkXkhbV2Yl5+xvRMQummN+1r" + "C/9ctvQGt+3uOGv7Womfpa6fJBF8Sx/mSShmUezmU4H//////////wIBAgKBgH//" + "////////5IftURC0YRpiYzFFwG4OaJSBJwRFM+Y6AQXfUx2JzZEopQQ8xxoCbvfK" + "jNnmnSGNmBWFNvkvihun8Jq2tqjhIvJC2rsxLz9jeiYhdNMb9rWF/65begNb9vcc" + "Nf2tRM/S10+SCL4lj/MklDMo9nMpwP//////////" + "-----END X942 DH PARAMETERS-----"); config.set("dl", "modp/ietf/1536", - "-----BEGIN X942 DH PARAMETERS-----" - "MIIBigKBwQD//////////8kP2qIhaMI0xMZii4DcHNEpAk4IimfMdAILvqY7E5si" - "UUoIeY40BN3vlRmzzTpDGzArCm3yXxQ3T+E1bW1RwkXkhbV2Yl5+xvRMQummN+1r" - "C/9ctvQGt+3uOGv7Womfpa6fJBF8Sx/mSShmUezkWz3CAHy4oWO/BZjaSDYcVdOa" - "aRY/qP0kz1+DZV0j3KOtlhxi81YghVK7ntUpB3CWlm1nDDVOSryYBPF0bAjKI3Mn" - "//////////8CAQICgcB//////////+SH7VEQtGEaYmMxRcBuDmiUgScERTPmOgEF" - "31Mdic2RKKUEPMcaAm73yozZ5p0hjZgVhTb5L4obp/Catrao4SLyQtq7MS8/Y3om" - "IXTTG/a1hf+uW3oDW/b3HDX9rUTP0tdPkgi+JY/zJJQzKPZyLZ7hAD5cULHfgsxt" - "JBsOKunNNIsf1H6SZ6/Bsq6R7lHWyw4xeasQQqldz2qUg7hLSzazhhqnJV5MAni6" - "NgRlEbmT//////////8=" - "-----END X942 DH PARAMETERS-----"); + "-----BEGIN X942 DH PARAMETERS-----" + "MIIBigKBwQD//////////8kP2qIhaMI0xMZii4DcHNEpAk4IimfMdAILvqY7E5si" + "UUoIeY40BN3vlRmzzTpDGzArCm3yXxQ3T+E1bW1RwkXkhbV2Yl5+xvRMQummN+1r" + "C/9ctvQGt+3uOGv7Womfpa6fJBF8Sx/mSShmUezkWz3CAHy4oWO/BZjaSDYcVdOa" + "aRY/qP0kz1+DZV0j3KOtlhxi81YghVK7ntUpB3CWlm1nDDVOSryYBPF0bAjKI3Mn" + "//////////8CAQICgcB//////////+SH7VEQtGEaYmMxRcBuDmiUgScERTPmOgEF" + "31Mdic2RKKUEPMcaAm73yozZ5p0hjZgVhTb5L4obp/Catrao4SLyQtq7MS8/Y3om" + "IXTTG/a1hf+uW3oDW/b3HDX9rUTP0tdPkgi+JY/zJJQzKPZyLZ7hAD5cULHfgsxt" + "JBsOKunNNIsf1H6SZ6/Bsq6R7lHWyw4xeasQQqldz2qUg7hLSzazhhqnJV5MAni6" + "NgRlEbmT//////////8=" + "-----END X942 DH PARAMETERS-----"); config.set("dl", "modp/ietf/2048", - "-----BEGIN X942 DH PARAMETERS-----" - "MIICDAKCAQEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb" - "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft" - "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT" - "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh" - "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq" - "5RXSJhiY+gUQFXKOWoqsqmj//////////wIBAgKCAQB//////////+SH7VEQtGEa" - "YmMxRcBuDmiUgScERTPmOgEF31Mdic2RKKUEPMcaAm73yozZ5p0hjZgVhTb5L4ob" - "p/Catrao4SLyQtq7MS8/Y3omIXTTG/a1hf+uW3oDW/b3HDX9rUTP0tdPkgi+JY/z" - "JJQzKPZyLZ7hAD5cULHfgsxtJBsOKunNNIsf1H6SZ6/Bsq6R7lHWyw4xeasQQqld" - "z2qUg7hLSzazhhqnJV5MAni6NgRlDBC+GUgvIxcbZx3xzzuWDAdDAc2TwdF2A9FH" - "2uKu+DemKWTvFeX7SqwLjBzKpL51SrVyiukTDEx9AogKuUctRVZVNH//////////" - "-----END X942 DH PARAMETERS-----"); + "-----BEGIN X942 DH PARAMETERS-----" + "MIICDAKCAQEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb" + "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft" + "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT" + "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh" + "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq" + "5RXSJhiY+gUQFXKOWoqsqmj//////////wIBAgKCAQB//////////+SH7VEQtGEa" + "YmMxRcBuDmiUgScERTPmOgEF31Mdic2RKKUEPMcaAm73yozZ5p0hjZgVhTb5L4ob" + "p/Catrao4SLyQtq7MS8/Y3omIXTTG/a1hf+uW3oDW/b3HDX9rUTP0tdPkgi+JY/z" + "JJQzKPZyLZ7hAD5cULHfgsxtJBsOKunNNIsf1H6SZ6/Bsq6R7lHWyw4xeasQQqld" + "z2qUg7hLSzazhhqnJV5MAni6NgRlDBC+GUgvIxcbZx3xzzuWDAdDAc2TwdF2A9FH" + "2uKu+DemKWTvFeX7SqwLjBzKpL51SrVyiukTDEx9AogKuUctRVZVNH//////////" + "-----END X942 DH PARAMETERS-----"); config.set("dl", "modp/ietf/3072", - "-----BEGIN X942 DH PARAMETERS-----" - "MIIDDAKCAYEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb" - "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft" - "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT" - "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh" - "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq" - "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM" - "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq" - "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqTrS" - "yv//////////AgECAoIBgH//////////5IftURC0YRpiYzFFwG4OaJSBJwRFM+Y6" - "AQXfUx2JzZEopQQ8xxoCbvfKjNnmnSGNmBWFNvkvihun8Jq2tqjhIvJC2rsxLz9j" - "eiYhdNMb9rWF/65begNb9vccNf2tRM/S10+SCL4lj/MklDMo9nItnuEAPlxQsd+C" - "zG0kGw4q6c00ix/UfpJnr8GyrpHuUdbLDjF5qxBCqV3PapSDuEtLNrOGGqclXkwC" - "eLo2BGUMEL4ZSC8jFxtnHfHPO5YMB0MBzZPB0XYD0Ufa4q74N6YpZO8V5ftKrAuM" - "HMqkvnVKtXKK6RMMTH0CiAq5Ry1FVWIW1pmLhoIoPRnUKpDV745dMnZ9woIsbfeF" - "RXU4q66DBj7Zy4fC03DyY9X610ZthJnrj0ZKcCUSsM7ncekTDWl3NfiX/QNsxQQy" - "bDsBOZ9kNTIpD5WMC72QBl3wi6u9MK62O4TEYF1so3EEcSfQOnLVmKHtrf5wfohH" - "JcFokFSdaWV//////////w==" - "-----END X942 DH PARAMETERS-----"); + "-----BEGIN X942 DH PARAMETERS-----" + "MIIDDAKCAYEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb" + "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft" + "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT" + "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh" + "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq" + "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM" + "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq" + "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqTrS" + "yv//////////AgECAoIBgH//////////5IftURC0YRpiYzFFwG4OaJSBJwRFM+Y6" + "AQXfUx2JzZEopQQ8xxoCbvfKjNnmnSGNmBWFNvkvihun8Jq2tqjhIvJC2rsxLz9j" + "eiYhdNMb9rWF/65begNb9vccNf2tRM/S10+SCL4lj/MklDMo9nItnuEAPlxQsd+C" + "zG0kGw4q6c00ix/UfpJnr8GyrpHuUdbLDjF5qxBCqV3PapSDuEtLNrOGGqclXkwC" + "eLo2BGUMEL4ZSC8jFxtnHfHPO5YMB0MBzZPB0XYD0Ufa4q74N6YpZO8V5ftKrAuM" + "HMqkvnVKtXKK6RMMTH0CiAq5Ry1FVWIW1pmLhoIoPRnUKpDV745dMnZ9woIsbfeF" + "RXU4q66DBj7Zy4fC03DyY9X610ZthJnrj0ZKcCUSsM7ncekTDWl3NfiX/QNsxQQy" + "bDsBOZ9kNTIpD5WMC72QBl3wi6u9MK62O4TEYF1so3EEcSfQOnLVmKHtrf5wfohH" + "JcFokFSdaWV//////////w==" + "-----END X942 DH PARAMETERS-----"); config.set("dl", "modp/ietf/4096", - "-----BEGIN X942 DH PARAMETERS-----" - "MIIEDAKCAgEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb" - "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft" - "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT" - "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh" - "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq" - "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM" - "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq" - "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqSEI" - "ARpyPBKnh+bXiHGaEL26WyaZwycYavTiPBqUaDS2FQvaJYPpyirUTOjbu8LbBN6O" - "+S6O/BQfvsqmKHxZR05rwF2ZspZPoJDDoiM7oYZRW+ftH2EpcM7i16+4G912IXBI" - "HNAGkSfVsFqpk7TqmI2P3cGG/7fckKbAj030Nck0BjGZ//////////8CAQICggIA" - "f//////////kh+1RELRhGmJjMUXAbg5olIEnBEUz5joBBd9THYnNkSilBDzHGgJu" - "98qM2eadIY2YFYU2+S+KG6fwmra2qOEi8kLauzEvP2N6JiF00xv2tYX/rlt6A1v2" - "9xw1/a1Ez9LXT5IIviWP8ySUMyj2ci2e4QA+XFCx34LMbSQbDirpzTSLH9R+kmev" - "wbKuke5R1ssOMXmrEEKpXc9qlIO4S0s2s4YapyVeTAJ4ujYEZQwQvhlILyMXG2cd" - "8c87lgwHQwHNk8HRdgPRR9rirvg3pilk7xXl+0qsC4wcyqS+dUq1corpEwxMfQKI" - "CrlHLUVVYhbWmYuGgig9GdQqkNXvjl0ydn3Cgixt94VFdTirroMGPtnLh8LTcPJj" - "1frXRm2EmeuPRkpwJRKwzudx6RMNaXc1+Jf9A2zFBDJsOwE5n2Q1MikPlYwLvZAG" - "XfCLq70wrrY7hMRgXWyjcQRxJ9A6ctWYoe2t/nB+iEclwWiQVJCEAI05HglTw/Nr" - "xDjNCF7dLZNM4ZOMNXpxHg1KNBpbCoXtEsH05RVqJnRt3eFtgm9HfJdHfgoP32VT" - "FD4so6c14C7M2Usn0Ehh0RGd0MMorfP2j7CUuGdxa9fcDe67ELgkDmgDSJPq2C1U" - "ydp1TEbH7uDDf9vuSFNgR6b6GuSaAxjM//////////8=" - "-----END X942 DH PARAMETERS-----"); + "-----BEGIN X942 DH PARAMETERS-----" + "MIIEDAKCAgEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb" + "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft" + "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT" + "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh" + "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq" + "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM" + "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq" + "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqSEI" + "ARpyPBKnh+bXiHGaEL26WyaZwycYavTiPBqUaDS2FQvaJYPpyirUTOjbu8LbBN6O" + "+S6O/BQfvsqmKHxZR05rwF2ZspZPoJDDoiM7oYZRW+ftH2EpcM7i16+4G912IXBI" + "HNAGkSfVsFqpk7TqmI2P3cGG/7fckKbAj030Nck0BjGZ//////////8CAQICggIA" + "f//////////kh+1RELRhGmJjMUXAbg5olIEnBEUz5joBBd9THYnNkSilBDzHGgJu" + "98qM2eadIY2YFYU2+S+KG6fwmra2qOEi8kLauzEvP2N6JiF00xv2tYX/rlt6A1v2" + "9xw1/a1Ez9LXT5IIviWP8ySUMyj2ci2e4QA+XFCx34LMbSQbDirpzTSLH9R+kmev" + "wbKuke5R1ssOMXmrEEKpXc9qlIO4S0s2s4YapyVeTAJ4ujYEZQwQvhlILyMXG2cd" + "8c87lgwHQwHNk8HRdgPRR9rirvg3pilk7xXl+0qsC4wcyqS+dUq1corpEwxMfQKI" + "CrlHLUVVYhbWmYuGgig9GdQqkNXvjl0ydn3Cgixt94VFdTirroMGPtnLh8LTcPJj" + "1frXRm2EmeuPRkpwJRKwzudx6RMNaXc1+Jf9A2zFBDJsOwE5n2Q1MikPlYwLvZAG" + "XfCLq70wrrY7hMRgXWyjcQRxJ9A6ctWYoe2t/nB+iEclwWiQVJCEAI05HglTw/Nr" + "xDjNCF7dLZNM4ZOMNXpxHg1KNBpbCoXtEsH05RVqJnRt3eFtgm9HfJdHfgoP32VT" + "FD4so6c14C7M2Usn0Ehh0RGd0MMorfP2j7CUuGdxa9fcDe67ELgkDmgDSJPq2C1U" + "ydp1TEbH7uDDf9vuSFNgR6b6GuSaAxjM//////////8=" + "-----END X942 DH PARAMETERS-----"); + config.set("dl", "modp/ietf/6144", + "-----BEGIN X942 DH PARAMETERS-----" + "MIIGDAKCAwEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb" + "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft" + "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT" + "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh" + "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq" + "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM" + "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq" + "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqSEI" + "ARpyPBKnh+bXiHGaEL26WyaZwycYavTiPBqUaDS2FQvaJYPpyirUTOjbu8LbBN6O" + "+S6O/BQfvsqmKHxZR05rwF2ZspZPoJDDoiM7oYZRW+ftH2EpcM7i16+4G912IXBI" + "HNAGkSfVsFqpk7TqmI2P3cGG/7fckKbAj030Nck0AoSSNsP6tNJ8cCbB1NyyYCZG" + "3sl1HnY9uje9+P+UBq2eUw7l2zgvQTABrrBqU+2QJ9gxF5cnsIZaiRjaPtvrz5sU" + "7UTObLrO1Lsb238UR+bMJUszIFFRK9evQm+49AE3jNK/WYPKAcZLkuzwMuoV0XId" + "A/SC185udP721V5wL0aYDIK1qEAxkAscnlnnyX++x+jzI6l6fjbMiL4PHUW3/1ha" + "xUvUB7IrQVSqzI9tfr9I4dgUzF7SD4A34KeXFe7ym+MoBqHVi7fF2nb1UKo9ih+/" + "8OsZzLGjE9Vc2lbJ7C7yljI4f+jXbjwEaAQ+j2Y/SGDuEr8tWwt0dNbmlPkebcxA" + "JP//////////AoIDAH//////////5IftURC0YRpiYzFFwG4OaJSBJwRFM+Y6AQXf" + "Ux2JzZEopQQ8xxoCbvfKjNnmnSGNmBWFNvkvihun8Jq2tqjhIvJC2rsxLz9jeiYh" + "dNMb9rWF/65begNb9vccNf2tRM/S10+SCL4lj/MklDMo9nItnuEAPlxQsd+CzG0k" + "Gw4q6c00ix/UfpJnr8GyrpHuUdbLDjF5qxBCqV3PapSDuEtLNrOGGqclXkwCeLo2" + "BGUMEL4ZSC8jFxtnHfHPO5YMB0MBzZPB0XYD0Ufa4q74N6YpZO8V5ftKrAuMHMqk" + "vnVKtXKK6RMMTH0CiAq5Ry1FVWIW1pmLhoIoPRnUKpDV745dMnZ9woIsbfeFRXU4" + "q66DBj7Zy4fC03DyY9X610ZthJnrj0ZKcCUSsM7ncekTDWl3NfiX/QNsxQQybDsB" + "OZ9kNTIpD5WMC72QBl3wi6u9MK62O4TEYF1so3EEcSfQOnLVmKHtrf5wfohHJcFo" + "kFSQhACNOR4JU8Pza8Q4zQhe3S2TTOGTjDV6cR4NSjQaWwqF7RLB9OUVaiZ0bd3h" + "bYJvR3yXR34KD99lUxQ+LKOnNeAuzNlLJ9BIYdERndDDKK3z9o+wlLhncWvX3A3u" + "uxC4JA5oA0iT6tgtVMnadUxGx+7gw3/b7khTYEem+hrkmgFCSRth/VppPjgTYOpu" + "WTATI29kuo87Ht0b3vx/ygNWzymHcu2cF6CYANdYNSn2yBPsGIvLk9hDLUSMbR9t" + "9efNinaiZzZdZ2pdje2/iiPzZhKlmZAoqJXr16E33HoAm8ZpX6zB5QDjJcl2eBl1" + "Cui5DoH6QWvnNzp/e2qvOBejTAZBWtQgGMgFjk8s8+S/32P0eZHUvT8bZkRfB46i" + "2/+sLWKl6gPZFaCqVWZHtr9fpHDsCmYvaQfAG/BTy4r3eU3xlANQ6sXb4u07eqhV" + "HsUP3/h1jOZY0Ynqrm0rZPYXeUsZHD/0a7ceAjQCH0ezH6Qwdwlflq2Fujprc0p8" + "jzbmIBJ//////////wIBAg==" + "-----END X942 DH PARAMETERS-----"); + + config.set("dl", "modp/ietf/8192", + "-----BEGIN X942 DH PARAMETERS-----" + "MIIIDAKCBAEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb" + "IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft" + "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT" + "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh" + "fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq" + "5RXSJhiY+gUQFXKOWoqqxC2tMxcNBFB6M6hVIavfHLpk7PuFBFjb7wqK6nFXXQYM" + "fbOXD4Wm4eTHq/WujNsJM9cejJTgSiVhnc7j0iYa0u5r8S/6BtmKCGTYdgJzPshq" + "ZFIfKxgXeyAMu+EXV3phXWx3CYjAutlG4gjiT6B05asxQ9tb/OD9EI5LgtEgqSEI" + "ARpyPBKnh+bXiHGaEL26WyaZwycYavTiPBqUaDS2FQvaJYPpyirUTOjbu8LbBN6O" + "+S6O/BQfvsqmKHxZR05rwF2ZspZPoJDDoiM7oYZRW+ftH2EpcM7i16+4G912IXBI" + "HNAGkSfVsFqpk7TqmI2P3cGG/7fckKbAj030Nck0AoSSNsP6tNJ8cCbB1NyyYCZG" + "3sl1HnY9uje9+P+UBq2eUw7l2zgvQTABrrBqU+2QJ9gxF5cnsIZaiRjaPtvrz5sU" + "7UTObLrO1Lsb238UR+bMJUszIFFRK9evQm+49AE3jNK/WYPKAcZLkuzwMuoV0XId" + "A/SC185udP721V5wL0aYDIK1qEAxkAscnlnnyX++x+jzI6l6fjbMiL4PHUW3/1ha" + "xUvUB7IrQVSqzI9tfr9I4dgUzF7SD4A34KeXFe7ym+MoBqHVi7fF2nb1UKo9ih+/" + "8OsZzLGjE9Vc2lbJ7C7yljI4f+jXbjwEaAQ+j2Y/SGDuEr8tWwt0dNbmlPkebb4R" + "WXSjkm8S/uXkOHd8tqky34zYvsTQc7kxujvIMraNndMAdB+nv4r8R+0ldvaTa6Qk" + "ZjqrY5xa5PVoNCO0dCvxyXgjjxbL451lLeP9uL78hIrZIiIuBKQDfAcT61eoGiPw" + "xzRz/GRs6jBrS8vIhi+Dhd36nUt/osCH6HloMwPtW906Bis89bOieKZtKhP4P0T4" + "Ld8xDuB0q2o2RZfomaAlXcFk8xzFCEaFHfmrSBld7X6hsdUQvX7nTXP682vDHs+i" + "aDWQRvTrh5+SQAlDi0gcbNeImgAu1e44K8kZDab8Am5HlVjkR1Z36aqeMFDidlaU" + "38gfVuiAuW5xYMmA3Zjt09///////////wKCBAB//////////+SH7VEQtGEaYmMx" + "RcBuDmiUgScERTPmOgEF31Mdic2RKKUEPMcaAm73yozZ5p0hjZgVhTb5L4obp/Ca" + "trao4SLyQtq7MS8/Y3omIXTTG/a1hf+uW3oDW/b3HDX9rUTP0tdPkgi+JY/zJJQz" + "KPZyLZ7hAD5cULHfgsxtJBsOKunNNIsf1H6SZ6/Bsq6R7lHWyw4xeasQQqldz2qU" + "g7hLSzazhhqnJV5MAni6NgRlDBC+GUgvIxcbZx3xzzuWDAdDAc2TwdF2A9FH2uKu" + "+DemKWTvFeX7SqwLjBzKpL51SrVyiukTDEx9AogKuUctRVViFtaZi4aCKD0Z1CqQ" + "1e+OXTJ2fcKCLG33hUV1OKuugwY+2cuHwtNw8mPV+tdGbYSZ649GSnAlErDO53Hp" + "Ew1pdzX4l/0DbMUEMmw7ATmfZDUyKQ+VjAu9kAZd8IurvTCutjuExGBdbKNxBHEn" + "0Dpy1Zih7a3+cH6IRyXBaJBUkIQAjTkeCVPD82vEOM0IXt0tk0zhk4w1enEeDUo0" + "GlsKhe0SwfTlFWomdG3d4W2Cb0d8l0d+Cg/fZVMUPiyjpzXgLszZSyfQSGHREZ3Q" + "wyit8/aPsJS4Z3Fr19wN7rsQuCQOaANIk+rYLVTJ2nVMRsfu4MN/2+5IU2BHpvoa" + "5JoBQkkbYf1aaT44E2DqblkwEyNvZLqPOx7dG978f8oDVs8ph3LtnBegmADXWDUp" + "9sgT7BiLy5PYQy1EjG0fbfXnzYp2omc2XWdqXY3tv4oj82YSpZmQKKiV69ehN9x6" + "AJvGaV+sweUA4yXJdngZdQrouQ6B+kFr5zc6f3tqrzgXo0wGQVrUIBjIBY5PLPPk" + "v99j9HmR1L0/G2ZEXweOotv/rC1ipeoD2RWgqlVmR7a/X6Rw7ApmL2kHwBvwU8uK" + "93lN8ZQDUOrF2+LtO3qoVR7FD9/4dYzmWNGJ6q5tK2T2F3lLGRw/9Gu3HgI0Ah9H" + "sx+kMHcJX5athbo6a3NKfI823wisulHJN4l/cvIcO75bVJlvxmxfYmg53JjdHeQZ" + "W0bO6YA6D9PfxX4j9pK7e0m10hIzHVWxzi1yerQaEdo6FfjkvBHHi2XxzrKW8f7c" + "X35CRWyRERcCUgG+A4n1q9QNEfhjmjn+MjZ1GDWl5eRDF8HC7v1Opb/RYEP0PLQZ" + "gfat7p0DFZ562dE8UzaVCfwfonwW75iHcDpVtRsiy/RM0BKu4LJ5jmKEI0KO/NWk" + "DK72v1DY6ohev3Omuf15teGPZ9E0GsgjenXDz8kgBKHFpA42a8RNABdq9xwV5IyG" + "034BNyPKrHIjqzv01U8YKHE7K0pv5A+rdEBctziwZMBuzHbp7///////////AgEC" + "-----END X942 DH PARAMETERS-----"); + config.set("dl", "dsa/jce/512", - "-----BEGIN DSA PARAMETERS-----" - "MIGdAkEA/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQT" - "xeEu0ImbzRMqzVDZkVG9xD7nN1kuFwIVAJYu3cw2nLqOuyYO5rahJtk0bjjFAkEA" - "3gtU76vylwh+5iPVylWIxkgo70/eT/uuHs0gBndrBbEbgeo83pvDlkwWh8UyW/Q9" - "fM76DQqGvl3/3dDRFD3NdQ==" - "-----END DSA PARAMETERS-----"); + "-----BEGIN DSA PARAMETERS-----" + "MIGdAkEA/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQT" + "xeEu0ImbzRMqzVDZkVG9xD7nN1kuFwIVAJYu3cw2nLqOuyYO5rahJtk0bjjFAkEA" + "3gtU76vylwh+5iPVylWIxkgo70/eT/uuHs0gBndrBbEbgeo83pvDlkwWh8UyW/Q9" + "fM76DQqGvl3/3dDRFD3NdQ==" + "-----END DSA PARAMETERS-----"); config.set("dl", "dsa/jce/768", - "-----BEGIN DSA PARAMETERS-----" - "MIHdAmEA6eZCWZ01XzfJf/01ZxILjiXJzUPpJ7OpZw++xdiQFBki0sOzrSSACTeZ" - "hp0ehGqrSfqwrSbSzmoiIZ1HC859d31KIfvpwnC1f2BwAvPO+Dk2lM9F7jaIwRqM" - "VqsSej2vAhUAnNvYTJ8awvOND4D0KrlS5zOL9RECYQDe7p717RUWzn5pXmcrjO5F" - "5s17NuDmOF+JS6hhY/bz5sbU6KgRRtQBfe/dccvZD6Akdlm4i3zByJT0gmn9Txqs" - "CjBTjf9rP8ds+xMcnnlltYhYqwpDtVczWRKoqlR/lWg=" - "-----END DSA PARAMETERS-----"); + "-----BEGIN DSA PARAMETERS-----" + "MIHdAmEA6eZCWZ01XzfJf/01ZxILjiXJzUPpJ7OpZw++xdiQFBki0sOzrSSACTeZ" + "hp0ehGqrSfqwrSbSzmoiIZ1HC859d31KIfvpwnC1f2BwAvPO+Dk2lM9F7jaIwRqM" + "VqsSej2vAhUAnNvYTJ8awvOND4D0KrlS5zOL9RECYQDe7p717RUWzn5pXmcrjO5F" + "5s17NuDmOF+JS6hhY/bz5sbU6KgRRtQBfe/dccvZD6Akdlm4i3zByJT0gmn9Txqs" + "CjBTjf9rP8ds+xMcnnlltYhYqwpDtVczWRKoqlR/lWg=" + "-----END DSA PARAMETERS-----"); config.set("dl", "dsa/jce/1024", - "-----BEGIN DSA PARAMETERS-----" - "MIIBHgKBgQD9f1OBHXUSKVLfSpwu7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9" - "jVj6v8X1ujD2y5tVbNeBO4AdNG/yZmC3a5lQpaSfn+gEexAiwk+7qdf+t8Yb+DtX" - "58aophUPBPuD9tPFHsMCNVQTWhaRMvZ1864rYdcq7/IiAxmd0UgBxwIVAJdgUI8V" - "IwvMspK5gqLrhAvwWBz1AoGARpYDUS4wJ4zTlHWV2yLuyYJqYyKtyXNE9B10DDJX" - "JMj577qn1NgD/4xgnc0QDrxb38+tfGpCX66nhuogUOvpg1HqH9of3yTWlHqmuaoj" - "dmlTgC9NfUqOy6BtGXaKJJH/sW0O+cQ6mbX3FnL/bwoktETQc20E04oaEyLa9s3Y" - "jJ0=" - "-----END DSA PARAMETERS-----"); + "-----BEGIN DSA PARAMETERS-----" + "MIIBHgKBgQD9f1OBHXUSKVLfSpwu7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9" + "jVj6v8X1ujD2y5tVbNeBO4AdNG/yZmC3a5lQpaSfn+gEexAiwk+7qdf+t8Yb+DtX" + "58aophUPBPuD9tPFHsMCNVQTWhaRMvZ1864rYdcq7/IiAxmd0UgBxwIVAJdgUI8V" + "IwvMspK5gqLrhAvwWBz1AoGARpYDUS4wJ4zTlHWV2yLuyYJqYyKtyXNE9B10DDJX" + "JMj577qn1NgD/4xgnc0QDrxb38+tfGpCX66nhuogUOvpg1HqH9of3yTWlHqmuaoj" + "dmlTgC9NfUqOy6BtGXaKJJH/sW0O+cQ6mbX3FnL/bwoktETQc20E04oaEyLa9s3Y" + "jJ0=" + "-----END DSA PARAMETERS-----"); + + config.set("dl", "dsa/botan/2048", + "-----BEGIN DSA PARAMETERS-----" + "MIICLAKCAQEAkcSKT9+898Aq6V59oSYSK13Shk9Vm4fo50oobVL1m9HeaN/WRdDg" + "DGDAgAMYkZgDdO61lKUyv9Z7mgnqxLhmOgeRDmjzlGX7cEDSXfE5MuusQ0elMOy6" + "YchU+biA08DDZgCAWHxFVm2t4mvVo5S+CTtMDyS1r/747GxbPlf7iQJam8FnaZMh" + "MeFtPJTvyrGNDfBhIDzFPmEDvHLVWUv9QMplOA9EqahR3LB1SV/AM6ilgHGhvXj+" + "BS9mVVZI60txnSr+i0iA+NrW8VgYuhePiSdMhwvpuW6wjEbEAEDMLv4d+xsYaN0x" + "nePDSjKmOrbrEiQgmkGWgMx5AtFyjU354QIhAIzX1FD4bwrZTu5M5GmodW0evRBY" + "JBlD6v+ws1RYXpJNAoIBAA2fXgdhtNvRgz1qsalhoJlsXyIwP3LYTBQPZ8Qx2Uq1" + "cVvqgaDJjTnOS8941rnryJXTT+idlAkdWEhhXvFfXobxHZb2yWniA936WDVkIKSc" + "tES1lbkBqTPP4HZ7WU8YoHt/kd7NukRriJkPePL/kfL+fNQ/0uRtGOraH3u2YCxh" + "f27zpLKE8v2boQo2BC3o+oeiyjZZf+yBFXoUheRAQd8CgwERy4gLvm7UlIFIhvll" + "zcMTX1zPE4Nyi/ZbgG+WksCxDWxMCcdabKO0ATyxarLBBfa+I66pAA6rIXiYX5cs" + "mAV+HIbkTnIYaI6krg82NtzKdFydzU5q/7Z8y8E9YTE=" + "-----END DSA PARAMETERS-----"); + + config.set("dl", "dsa/botan/3072", + "-----BEGIN DSA PARAMETERS-----" + "MIIDLAKCAYEA5LUIgHWWY1heFCRgyi2d/xMviuTIQN2jomZoiRJP5WOLhOiim3rz" + "+hIJvmv8S1By7Tsrc4e68/hX9HioAijvNgC3az3Pth0g00RlslBtLK+H3259wM6R" + "vS0Wekb2rcwxxTHk+cervbkq3fNbCoBsZikqX14X6WTdCZkDczrEKKs12A6m9oW/" + "uovkBo5UGK5eytno/wc94rY+Tn6tNciptwtb1Hz7iNNztm83kxk5sKtxvVWVgJCG" + "2gFVM30YWg5Ps2pRmxtiArhZHmACRJzxzTpmOE9tIHOxzXO+ypO68eGmEX0COPIi" + "rh7X/tGFqJDn9n+rj+uXU8wTSlGD3+h64llfe1wtn7tCJJ/dWVE+HTOWs+sv2GaE" + "8oWoRI/nV6ApiBxAdguU75Gb35dAw4OJWZ7FGm6btRmo4GhJHpzgovz+PLYNZs8N" + "+tIKjsaEBIaEphREV1vRck1zUrRKdgB3s71r04XOWwpyUMwL92jagpI4Buuc+7E4" + "hDcxthggjHWbAiEAs+vTZOxp74zzuvZDt1c0sWM5suSeXN4bWcHp+0DuDFsCggGA" + "K+0h7vg5ZKIwrom7px2ffDnFL8gim047x+WUTTKdoQ8BDqyee69sAJ/E6ylgcj4r" + "Vt9GY+TDrIAOkljeL3ZJ0gZ4KJP4Ze/KSY0u7zAHTqXop6smJxKk2UovOwuaku5A" + "D7OKPMWaXcfkNtXABLIuNQKDgbUck0B+sy1K4P1Cy0XhLQ7O6KJiOO3iCCp7FSIR" + "PGbO+NdFxs88uUX4TS9N4W1Epx3hmCcOE/A1U8iLjTI60LlIob8hA6lJl5tu0W+1" + "88lT2Vt8jojKZ9z1pjb7nKOdkkIV96iE7Wx+48ltjZcVQnl0t8Q1EoLhPTdz99KL" + "RS8QiSoTx1hzKN6kgntrNpsqjcFyrcWD9R8qZZjFSD5bxGewL5HQWcQC0Y4sJoD3" + "dqoG9JKAoscsF8xC1bbnQMXEsas8UcLtCSviotiwU65Xc9FCXtKwjwbi3VBZLfGk" + "eMFVkc39EVZP+I/zi3IdQjkv2kcyEtz9jS2IqXagCv/m//tDCjWeZMorNRyiQSOU" + "-----END DSA PARAMETERS-----"); } - } /************************************************* ============================================================ --- botan/primes.cpp b59b2733974c522887b7c271fff8975502e613dd +++ botan/primes.cpp d3f6a25e1bb8734a71e24c6df0a35e7d66ddce55 @@ -605,69 +605,70 @@ const u64bit PRIME_PRODUCTS[PRIME_PRODUC 65437, 65447, 65449, 65479, 65497, 65519, 65521, 0 }; const u64bit PRIME_PRODUCTS[PRIME_PRODUCTS_TABLE_SIZE] = { -0xE221F97C30E94E1DULL, 0xE5B65ED6608B952DULL, 0xF4521CE5D3CA44EFULL, 0xF3EF021E44A7EEC3ULL, -0xF330D66E4349E591ULL, 0x6F6B8463BEE90825ULL, 0xD41D1350609EC855ULL, 0x28681D7AA3190143ULL, -0x2FA51D379842A4AFULL, 0x84AE694AFD8B0547ULL, 0xC7AC609EF16A407BULL, 0xCA376556426DE0FDULL, -0x466324A8372A45D5ULL, 0xAD7D2FB14BF7DC0BULL, 0x7BCD9BF6C6C26323ULL, 0x74709A2A2637FA55ULL, -0x1D640B8FE0CA4311ULL, 0xC93804EEC683CB2DULL, 0xB10594307EA0B7ADULL, 0xDE0244E8F6D2DC17ULL, -0x61DE0343443ED4C5ULL, 0xCF8D577CE72384BBULL, 0x217168EC6F4A928BULL, 0xF5446BCD87F96E6BULL, -0xF7E12D023D06E73DULL, 0x457CBC7E43B62C3FULL, 0x5AE2F68DB28800BFULL, 0x7500EDA80A9C8EA7ULL, -0x8DBC07E86DC4A37FULL, 0x9E40BF0300CA232DULL, 0xC0A9D8342259FCD1ULL, 0xDFE8B5D19367A1C5ULL, -0xFBC11439E02B209DULL, 0xDA0AC1EC9E251F43ULL, 0xAB4E5F28D129622FULL, 0xEBF5FBCBF5587CBDULL, -0xE26B31744B05DC9DULL, 0xE1580FBB4592700BULL, 0x6539F95C9D74F439ULL, 0xB185EF6E9070A559ULL, -0x699ECA919029B14BULL, 0xEBBFC2CC1B0DEE0FULL, 0x8E19279CEAF709FBULL, 0xFA3F354C954330EFULL, -0xAE9362C721216DEFULL, 0xF44253878D02F03DULL, 0xC2D98B01DFE4F3A9ULL, 0xE4A3E0F9407ED71FULL, -0xAE2E9D8F67A52865ULL, 0xF7DEE3EE2D340885ULL, 0xCC1D2DEA66C3C841ULL, 0xA827E8CE4BF5EB07ULL, -0xDF26E6009081BE79ULL, 0x1969811A2B7A6A93ULL, 0x88D31B077DEEB8A3ULL, 0xA15E37A8F401B5C1ULL, -0xB27BF45E6508617BULL, 0xE23D5CA287D9A531ULL, 0xD33CEF8D08A70D3FULL, 0xF26E164CB7B477D5ULL, -0xF070DAE24D8CEDA9ULL, 0x4F580C6048999F4DULL, 0xFBC528EEE00D6CFBULL, 0xE47E34CA3E3EAC63ULL, -0xE2421086C3D09FE5ULL, 0xC35091E86806D213ULL, 0x1F29F3BD0BE9FAB3ULL, 0xFA21995FB84F5A83ULL, -0xBBF6D8395F7047C7ULL, 0xBC28039A69726205ULL, 0xF0324199A11B5D45ULL, 0x969FA74E537EBE09ULL, -0xA474F6C127403A9DULL, 0xEBB6153629ECDEA7ULL, 0xC96E2D7B65D2277BULL, 0xD2B89C851CD9291FULL, -0xEABE76C706F0C3E5ULL, 0xB997188EA5B710D3ULL, 0xB5B20274A0DABB6FULL, 0x89D99F7F39AB2B9BULL, -0x138C3AC887043CCDULL, 0xC6D3E2761D16233FULL, 0x507C4D00D6B6027FULL, 0xBF363571906180F3ULL, -0x89FEA18355BD571DULL, 0xF55905D2F8949905ULL, 0x65F170475F041C6FULL, 0x94C6E638460936A1ULL, -0x809F449762D125EFULL, 0xAC4BC4C3547A71E1ULL, 0xF9315948183BDBC5ULL, 0xC383E883DEA0349BULL, -0xBC33CFE86CA38435ULL, 0xC413C74E3F6F847BULL, 0xE25488813C3CE121ULL, 0xFD33CDA8A0333BEFULL, -0xEDCCA470B26DA57FULL, 0x383533808BD74477ULL, 0x3AC02A15FC89C54DULL, 0x3E12CC83606624F3ULL, -0xAB899B62C0938D01ULL, 0x429DC254C5490571ULL, 0xF5554C6D540DB6A9ULL, 0xFE3F5CCCBAFFDC95ULL, -0xF20E8ABC0340C14FULL, 0xBD633919AA5AB02FULL, 0x532A1FA4D0775045ULL, 0x9F3F943B5D1E6679ULL, -0xA14E33555E99605DULL, 0xC48A6E1EC3CF4793ULL, 0xD00AC683F6B64DB9ULL, 0xB7316C602F3F2DDBULL, -0xABF8EF8B5CABB03DULL, 0xFFCAA72EE6539255ULL, 0xC1CB903C8D764FB7ULL, 0x80300B3B06A6F3F3ULL, -0xC7471C73A380A4AFULL, 0x892E6D86008F82E3ULL, 0x8D040C52D7C6AB79ULL, 0xD35DE032B89A6907ULL, -0xD1CD5A93959C1185ULL, 0xB87C36644FB9B3B7ULL, 0xA827E6B6DE68593FULL, 0xAC16DC9E966EA68FULL, -0xB3E87100AC54DE6DULL, 0xB98014BDAE7021B1ULL, 0xBE350E0F484524D1ULL, 0xC6172BCEA3A11C9BULL, -0xCC01BFD8F5EE2EC3ULL, 0xD1B284C91EED248BULL, 0xFDFF2DE1B95F5687ULL, 0xE21A13779E0CCDC7ULL, -0xE68E732A2ABED62FULL, 0xEC8F38C8B28E0493ULL, 0xF52BDF080F7ABA6FULL, 0xFF40ECA3CCA22CE5ULL, -0x215D0693AD933EB1ULL, 0xBE2B9B2F8ECD578DULL, 0x843F6BF5D2BBF979ULL, 0xCACD47144DAADA59ULL, -0xF19D26474F170045ULL, 0x7A6BA19CE2FBBCD9ULL, 0x525620BB14320123ULL, 0xEBABCCACEACE2A81ULL, -0xDAD688DAC863D2F3ULL, 0x70CF888F6F02D4BBULL, 0xD3EBE9A16C01996FULL, 0xED449526CBEBE513ULL, -0x991DD50C7F17A1B7ULL, 0xD1F37E54FC6589EFULL, 0xB1B72FDE0EA34AFFULL, 0xBF1D75BDDED44FD1ULL, -0xD101DC5EAA25201BULL, 0xDF60F18616AD8EFBULL, 0xED74888F36648FBBULL, 0xFD5051BD895D6539ULL, -0xCCEBE44FA3E6B1BDULL, 0xD52A16F9E33265CBULL, 0xEDD3384401AD1267ULL, 0xF3CC98549791076FULL, -0x6EF7899720A0A93BULL, 0x7DB9EF3F5256F38FULL, 0x9273910ABDE6E503ULL, 0xA3B446CA98554091ULL, -0xB13C2BDE8958E05DULL, 0xBEFA82CB25F97AF1ULL, 0xCDC1FE0211DF150FULL, 0xE32387464B225385ULL, -0xF154C4C2CA8EABF9ULL, 0xCF4E11D8E56F6957ULL, 0xF7BBB96118B42F15ULL, 0x535138221347C85DULL, -0x4FFC85B96C562A71ULL, 0x6C6FD444704EE9A9ULL, 0x81319E967E1AABB3ULL, 0x948BE6486434303BULL, -0xAADD17A4C60E2449ULL, 0xD619D14A9A0B5FBDULL, 0xE2FB3F507D8C64B5ULL, 0xFCFCE80D5BB997DFULL, -0xB08106E9D93A99ADULL, 0x238E12AE75BF1861ULL, 0xE0F83D2ED5DC8AC3ULL, 0x681FF3CFE90D481BULL, -0x805517DDD3E296E7ULL, 0x9BDBC365E2E9E57FULL, 0xBAE52C39C9082107ULL, 0xF09928EC4A4C1503ULL, -0xF26340D17F990C75ULL, 0x97299F4F32B7DB6BULL, 0xC6E38417C7E30011ULL, 0xF582B6E0E6B7830FULL, -0xD0D046F74D1ED633ULL, 0xBEE06A041F778E5DULL, 0xDBE53BF49C3CF227ULL, 0xF9F4E4C91D1537F1ULL, -0xA838BFF645C41F0FULL, 0x458809A605C2264BULL, 0x62C07D00B5C7B939ULL, 0x8F303208051AF4EFULL, -0xCE366281B21E7AFDULL, 0xE750611EA0BE8B55ULL, 0xAACF9921F54349DDULL, 0xB9499C919BEDEB2DULL, -0x8B5E2D6A7C0FED8DULL, 0xB31C12531D85C86BULL, 0xE2F81DD567C198EDULL, 0xFCBF50872C7A85B7ULL, -0xA7C97479B562C749ULL, 0xDBBB14BBF9B4AC85ULL, 0xC69D26F25DEA581DULL, 0xFA3CC64F8D79398DULL, -0x8703AEE0630C7FEFULL, 0xB272C207BD08D637ULL, 0xC50A96A2C6C59C23ULL, 0xFB6694D346303AB1ULL, -0x93F2BA15512C7BE9ULL, 0x7ED5EB28F50A553FULL, 0xB9BB9C7AA9343BD3ULL, 0xE711EA83362E3FEBULL, -0xC417BB9B3F863C89ULL, 0x96A88B47EE3AAB49ULL, 0xDF3ED601F5DCCE23ULL, 0xB211874BB8720877ULL, -0x6F3E9B69CB1BDCDBULL, 0x9B295CC8FEBC20D5ULL, 0xE56F23F76A71387FULL, 0xEA78F5BB0CD1565FULL, -0xA4A428E418FD2B17ULL, 0xDEEF3C10065A26E1ULL, 0x2D1E8F5735933B8DULL, 0xF362A62EB7E3B551ULL, -0xF62327AE7D4E70A5ULL, 0x28B86F69D6FCA5B5ULL, 0x87C63FAA3E25406BULL, 0xD659246185DA101DULL, -0xC10B2CF6559274B7ULL, 0x727BF31FFF9B208BULL, 0xEA55235C4B98064DULL, 0xFBCD0B3F56EABA75ULL, -0xFB0D12857E554175ULL, 0xECC6FD2C8F45CC2FULL, 0xFAE200BB2687381BULL, 0x7C0001DFD91FDB5BULL, -0xDEE61AC82000895BULL, 0x9536C4399D4F3FB7ULL, 0xA8F1E698E4A3297FULL, 0xFA61F6759A6CEE8FULL, -0xCBAE83BF32730B03ULL, 0xDC7C6D1FB9E1633BULL, 0xF12CAF2A95AA8807ULL, 0xDF9CC7A9C8FFEF4DULL, -0xD0744F8438C2E907ULL, 0xB0DA65AB5BB20619ULL, 0x1C0C79A379CFBF8DULL, 0x93AC2BC1F9EC0E29ULL }; +0xFF658BDE2F2A43DF, 0xFEEB94CD535119ED, 0xFA921839EC24DDD5, 0xFDDA766C77E1E605, +0xFF3024B0EB4EE333, 0xFEEE350BBC92F4DF, 0xFFC724B7D011D01B, 0xFEED34B826C33B05, +0xFE69D8DE3F85C6E3, 0xFE3B48909250918F, 0xFF8EC0CE9C632429, 0xFFD92A5C78226D6B, +0xFFB4BFB0C65133CF, 0xFE77113704902C57, 0xFF8A21D222EA81FD, 0xFEDA1299661CF5AB, +0xFF4CE86187737D0D, 0xFFD26443A07F519D, 0xFFA817B7191D7967, 0xFF00EDC142868873, +0xFFB9C6D7F7A239B7, 0xFFE76D3481E98E39, 0xFF76D5432584120D, 0xFFAA499F071EC705, +0xFEB5198F05722E59, 0xFF7E0431CA41107F, 0xFFCFD52FEDDC928F, 0xFE0EA42537BC6ABF, +0xFF64937896876925, 0xFC6FC87E811607D3, 0xFFBF600E6CDD0F4F, 0xFF022700FE658243, +0xFF2E21166779D6B9, 0xFFC224624C665C33, 0xFF1372F41FF177AD, 0xFF31E57E972D0C13, +0xFFA891F866404D23, 0xFF7BF13EF716E9A3, 0xFE51CAFD9466E733, 0xFDA1CF55F6D6336F, +0xFFAF6C040ED0950F, 0xFFAA1725F40BA269, 0xFEC593BC3570BEEB, 0xFEE05B35B426F413, +0xFFCA5209A08890F9, 0xFFED8AF70EB0CC89, 0xFF3F98E3E27860A5, 0xFF92FECD017FF9F7, +0xFEFA655B2609018F, 0xFFFC51D15AAC7B77, 0xFEF5007E71420DB1, 0xFFEC4784141332D1, +0xFE8384ED4E1D21CD, 0xFFD3FF614D3ECC47, 0xFFDE5166FD540313, 0xFF5320ECED04B26F, +0xFF223980F122FF75, 0xFF19C1F27CB1B4A5, 0xFF0F1DFC9DA9523B, 0xFF82DE7B387F5427, +0xFF9A026BA87314E3, 0xFFAC7FF3ACE64E77, 0xFF808EB2FD5873C3, 0xFE983ED5BB363301, +0xFF714856DB2CFE95, 0xFF84E1510CF3EB9F, 0xFF29D04C1DA0B115, 0xFFBCF3BF9433552F, +0xFF32203D58A4C473, 0xFFF00910A15021C3, 0xFDE93041F28240AD, 0xFFC518BCD81C03C5, +0xFEF504CD8BB9CBDD, 0xFEB8FFBFFF116A6B, 0xFF7642E0785ADA23, 0xFFECF068800FD50D, +0xFFD703577CA247A7, 0xFF54C0ECAD2C9691, 0xFFC031706B8C72F5, 0xFFE59E5CA58BBDF5, +0xFFF31FAFFD3B331D, 0xFF64DDF32349FF6D, 0xFFE38309D0BD4A51, 0xFF8C934F76B3C737, +0xFFDC80B4BAEAFC1F, 0xFFCC1FE4C856FBD9, 0xFFDB5976DDF601FD, 0xFFD3DD25F424433D, +0xFFC00FA367E746C7, 0xFFE08BF011CC854F, 0xFFC3F21982468F6D, 0xFFDA6C52478A76DF, +0xFFC67D95AADED363, 0xFFD605D18C3AFC65, 0xFFE828C9D698F1DF, 0xFFBE5098D83B7737, +0xFF79EB34474ABFB9, 0xFFD27AEED0786363, 0xFFD0FE27B77C271F, 0xFFFBB6563BD065EF, +0xFFF3638F8635E1EB, 0xFFBE862C22C9F065, 0xFF44712D8488A01D, 0xFF7EEC97F9913111, +0xFFC23CC78CB12AB1, 0xFFF390FE85F81D3D, 0xFFE8EA21A0FB9931, 0xFFB9D42D17A93385, +0xFFCDB63AB21E904D, 0xFF5EB7F2210D33DF, 0xFFE6F6C7BB60C9DF, 0xFFAD4CA8DC26D699, +0xFF7BE75BD21DCA51, 0xFEF89CE23CB61789, 0xFF40ECA3CCA22CE5, 0xF52BDF080F7ABA6F, +0xEC8F38C8B28E0493, 0xE68E732A2ABED62F, 0xE21A13779E0CCDC7, 0xD823C075C325191B, +0xD1B284C91EED248B, 0xCBA5A08068E8C1F7, 0xC483EE5A2228985D, 0xBCAEE9F787AC75EB, +0xB782DAB1B77D3E09, 0xB0D77226F15E387B, 0xAA2A8727D47941CD, 0xA4A45682E9CE533D, +0x9CAF15AF4CE7FCF7, 0x94C051DD15537305, 0x9006D2FBD933A297, 0x8C4DED05F19B7399, +0x884FD7A270AD1B1B, 0x83C687D33F238D4B, 0xFF62E2BAE50C6C16, 0x7A59E1FD9D203DBB, +0x764F1DC07B0E442D, 0x72732FE1F2023153, 0x6E373B550764872F, 0x680FFFD267C5F3FF, +0x6206BFEC14F1CFC5, 0x5FA6F70CFD587265, 0x5CC7A1B4F6DF9823, 0x599291B29311407F, +0xFF3CEBD359B67EF9, 0x51C573C14F289F6D, 0x4FA265B31B73C6DF, 0x4B3154ACBD077DED, +0x4785C96B29A1E437, 0x451F887F646CF763, 0x429DC254C5490571, 0x408410840EAE2883, +0x3E12CC83606624F3, 0x3A70D774B821DA71, 0x37A21449A196A825, 0x34C5D056E2278B81, +0xFA0C6CAB29D8E297, 0x2FA5AEC982A5972B, 0x2D6831749426068F, 0x2B7F876418155CA7, +0x2A1B897ED2AB433D, 0x28C9430D0F92132F, 0x26DF879EBF12E103, 0xFD2FAB4CA364D43B, +0x22B5B4FC40D4C35F, 0x209298AA84D7E6A1, 0x1ED4B9F11445F1E7, 0x1DC6D2DD416CC91D, +0x1C1517A52E37C3EF, 0x1A808916125AEF2F, 0x197A2FB2938FF13D, 0x1814AA6C087B561D, +0xFB3B173E72947609, 0x1571187A8E3D4D6B, 0x13D306D29263C139, 0xF8AEC6ADA137E865, +0x123EA204BAB48731, 0x11012099D202F297, 0x10290E15797C21BD, 0x0F3AB38E679D6317, +0xF50B5505D593FCF9, 0xFF23754F7F2052B5, 0x0CC52D96BC2E5A2D, 0x0BF80EAD87B228E5, +0x0B59A623082C9171, 0xF44E28B9221A433B, 0x09DB5CDD2505EABD, 0x09638C123BCAB351, +0xFDB9AE6935254CD3, 0xFFE30D7E4F02F163, 0x07CF1FC053B9C61F, 0x0789244FF1705821, +0x06FBD05649B0B9C7, 0xEF9713EC6A0C250B, 0xF47691AD6AA9F0DB, 0xF2A8EB02CB08CA51, +0xF9559D40380A20E1, 0x04E15138A5B9BF43, 0xEECD739EA48F3ABB, 0xF76E7E7530574E79, +0xF8393D2E42D7D277, 0xF666F9AD3A16D173, 0xF403C629749F3ED5, 0xFBD7EC45F220A473, +0xFA8AFF7491B234FD, 0xFF471CE534D1F537, 0xF4BEBFDD9C54CEC9, 0xDD04722310A6CE9D, +0xFD8071236214FA05, 0xFBCA07B399A482DD, 0xFD9642C104864C17, 0xFA525105AADEFA39, +0xF71122156406E645, 0xFF415FDFD1247539, 0xFB709936F52446AF, 0xFF7734CCB806CDA7, +0xF801E9A88CD3D70D, 0xFC0C00AC9BCC5491, 0xFF462CD8E52ED221, 0xFC97426300FCE331, +0xFEB3049C5E37A059, 0xFFFC8AB1E05051CD, 0xFE5F4621F2D9FE63, 0xFE931DB54FC5D521, +0xFFDE43D960FE42A5, 0xFFDBFAD1B802BDB5, 0xFF23C485F6B7BF53, 0xFFC98F169C8DF21B, +0xF1609D0E2E564D01, 0xCB10B976C333834B, 0x9B52037A38DAB8F9, 0x800E88FF5E929095, +0x55A9AD1C21F5E173, 0x3D1A64E4E555D699, 0x2A5D1D73694F7B93, 0x198F4260D8807623, +0x140D45BB525C35EB, 0x102F4743FF914EEB, 0x0CB114936A734FBF, 0x096D97150B7B0A71, +0x06F06B90B850C2E5, 0x053B17A0D7F7386B, 0xE3AD1CE3C82FE6A5, 0xDAE968B4B710E857, +0xFA2DC15B2C96BE77, 0xF1FF5F22AF135BD9, 0xFC65C5CAAA878A13, 0xFB9427EB08CF9C11, +0xCCB12B6FEBFE285D, 0x5BAADA462B48F999, 0x2E53167EC64B703B, 0x1264ED670CD61961, +0x071F216A9AB74E2D, 0xEE26503C1266CE55, 0x4C6004C7E404E4B5, 0xCB649E41ECE95F85 +}; } ============================================================ --- botan/pubkey.h 0247408d58d07d5f440ad7850fe51b7ef2ee99c6 +++ botan/pubkey.h e4865d610b63f28b9c531f0ec39666da9da2c30c @@ -67,6 +67,9 @@ class BOTAN_DLL PK_Signer PK_Signer(const PK_Signing_Key&, const std::string&); ~PK_Signer() { delete emsa; } private: + PK_Signer(const PK_Signer&); + PK_Signer& operator=(const PK_Signer&); + const PK_Signing_Key& key; Signature_Format sig_format; EMSA* emsa; @@ -101,6 +104,9 @@ class BOTAN_DLL PK_Verifier Signature_Format sig_format; EMSA* emsa; + private: + PK_Verifier(const PK_Verifier&); + PK_Verifier& operator=(const PK_Verifier&); }; /************************************************* @@ -116,6 +122,9 @@ class BOTAN_DLL PK_Key_Agreement PK_Key_Agreement(const PK_Key_Agreement_Key&, const std::string&); private: + PK_Key_Agreement(const PK_Key_Agreement_Key&); + PK_Key_Agreement& operator=(const PK_Key_Agreement&); + const PK_Key_Agreement_Key& key; const std::string kdf_name; }; @@ -127,9 +136,14 @@ class BOTAN_DLL PK_Encryptor_MR_with_EME { public: u32bit maximum_input_size() const; + PK_Encryptor_MR_with_EME(const PK_Encrypting_Key&, const std::string&); ~PK_Encryptor_MR_with_EME() { delete encoder; } + private: + PK_Encryptor_MR_with_EME(const PK_Encryptor_MR_with_EME&); + PK_Encryptor_MR_with_EME& operator=(const PK_Encryptor_MR_with_EME&); + SecureVector enc(const byte[], u32bit, RandomNumberGenerator& rng) const; @@ -146,7 +160,11 @@ class BOTAN_DLL PK_Decryptor_MR_with_EME PK_Decryptor_MR_with_EME(const PK_Decrypting_Key&, const std::string&); ~PK_Decryptor_MR_with_EME() { delete encoder; } private: + PK_Decryptor_MR_with_EME(const PK_Decryptor_MR_with_EME&); + PK_Decryptor_MR_with_EME& operator=(const PK_Decryptor_MR_with_EME&); + SecureVector dec(const byte[], u32bit) const; + const PK_Decrypting_Key& key; const EME* encoder; }; @@ -159,6 +177,9 @@ class BOTAN_DLL PK_Verifier_with_MR : pu public: PK_Verifier_with_MR(const PK_Verifying_with_MR_Key&, const std::string&); private: + PK_Verifier_with_MR(const PK_Verifying_with_MR_Key&); + PK_Verifier_with_MR& operator=(const PK_Verifier_with_MR&); + bool validate_signature(const MemoryRegion&, const byte[], u32bit); u32bit key_message_parts() const { return key.message_parts(); } u32bit key_message_part_size() const { return key.message_part_size(); } @@ -174,6 +195,9 @@ class BOTAN_DLL PK_Verifier_wo_MR : publ public: PK_Verifier_wo_MR(const PK_Verifying_wo_MR_Key&, const std::string&); private: + PK_Verifier_wo_MR(const PK_Verifying_wo_MR_Key&); + PK_Verifier_wo_MR& operator=(const PK_Verifier_wo_MR&); + bool validate_signature(const MemoryRegion&, const byte[], u32bit); u32bit key_message_parts() const { return key.message_parts(); } u32bit key_message_part_size() const { return key.message_part_size(); } ============================================================ --- botan/randpool.cpp 5bb4f7eb52feaeb4765b28deffe9ece75360503f +++ botan/randpool.cpp 0e268299e1cacd6828323786637fe3b3db84c94e @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include ============================================================ --- botan/rsa.cpp cb60f3202e08edaf7232aaeef434c80b2277a765 +++ botan/rsa.cpp d72a3996d9cad6b2b0e9a57169588db05889d331 @@ -55,7 +55,7 @@ RSA_PrivateKey::RSA_PrivateKey(RandomNum RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng, u32bit bits, u32bit exp) { - if(bits < 1024) + if(bits < 512) throw Invalid_Argument(algo_name() + ": Can't make a key that is only " + to_string(bits) + " bits long"); if(exp < 3 || exp % 2 == 0) ============================================================ --- botan/secmem.h c48a5f061675316513a401c61bf8472434700a0c +++ botan/secmem.h a418b80e88b96c9eefecce580ce3e37d623878e0 @@ -61,7 +61,7 @@ class MemoryRegion void destroy() { create(0); } void create(u32bit); - void grow_to(u32bit) const; + void grow_to(u32bit); void swap(MemoryRegion&); ~MemoryRegion() { deallocate(buf, allocated); } @@ -78,18 +78,18 @@ class MemoryRegion void init(bool locking, u32bit length = 0) { alloc = Allocator::get(locking); create(length); } private: - T* allocate(u32bit n) const + T* allocate(u32bit n) { return static_cast(alloc->allocate(sizeof(T)*n)); } - void deallocate(T* p, u32bit n) const + void deallocate(T* p, u32bit n) { alloc->deallocate(p, sizeof(T)*n); } - mutable T* buf; - mutable u32bit used; - mutable u32bit allocated; - mutable Allocator* alloc; + T* buf; + u32bit used; + u32bit allocated; + Allocator* alloc; }; /************************************************* @@ -108,7 +108,7 @@ template * Increase the size of the buffer * *************************************************/ template -void MemoryRegion::grow_to(u32bit n) const +void MemoryRegion::grow_to(u32bit n) { if(n > used && n <= allocated) { ============================================================ --- botan/symkey.cpp adb7a25bf9a2ac40a8452841264c3fa107e9e169 +++ botan/symkey.cpp efe2e7138ff6446b841f7497cd2d6a5040118cbd @@ -4,7 +4,7 @@ *************************************************/ #include -#include +#include #include #include #include ============================================================ --- botan/thanks.txt 93da5eb93daf816bacf92d9cc834f872bd5e3f23 +++ botan/thanks.txt 25adffa4ebf208a08ead80fbce865a0d26541439 @@ -22,6 +22,8 @@ In addition, the following people have unknowingly contributed help: + Dean Gaudet wrote the SSE2 implementation of SHA-1 + The implementation of DES is based off a public domain implementation by Phil Karn from 1994 (he, in turn, credits Richard Outerbridge and Jim Gillogly). ============================================================ --- botan/ui.h edc430aa1261dacfab65cf5bf004f0ba1c264340 +++ botan/ui.h 97d42335be645d069e4a23c78781726ca1bdbd0c @@ -25,7 +25,7 @@ class BOTAN_DLL User_Interface User_Interface(const std::string& = ""); virtual ~User_Interface() {} protected: - const std::string preset_passphrase; + std::string preset_passphrase; mutable bool first_try; }; ============================================================ --- botan/util.cpp 22c31923a7cfbe9a5f5d0ec9dcb8cfe2e4e9648d +++ botan/util.cpp eb2b4db0bff74cce366fde7f7e6c34f930cdb58b @@ -29,23 +29,39 @@ u32bit round_down(u32bit n, u32bit align } /************************************************* -* Return the work required for solving DL * +* Choose the exponent size for a DL group *************************************************/ -u32bit dl_work_factor(u32bit n_bits) +u32bit dl_work_factor(u32bit bits) { +#if 0 + /* + These values were taken from RFC 3526 + */ + if(bits <= 1536) + return 90; + else if(bits <= 2048) + return 110; + else if(bits <= 3072) + return 130; + else if(bits <= 4096) + return 150; + else if(bits <= 6144) + return 170; + else if(bits <= 8192) + return 190; + return 256; +#else const u32bit MIN_ESTIMATE = 64; - if(n_bits < 32) - return 0; + const double log_x = bits / 1.44; - const double log_x = n_bits / 1.44; - const double strength = 2.76 * std::pow(log_x, 1.0/3.0) * std::pow(std::log(log_x), 2.0/3.0); if(strength > MIN_ESTIMATE) return static_cast(strength); return MIN_ESTIMATE; +#endif } /************************************************* ============================================================ --- botan/x931_rng.cpp 9ef7dc6b27bd1b5186d94c696a2cbf393b323420 +++ botan/x931_rng.cpp 2b9ec05c85c31eab16269186014707ba3a7c36b1 @@ -5,7 +5,7 @@ #include #include -#include +#include #include namespace Botan { ============================================================ --- transforms.cc 737711aeeaf9f03df41eef35d8b6842d5f72a7fe +++ transforms.cc 2092c216aedf25334650b90041aaafd22cefb243 @@ -58,15 +58,11 @@ error_in_transform(Botan::Exception & e) static inline void error_in_transform(Botan::Exception & e) { - // why do people make up their own out-of-memory exceptions? - if (typeid(e) == typeid(Botan::Memory_Exhaustion)) - throw std::bad_alloc(); - // these classes can all indicate data corruption - else if (typeid(e) == typeid(Botan::Encoding_Error) - || typeid(e) == typeid(Botan::Decoding_Error) - || typeid(e) == typeid(Botan::Stream_IO_Error) - || typeid(e) == typeid(Botan::Integrity_Failure)) + if (typeid(e) == typeid(Botan::Encoding_Error) + || typeid(e) == typeid(Botan::Decoding_Error) + || typeid(e) == typeid(Botan::Stream_IO_Error) + || typeid(e) == typeid(Botan::Integrity_Failure)) { // clean up the what() string a little: throw away the // "botan: TYPE: " part...