diff options
author | lloyd <[email protected]> | 2010-03-09 02:39:31 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-09 02:39:31 +0000 |
commit | 4a9afbb99bb73e43bcb3a30379d6a2dd59dae76a (patch) | |
tree | 4f7a362be278ed63828afeae56444afcbf0b2dac /checks | |
parent | a4df64935b788e541206547d5d85665c191e2f5f (diff) |
Deconstify PK_Ops. It's quite reasonable that some op will want to
precompute only as needed, or will want to access some other expensive
resource or etc.
Change how the secret for generating blinding is done in cases where a
PRNG isn't available. Use the operations public op to hide the secret,
for instance the seed for a DH blinding variable is 2^x mod p.
Make use of being able to mutate internal structures in the RW signer,
since that does have access to a PRNG, so use it to initialize the
blinder on first call to sign().
Diffstat (limited to 'checks')
-rw-r--r-- | checks/pk.cpp | 21 | ||||
-rw-r--r-- | checks/pk_valid.dat | 40 |
2 files changed, 34 insertions, 27 deletions
diff --git a/checks/pk.cpp b/checks/pk.cpp index f0343afec..bc1308f1c 100644 --- a/checks/pk.cpp +++ b/checks/pk.cpp @@ -161,14 +161,14 @@ void validate_encryption(PK_Encryptor& e, PK_Decryptor& d, } void validate_signature(PK_Verifier& v, PK_Signer& s, const std::string& algo, - const std::string& input, const std::string& random, + const std::string& input, + RandomNumberGenerator& rng, const std::string& exp, bool& failure) { SecureVector<byte> message = decode_hex(input); SecureVector<byte> expected = decode_hex(exp); - Fixed_Output_RNG rng(decode_hex(random)); SecureVector<byte> sig = s.sign_message(message, message.size(), rng); if(sig != expected) @@ -194,6 +194,16 @@ void validate_signature(PK_Verifier& v, PK_Signer& s, const std::string& algo, } } +void validate_signature(PK_Verifier& v, PK_Signer& s, const std::string& algo, + const std::string& input, + const std::string& random, + const std::string& exp, bool& failure) + { + Fixed_Output_RNG rng(decode_hex(random)); + + validate_signature(v, s, algo, input, rng, exp, failure); + } + void validate_kas(PK_Key_Agreement& kas, const std::string& algo, const SecureVector<byte>& pubkey, const std::string& output, u32bit keylen, bool& failure) @@ -397,8 +407,6 @@ u32bit validate_rw_ver(const std::string& algo, if(str.size() != 5) throw std::runtime_error("Invalid input from pk_valid.dat"); - - #if defined(BOTAN_HAS_RW) RW_PublicKey key(to_bigint(str[1]), to_bigint(str[0])); @@ -421,10 +429,9 @@ u32bit validate_rw_sig(const std::string& algo, const std::vector<std::string>& str, RandomNumberGenerator& rng) { - if(str.size() != 6) + if(str.size() != 5) throw std::runtime_error("Invalid input from pk_valid.dat"); - #if defined(BOTAN_HAS_RW) RW_PrivateKey privkey(rng, to_bigint(str[1]), to_bigint(str[2]), to_bigint(str[0])); @@ -436,7 +443,7 @@ u32bit validate_rw_sig(const std::string& algo, PK_Signer s(privkey, emsa); bool failure = false; - validate_signature(v, s, algo, str[3], str[4], str[5], failure); + validate_signature(v, s, algo, str[3], rng, str[4], failure); return (failure ? 1 : 0); #endif diff --git a/checks/pk_valid.dat b/checks/pk_valid.dat index fbf3c3b45..40bd830c2 100644 --- a/checks/pk_valid.dat +++ b/checks/pk_valid.dat @@ -3642,12 +3642,12 @@ D2F20D5BB1E28D6A0D3D722B2F044670B20530FD1F7983513D7F3527A662571A3AE98E1DAFF9403\ 5EFFC02FD41C583E1CBDA53C1821BB79FB392D68A4524B0F65EBB64FF6656C52BF54D5774DF2D91\ 6C9B793E206E0D5351D7B4D18DE3CA4CCFA8F7A3ABFB36048C9297F7512B3FDA70F7 -# RW Format: exponent:p:q:message:nonce:output +# RW Format: exponent:p:q:message:output [RW/EMSA2(SHA-1)] 2:\ F21624A28732743BBE9B1A2B320CA31EF4A127456547ACDF5C523995E25A990B:\ BC6EDE730E7CEC8993A6E6296EA8DFBBC7D46615122F23F635FF988E284E31CF:\ -5075752E::\ +5075752E:\ 44CB3C6CD992A656AC2D8C92E044FCCC60FAA1B47FE153E7BA4B647136DA4A42\ 88BD50FB0935E3B9180AF477F8B88E1EA1106569CCAB8D354E0A7E3AC92D70B3 @@ -3655,7 +3655,7 @@ BC6EDE730E7CEC8993A6E6296EA8DFBBC7D46615122F23F635FF988E284E31CF:\ F2E5CDF6CA7387C132242CE031CEC8FE2CEAFA8530EC9795F16605B1CBD97BCB:\ DA330E4440FE5CD00A37A738DDFBDD5623A31FAE273AD98E41DA0D3DB937CEBF:\ 4C6F7665207375636B732E20556E7265717569746564206C6F7665207375636B\ -73206D6F72652E::\ +73206D6F72652E:\ 5AB035B8E6415D691951DBCEACC6A61987599000A590A414363BF52FB95C5BAB\ C12812152C5BCBC6A443C68B971EE0AA5E864C9FF9ABE0A85BB86FA544239958 @@ -3663,21 +3663,21 @@ C12812152C5BCBC6A443C68B971EE0AA5E864C9FF9ABE0A85BB86FA544239958 13CE5CDF6CA7387C132242CE031CEC8FE2CEAFA8530EC9795F16605B1CBD978A3:\ 14FE360AA550965F93CE76E4B01F55FBFDD7A049B2761817505CB6959A73A4C07:\ 4C6F7665207375636B732E20556E7265717569746564206C6F7665207375636B7\ -3206D6F72652E::\ +3206D6F72652E:\ 0085AC363AEA57F36E348936599A77167BAF17194D250787F347C710019558A9F\ 773DDC25A2216DA694D38E03CAA4F7423BDF03DB0E75161221906222FC9E0F23D 2:\ 1947A060ECFEFA3F8DDED8AE580D45B02D82DE108496AFC322FFD14EA02B7BFE3:\ 1E1384A66A21500DEE4DC2B36F43EF398B1C50BDEE7600CD4340B663471F0F16F:\ -4A65737369652048616E68616D20697320612064616D6E2063757465206769726C::\ +4A65737369652048616E68616D20697320612064616D6E2063757465206769726C:\ 00BE5B2A5EE3CB613ABE4548C856F6C8F8B4B9EAD3795675E59E4DDC4A015D019\ 2F29B6352CDD913C289961BE57F84005F0BBD3AE7E2BBE73DABC50B2201923CC0 2:\ 1AA83F51426F2BDA398221C48E8D322EF66D59098D0418E0C2B06DE6EA2F97D33:\ 1E4C7924C9E6D7ABDB372B112601D4C091FAE6C8FEB518595DF436FE9B354E26F:\ -492077616E742061206472696E6B2E204E6F772E::\ +492077616E742061206472696E6B2E204E6F772E:\ 010E8838216B05B4C2739B65AB2A7ABC114A046E3CD37CF1E97815ECA53750B1B\ F486A9BA684B9FE2D983BBA5F9D97565F0DCF6A5176C169EC67B6BB6C9616CEA6 @@ -3685,7 +3685,7 @@ F486A9BA684B9FE2D983BBA5F9D97565F0DCF6A5176C169EC67B6BB6C9616CEA6 22C9D42C6803B9AC87F641E9465D300DE8898694427D138761C4A5B121B0632DB:\ 25DA5C05701C99EDDF0FBAA61DCDBA404C05D860DD539E06B0AECA7E56354DEA7:\ 54657374696E6720766172696F7573206B657973697A657320666F72205257207\ -369676E6174757265733A2035313220746F203531392C20616E642031303234::\ +369676E6174757265733A2035313220746F203531392C20616E642031303234:\ 0191F1BA45BC571445612D8C1A7818B52DFF78566E6CCFF7AB55B2F35FA21210C\ 951F171E27A2921032718AE01BB4F209164BA0B21A5842D1925B35D09C7538050 @@ -3693,7 +3693,7 @@ F486A9BA684B9FE2D983BBA5F9D97565F0DCF6A5176C169EC67B6BB6C9616CEA6 388F732F05B06F5BA10816242E8F75A000E235C97174F57931E8D845442147F8B:\ 2F3758EBE44182841FB1743D3BA6AEEC0AEC5758660E1DB37C818199B90A1A307:\ 54657374696E6720766172696F7573206B657973697A657320666F72205257207\ -369676E6174757265733A2035313220746F203531392C20616E642031303234::\ +369676E6174757265733A2035313220746F203531392C20616E642031303234:\ 046C31E4EA320DF130FE1F361184DDC03713BBAC169E08266B91655B42A01F39E\ 1E3FF781B04B2F44B2504F37ACC9688C1ADD7EB94A998779EFCDFBEB9FAFFC82D @@ -3701,14 +3701,14 @@ F486A9BA684B9FE2D983BBA5F9D97565F0DCF6A5176C169EC67B6BB6C9616CEA6 4AE4F716610D77E35A6FA2FEAAAC3E92706B996414C012EF72BCBE86E3F1A97BB:\ 5145D9E08DA9021E87080C437BE1835B06E5C9ECCDA8E7CF7E30F682D0CB1A9F7:\ 54657374696E6720766172696F7573206B657973697A657320666F72205257207\ -369676E6174757265733A2035313220746F203531392C20616E642031303234::\ +369676E6174757265733A2035313220746F203531392C20616E642031303234:\ 01BF0E20BF646E5E427B8D28CBAF696D7AA6B6DE878BB91C295D5559B1FA9A94F\ 114FF61C11C0BC97066C2FC919815B0FD150CE70F63D696CEA4D5D1D7BDEDC035 2:\ 6AA3DB8710567A30D7E9E61956962D4E4D50BC0510C2238D9136A93CC5DC3A73B:\ 6CAC9FF49F1035D179668B399927A610608788A8C884B76A94A6DDBCA94A52327:\ -57414E5445443A2043757465204A6170616E657365206769726C667269656E64::\ +57414E5445443A2043757465204A6170616E657365206769726C667269656E64:\ 1695A91578EBC67ED86C20EC4886B2E3895E11A7647D22FFB41091E1C7A3CA0DC\ E091A1FCBACB859C4A5C8B3B841C0F0F7039BEFEA790A423114F35F9D809DBCD2 @@ -3716,7 +3716,7 @@ E091A1FCBACB859C4A5C8B3B841C0F0F7039BEFEA790A423114F35F9D809DBCD2 9EADA4F7D1BEC405BC2BFB4F836E19A488E079030F8C09DE76810B9E63FB41873:\ AD5DEBCF83372200B106812A6A7CF3A702C35BAF4FC095617794314EBCAC4DE47:\ 476F6C642073747564733F213F204576656E20746865204D544120756E6465727\ -374616E647320746865206E65656420666F722074686520424C494E472D424C494E4721::\ +374616E647320746865206E65656420666F722074686520424C494E472D424C494E4721:\ 203FCE80570CA0DA3C2D50634A33BAACEA6D397618F36620EE10DE4E6A51018C0\ BADE98DF220E47DBA140AEAE910A28F3177D4349740EC05A5EB7BA280D7BF8F34 @@ -3727,7 +3727,7 @@ CDC7D5FE3805572EA3FF554C086C7DD4020A3CE48DF5A09A5CEB75E6AABCD338\ F800F362448E87CE7E1A55331ADF2BBF3A22B3E6134035FDA52D9578FD3F72F7:\ 57687920696E20746865206E616D65206F6620616C6C20746861742069732067\ 6F6F6420616E6420686F6C792061726520796F752072656164696E6720746869\ -733F213F21::\ +733F213F21:\ 05BDC911B3F19F2201EDF6CCC792A68BCEC40506F00112A6DCAEEAA2D7A62192\ 931D8968F7312EBFE7F7646CED6A8948E58327862527EFD960F15CD8EC74D1DF\ 1FDC37F369A4A844D15DB7ACC6DB5ADA884B119148929439D5305B6916D0A081\ @@ -3738,7 +3738,7 @@ EF86DD7AF3F32CDE8A9F6564E43A559A0C9F8BAD36CC25330548B347AC158A34\ 5631FA90F7B873C36EFFAE2F7823227A3F580B5DD18304D5932751E743E9281B:\ F5BB4289C389D9019C36F96C6B81FFFBF20BE0620C6343E2B800AEFB1B55A330\ 8CC1402DA7A2A558579A2A5146B30CB08E3F20B501081248F2F1DE36CDFCE9DF:\ -2CA039854B55688740E3::\ +2CA039854B55688740E3:\ 1AF029CBEC9C692CE5096E73E4E9A52EC9A28D207A5511CCEC7681E5E3D867A4\ AE2E22DE4909D89196A272F1B50DE6FA3248BCA334D46E0D57171A790B6F4697\ E7BA7047DB79DECD47BD21995243DEBBF25915DDBC93C45875C14DE953792257\ @@ -3749,7 +3749,7 @@ EF86DD7AF3F32CDE8A9F6564E43A559A0C9F8BAD36CC25330548B347AC158A34\ 5631FA90F7B873C36EFFAE2F7823227A3F580B5DD18304D5932751E743E9281B:\ F5BB4289C389D9019C36F96C6B81FFFBF20BE0620C6343E2B800AEFB1B55A330\ 8CC1402DA7A2A558579A2A5146B30CB08E3F20B501081248F2F1DE36CDFCE9DF:\ -2119A954F1AC0F3DCDB2::\ +2119A954F1AC0F3DCDB2:\ 60C3CCF4F086B15B7F850B445F384333F7AE5A4B5EDE2820C7233239E1B86D6E\ 4B4FCA4F50B087CE1DF17DA5D62672A17F2CF87A2875BBD9B138CAF6863821D6\ A4D553E9EB64C9254A8F9A6B960E57E39069D65E3F561AA1FA91643D42FEEFB9\ @@ -3760,7 +3760,7 @@ EF86DD7AF3F32CDE8A9F6564E43A559A0C9F8BAD36CC25330548B347AC158A34\ 5631FA90F7B873C36EFFAE2F7823227A3F580B5DD18304D5932751E743E9281B:\ F5BB4289C389D9019C36F96C6B81FFFBF20BE0620C6343E2B800AEFB1B55A330\ 8CC1402DA7A2A558579A2A5146B30CB08E3F20B501081248F2F1DE36CDFCE9DF:\ -7A4C634DE6F16315BD5F::\ +7A4C634DE6F16315BD5F:\ 308A5D65224201BED626CC83FB901EC84874EE03B2E7AB4E752EDBDE024C754E\ 3CC9841CA062100A8843DE9183354B4E0596E8C68F1605828287884F0F9BA696\ 8FC7A9F0CA09418A8485B90465E5D3F96CE4995A5FC7A6E5ABD9CC06BB8A2C3C\ @@ -3771,7 +3771,7 @@ F5BB4289C389D9019C36F96C6B81FFFBF20BE0620C6343E2B800AEFB1B55A330\ 976C3B14FBD253F0F988C354725289F2897D7FB62C5C74AF7D597A1E22AAFBA1D3:\ 0F816BF0ADD559AFDA38B008E4087F6A38B575C56FFF453056EAAAB3381C9552\ 0969546F954D458D48E44850938B1DB471CF4B40AFC47E067FB5BCE67BA98BE8D7:\ -EF0F1D56F4E5D587C212::\ +EF0F1D56F4E5D587C212:\ 3E544FEBB6623F5D392003B729FE2BFC20E2CB3ECAC22734DFCA55150254E616\ A41C5E54CE3B50FBC2FE2363EE9AF9B15C70615497B0A458F8AB6D850992EEEB\ 56D65F87EA1BD6E2B4B7E40A0F5E1635C7DDB17110C61039CF712D3524C9C2C1\ @@ -3782,7 +3782,7 @@ F35D9163BE5C70276F46634514BE16EC09602782E88FE74EAEB2F50CBB0E3B5C4A 976C3B14FBD253F0F988C354725289F2897D7FB62C5C74AF7D597A1E22AAFBA1D3:\ 0F816BF0ADD559AFDA38B008E4087F6A38B575C56FFF453056EAAAB3381C9552\ 0969546F954D458D48E44850938B1DB471CF4B40AFC47E067FB5BCE67BA98BE8D7:\ -EC5CC4228C3C70EE8F35::\ +EC5CC4228C3C70EE8F35:\ 228BAA85062F10DCC9D99A23D340BC4B9E463D8AB86A6781A6D2143564303E2D\ C78772BF68449BE1E2711A68D5A15CF04A23573FB3870454308F583BBB5F2467\ 069EF1395431E70F91BD56D846DC8DB2E88AB3D26A9770660B87A76D6C3575DE\ @@ -3793,7 +3793,7 @@ C78772BF68449BE1E2711A68D5A15CF04A23573FB3870454308F583BBB5F2467\ 976C3B14FBD253F0F988C354725289F2897D7FB62C5C74AF7D597A1E22AAFBA1D3:\ 0F816BF0ADD559AFDA38B008E4087F6A38B575C56FFF453056EAAAB3381C9552\ 0969546F954D458D48E44850938B1DB471CF4B40AFC47E067FB5BCE67BA98BE8D7:\ -FEF5EE07C74118DA30B9::\ +FEF5EE07C74118DA30B9:\ 2637E16E2599B6EC2F4728C73D3B29F483C2B881F1E1969C426027605EF080E9\ B17D258D5E1EBC6472A2501E04CF19C144537FCB38A1DA00D948EBD39FA11322\ D9230B62E2C12AEDB366BD85A2089588A8D52E941FD986D89828A342B83438A9\ @@ -3808,7 +3808,7 @@ BADCC718DD2D761C4893C4831D56ADA30FC5C7C148D473BEDF7615B7E821B92F\ 319676CE278349F1309FB3D264C1A22BDE71B221354C7A4D31117B3EC3C9D480\ 2E0A26BD8EC05D28B6502C65F35C687AF7F8396B963ED029A2C5AE38DD7C5C96\ 2A953C113C0F590957AB19A6E2AFDA6DB84F22C0C31AE243DEBD2920FBE9FBDF:\ -15E7B7B7ED0F176B6799::\ +15E7B7B7ED0F176B6799:\ 39FF4B5FA50AE498F3C91A655E6865840D1FC401EE02DBC8460A59DEB8816E66\ 80F712B7BAF8D4DC11A3B54BF906BE698306F0449BB43F3F223B944D930A1A3C\ 718E8A9E2EEDEC5A07AB817C26A80CC2A2EE2846A597EAB8A999D38DB9849016\ @@ -3827,7 +3827,7 @@ BADCC718DD2D761C4893C4831D56ADA30FC5C7C148D473BEDF7615B7E821B92F\ 319676CE278349F1309FB3D264C1A22BDE71B221354C7A4D31117B3EC3C9D480\ 2E0A26BD8EC05D28B6502C65F35C687AF7F8396B963ED029A2C5AE38DD7C5C96\ 2A953C113C0F590957AB19A6E2AFDA6DB84F22C0C31AE243DEBD2920FBE9FBDF:\ -B36724C92954C38D0288::\ +B36724C92954C38D0288:\ 3C8CD3614555568BBECA99174B7B203D0BC6FABE9E6FFE0C41EB4D9A2C601D23\ 93CA1E01B7D7E99337758AC914C9F151311E5AE6708DAF1D8C825DA471652C6E\ 13A8FE5802D7AE097BFC899A4EC8CA235B5982B9058C53AAD52823ACF692290E\ |