MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / dh_test

Function dh_test

extra/yassl/taocrypt/test/test.cpp:1204–1239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1202
1203
1204int dh_test()
1205{
1206 Source source;
1207 FileSource("../certs/dh1024.dat", source);
1208 if (source.size() == 0) {
1209 FileSource("../../certs/dh1024.dat", source); // for testsuite
1210 if (source.size() == 0) {
1211 FileSource("../../../certs/dh1024.dat", source); // win32 Debug dir
1212 if (source.size() == 0)
1213 err_sys("where's your certs dir?", -79);
1214 }
1215 }
1216 HexDecoder hDec(source);
1217
1218 DH dh(source);
1219
1220 byte pub[128];
1221 byte priv[128];
1222 byte agree[128];
1223 byte pub2[128];
1224 byte priv2[128];
1225 byte agree2[128];
1226
1227 DH dh2(dh);
1228
1229 dh.GenerateKeyPair(rng, priv, pub);
1230 dh2.GenerateKeyPair(rng, priv2, pub2);
1231 dh.Agree(agree, priv, pub2);
1232 dh2.Agree(agree2, priv2, pub);
1233
1234
1235 if ( memcmp(agree, agree2, dh.GetByteLength()) )
1236 return -80;
1237
1238 return 0;
1239}
1240
1241
1242int dsa_test()

Callers 1

taocrypt_testFunction · 0.85

Calls 6

FileSourceClass · 0.85
GenerateKeyPairMethod · 0.80
AgreeMethod · 0.80
GetByteLengthMethod · 0.80
err_sysFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected