Changeset 52297 in vbox for trunk/src/VBox/Runtime/testcase
- Timestamp:
- Aug 6, 2014 2:43:28 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95409
- Location:
- trunk/src/VBox/Runtime/testcase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/Makefile.kmk
r52018 r52297 227 227 tstRTBigNum_TEMPLATE = VBOXR3TSTEXE 228 228 tstRTBigNum_SOURCES = tstRTBigNum.cpp 229 tstRTBigNum_SDKS = VBOX_OPENSSL 229 230 230 231 tstRTBitOperations_TEMPLATE = VBOXR3TSTEXE -
trunk/src/VBox/Runtime/testcase/tstRTBigNum.cpp
r52289 r52297 34 34 #include <iprt/time.h> 35 35 #include <iprt/string.h> 36 37 #if 1 38 # include <openssl/bn.h> 39 #endif 36 40 37 41 … … 865 869 RTTESTI_CHECK_RC(rc, VINF_SUCCESS); 866 870 RTTestIValue("RTBigNumModExp", uElapsed / cRounds, RTTESTUNIT_NS_PER_CALL); 871 872 #if 1 873 /* Compare with OpenSSL BN. */ 874 BN_CTX *pObnCtx = BN_CTX_new(); 875 BIGNUM *pObnPubKeyExp = BN_bin2bn(s_abPubKeyExp, sizeof(s_abPubKeyExp), NULL); 876 BIGNUM *pObnPubKeyMod = BN_bin2bn(s_abPubKeyMod, sizeof(s_abPubKeyMod), NULL); 877 BIGNUM *pObnSignature = BN_bin2bn(s_abSignature, sizeof(s_abSignature), NULL); 878 BIGNUM *pObnResult = BN_new(); 879 RTTESTI_CHECK_RETV(BN_mod_exp(pObnResult, pObnSignature, pObnPubKeyExp, pObnPubKeyMod, pObnCtx) == 1); 880 BN_CTX_free(pObnCtx); 881 882 rc = 1; 883 cRounds = 0; 884 uStartTS = RTTimeNanoTS(); 885 while (cRounds < 4096) 886 { 887 pObnCtx = BN_CTX_new(); 888 rc &= BN_mod_exp(pObnResult, pObnSignature, pObnPubKeyExp, pObnPubKeyMod, pObnCtx); 889 BN_CTX_free(pObnCtx); 890 cRounds++; 891 } 892 uElapsed = RTTimeNanoTS() - uStartTS; 893 RTTESTI_CHECK_RC(rc, 1); 894 RTTestIValue("BN_mod_exp", uElapsed / cRounds, RTTESTUNIT_NS_PER_CALL); 895 896 rc = 1; 897 cRounds = 0; 898 uStartTS = RTTimeNanoTS(); 899 while (cRounds < 4096) 900 { 901 pObnCtx = BN_CTX_new(); 902 rc &= BN_mod_exp_simple(pObnResult, pObnSignature, pObnPubKeyExp, pObnPubKeyMod, pObnCtx); 903 BN_CTX_free(pObnCtx); 904 cRounds++; 905 } 906 uElapsed = RTTimeNanoTS() - uStartTS; 907 RTTESTI_CHECK_RC(rc, 1); 908 RTTestIValue("BN_mod_exp_simple", uElapsed / cRounds, RTTESTUNIT_NS_PER_CALL); 909 #endif 867 910 } 868 911
Note:
See TracChangeset
for help on using the changeset viewer.