Reputation: 11
How should I add Crypto++ 8.80 library to NS3 3.31 ? The OS is Ubuntu 20.04. My main aim to test TLS 1.3 cipher suites with wireless sensor network.
Here are some specific pointers:
The NS3 installation is working properly. I am able to run the ns3 scripts that are provided with the examples & tutorials folders.
Also NetAnim 3.108 is also working properly.
I have added the source code of Crypto++ 8.80 lib to contrib folder as contrib/cryptopp.
I had downloaded the source code from https://github.com/weidai11/cryptopp/releases/tag/CRYPTOPP_8_8_0.
Please tell me what should my next steps be. Also if there is no way please tell me alternatives as well.
So here is what I have tried:
Firstly I have put the source code in inside /home/hex/ns-allinone-3.31/ns-3.31/contrib/cryptopp.
Here are the files in the above mentioned folder:
3way.cpp dh.cpp lubyrack.h serpentp.h
3way.h dh.h luc.cpp sha1_armv4.h
adhoc.cpp.proto dll.cpp luc.h sha1_armv4.S
adler32.cpp dll.h mars.cpp sha256_armv4.h
adler32.h dlltest.cpp mars.h sha256_armv4.S
adv_simd.h dlltest.vcxproj marss.cpp sha3.cpp
aes_armv4.h dlltest.vcxproj.filters md2.cpp sha3.h
aes_armv4.S dmac.h md2.h sha512_armv4.h
aes.h donna_32.cpp md4.cpp sha512_armv4.S
algebra.cpp donna_32.h md4.h shacal2.cpp
algebra.h donna_64.cpp md5.cpp shacal2.h
algparam.cpp donna_64.h md5.h shacal2_simd.cpp
algparam.h donna.h mdc.h sha.cpp
allocate.cpp donna_sse.cpp mersenne.h sha.h
allocate.h donna_sse.h misc.cpp shake.cpp
arc4.cpp Doxyfile misc.h shake.h
arc4.h drbg.h modarith.h sharkbox.cpp
argnames.h dsa.cpp modes.cpp shark.cpp
aria.cpp dsa.h modes.h shark.h
aria.h eax.cpp modexppc.h sha_simd.cpp
aria_simd.cpp eax.h mqueue.cpp simeck.cpp
ariatab.cpp ec2n.cpp mqueue.h simeck.h
arm_simd.h ec2n.h mqv.cpp simon128_simd.cpp
asn.cpp eccrypto.cpp mqv.h simon.cpp
asn.h eccrypto.h naclite.h simon.h
authenc.cpp ecp.cpp nbtheory.cpp simple.cpp
authenc.h ecp.h nbtheory.h simple.h
base32.cpp ecpoint.h neon_simd.cpp siphash.h
base32.h elgamal.cpp nr.h skipjack.cpp
base64.cpp elgamal.h oaep.cpp skipjack.h
base64.h emsa2.cpp oaep.h sm3.cpp
basecode.cpp emsa2.h oids.h sm3.h
basecode.h eprecomp.cpp osrng.cpp sm4.cpp
bds10.zip eprecomp.h osrng.h sm4.h
bench1.cpp esign.cpp ossig.h sm4_simd.cpp
bench2.cpp esign.h padlkrng.cpp smartptr.h
bench3.cpp factory.h padlkrng.h sosemanuk.cpp
bench.h fhmqv.h panama.cpp sosemanuk.h
bfinit.cpp Filelist.txt panama.h speck128_simd.cpp
blake2b_simd.cpp files.cpp pch.cpp speck.cpp
blake2.cpp files.h pch.h speck.h
blake2.h filters.cpp pkcspad.cpp square.cpp
blake2s_simd.cpp filters.h pkcspad.h square.h
blowfish.cpp fips140.cpp poly1305.cpp squaretb.cpp
blowfish.h fips140.h poly1305.h sse_simd.cpp
blumshub.cpp fipsalgt.cpp polynomi.cpp stdcpp.h
blumshub.h fipstest.cpp polynomi.h strciphr.cpp
camellia.cpp fltrimpl.h power7_ppc.cpp strciphr.h
camellia.h gcm.cpp power8_ppc.cpp tea.cpp
cast.cpp gcm.h power9_ppc.cpp tea.h
cast.h gcm_simd.cpp ppc_simd.cpp test.cpp
casts.cpp gf2_32.cpp ppc_simd.h TestData
cbcmac.cpp gf2_32.h pssr.cpp TestPrograms
cbcmac.h gf256.cpp pssr.h TestScripts
ccm.cpp gf256.h pubkey.cpp TestVectors
ccm.h gf2n.cpp pubkey.h tftables.cpp
chacha_avx.cpp gf2n.h pwdbased.h threefish.cpp
chacha.cpp gf2n_simd.cpp queue.cpp threefish.h
chacha.h gfpcrypt.cpp queue.h tiger.cpp
chachapoly.cpp gfpcrypt.h rabbit.cpp tiger.h
chachapoly.h GNUmakefile rabbit.h tigertab.cpp
chacha_simd.cpp GNUmakefile-cross rabin.cpp trap.h
cham.cpp gost.cpp rabin.h trunhash.h
cham.h gost.h randpool.cpp ttmac.cpp
cham_simd.cpp gzip.cpp randpool.h ttmac.h
channels.cpp gzip.h rc2.cpp tweetnacl.cpp
channels.h hashfwd.h rc2.h tweetnacl.h
cmac.cpp hc128.cpp rc5.cpp twofish.cpp
cmac.h hc128.h rc5.h twofish.h
config_align.h hc256.cpp rc6.cpp validat0.cpp
config_asm.h hc256.h rc6.h validat10.cpp
config_cpu.h hex.cpp rdrand.asm validat1.cpp
config_cxx.h hex.h rdrand.cpp validat2.cpp
config_dll.h hight.cpp rdrand.h validat3.cpp
config.h hight.h rdseed.asm validat4.cpp
config_int.h History.txt rdtables.cpp validat5.cpp
config_misc.h hkdf.h Readme.txt validat6.cpp
config_ns.h hmac.cpp regtest1.cpp validat7.cpp
config_os.h hmac.h regtest2.cpp validat8.cpp
config_ver.h hmqv.h regtest3.cpp validat9.cpp
cpu.cpp hrtimer.cpp regtest4.cpp validate.h
cpu.h hrtimer.h resource.h vc60.zip
crc.cpp ida.cpp rijndael.cpp vmac.cpp
crc.h ida.h rijndael.h vmac.h
crc_simd.cpp idea.cpp rijndael_simd.cpp vs2005.zip
cryptdll.vcxproj idea.h ripemd.cpp wake.cpp
cryptdll.vcxproj.filters Install.txt ripemd.h wake.h
cryptest.nmake integer.cpp rng.cpp whrlpool.cpp
cryptest.sln integer.h rng.h whrlpool.h
cryptest.vcxproj iterhash.cpp rsa.cpp words.h
cryptest.vcxproj.filters iterhash.h rsa.h x64dll.asm
cryptest.vcxproj.user kalyna.cpp rw.cpp x64masm.asm
cryptlib.cpp kalyna.h rw.h xed25519.cpp
cryptlib.h kalynatab.cpp safer.cpp xed25519.h
cryptlib.vcxproj keccak_core.cpp safer.h xtr.cpp
cryptlib.vcxproj.filters keccak.cpp salsa.cpp xtrcrypt.cpp
cryptopp.mapfile keccak.h salsa.h xtrcrypt.h
cryptopp.rc keccak_simd.cpp scrypt.cpp xtr.h
cryptopp.supp lea.cpp scrypt.h xts.cpp
darn.cpp lea.h seal.cpp xts.h
darn.h lea_simd.cpp seal.h zdeflate.cpp
datatest.cpp License.txt secblockfwd.h zdeflate.h
default.cpp lsh256_avx.cpp secblock.h zinflate.cpp
default.h lsh256.cpp seckey.h zinflate.h
des.cpp lsh256_sse.cpp Security.md zlib.cpp
des.h lsh512_avx.cpp seed.cpp zlib.h
dessp.cpp lsh512.cpp seed.h
dh2.cpp lsh512_sse.cpp serpent.cpp
dh2.h lsh.h serpent.h
Next I have added the following lines inside wscript:
This is the code I have added.
# Add Crypto++ module
# New Code
bld = conf.bld
# New Code
# New Code
bld.recurse('contrib/cryptopp')
bld.env.prepend_value('INCLUDES', ['contrib/cryptopp'])
# New Code
The file is located at /home/hex/ns-allinone-3.31/ns-3.31/src/wscript.
Here is the code:
Next I have added another piece of code under # New Code:
# New Code
# Add Crypto++ module
module = bld.create_ns3_module('CryptoPP', ['cryptlib'])
module.source = ['cryptlib.cpp']
# New Code
I have added the above code inside the file wscript located at /home/hex/ns-allinone-3.31/ns-3.31/contrib/wscript.
Here is the code:
Here is the error I am getting after running the command:
root@hex:/home/hex/ns-allinone-3.31/ns-3.31# ./waf configure
Setting top to : /home/hex/ns-allinone-3.31/ns-3.31
Setting out to : /home/hex/ns-allinone-3.31/ns-3.31/build
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Checking for cc version : 9.4.0
Checking for 'g++' (C++ compiler) : /usr/bin/g++
Checking for compilation flag -Wl,--soname=foo support : ok
Checking for compilation flag -std=c++11 support : ok
Checking boost includes : headers not found, please provide a --boost-includes argument (see help)
Checking boost includes : headers not found, please provide a --boost-includes argument (see help)
Checking for program 'python' : /usr/bin/python3
Checking for python version >= 2.3 : 3.8.10
python-config : /usr/bin/python3-config
Asking python-config for pyembed '--cflags --libs --ldflags --embed' flags : yes
Testing pyembed configuration : yes
Asking python-config for pyext '--cflags --libs --ldflags' flags : yes
Testing pyext configuration : yes
Checking for compilation flag -fvisibility=hidden support : ok
Checking for compilation flag -Wno-array-bounds support : ok
Checking for pybindgen location : ../pybindgen-0.21.0 (guessed)
Checking for python module 'pybindgen' : 0.21.0
Checking for pybindgen version : 0.21.0
Checking for code snippet : yes
Checking for types uint64_t and unsigned long equivalence : no
Checking for code snippet : no
Checking for types uint64_t and unsigned long long equivalence : yes
Checking for the apidefs that can be used for Python bindings : gcc-LP64
Checking for internal GCC cxxabi : complete
Checking for python module 'pygccxml' : not found
Traceback (most recent call last):
File "/home/hex/ns-allinone-3.31/ns-3.31/.waf3-2.0.18-ff4ae9f5cc05353d3dc3aeff8854ae69/waflib/Scripting.py", line 119, in waf_entry_point
run_commands()
File "/home/hex/ns-allinone-3.31/ns-3.31/.waf3-2.0.18-ff4ae9f5cc05353d3dc3aeff8854ae69/waflib/Scripting.py", line 182, in run_commands
ctx=run_command(cmd_name)
File "/home/hex/ns-allinone-3.31/ns-3.31/.waf3-2.0.18-ff4ae9f5cc05353d3dc3aeff8854ae69/waflib/Scripting.py", line 173, in run_command
ctx.execute()
File "/home/hex/ns-allinone-3.31/ns-3.31/.waf3-2.0.18-ff4ae9f5cc05353d3dc3aeff8854ae69/waflib/Configure.py", line 85, in execute
super(ConfigurationContext,self).execute()
File "/home/hex/ns-allinone-3.31/ns-3.31/.waf3-2.0.18-ff4ae9f5cc05353d3dc3aeff8854ae69/waflib/Context.py", line 85, in execute
self.recurse([os.path.dirname(g_module.root_path)])
File "/home/hex/ns-allinone-3.31/ns-3.31/.waf3-2.0.18-ff4ae9f5cc05353d3dc3aeff8854ae69/waflib/Context.py", line 126, in recurse
user_function(self)
File "/home/hex/ns-allinone-3.31/ns-3.31/wscript", line 499, in configure
conf.recurse('src')
File "/home/hex/ns-allinone-3.31/ns-3.31/.waf3-2.0.18-ff4ae9f5cc05353d3dc3aeff8854ae69/waflib/Context.py", line 126, in recurse
user_function(self)
File "/home/hex/ns-allinone-3.31/ns-3.31/src/wscript", line 57, in configure
bld = conf.bld
AttributeError: 'ConfigurationContext' object has no attribute 'bld'
How should I rectify this error ?
Upvotes: 1
Views: 153
Reputation: 15180
As waf said, there's no "bld" attribute attached to ConfigurationContext "conf".
To correct this specific error, remove bld = conf.bld
and use the conf object to recurse into your new module:
conf.recurse('contrib/cryptopp')
conf.env.prepend_value('INCLUDES', ['contrib/cryptopp'])
Note that I'm no ns3 expert.
Upvotes: 0