Re: [cryptopp-users] Problems using the library in my application

44 views
Skip to first unread message

Jeffrey Walton

unread,
Apr 23, 2021, 3:55:33 PM4/23/21
to Crypto++ Users List
> Shouldn't the source code be structured such that the core library source files have their own folder? It appears the source code is dumped in with test programs, benchmark programs, and other things that I'm not sure what they are.

Everything is dumped in the root folder to help various tools. In the
past tools like debuggers and disassemblers had problems finding
object files and debug symbols.

Even today, you sometimes need to add options like
-fdebug-prefix-map=<src>=<dest> for Linux.

Users also have a hard time finding things if things get tucked away
into folders.

To avoid all the problems caused by tools and missing artifacts,
everything gets dumped in the root folder, including object files on
Linux & Unix.

It is a pretty good strategy because it minimizes mailing list questions :)

> Some people want to be able to build the files as part of their project rather than using your provided project files. Shouldn't this be easy to do?

Yes.

What problem are you having?

> Also, I tried building the library using cryptdll.vcproj that was inside vs2005.zip (using Visual Studio 2019). I got 907 warnings and one error.

Typically you use the *.vcxproj files with Visual Studio 2010 and
above. The *.vcxproj are unpacked in the root directory. Just click on
the Visual Studio solution file.

> Has anyone else successfully built the library using Visual Studio?

Yes. I built the projects several days ago. That was testing with
VS2012, VS2013, VS2015 and VS2017.

I also tested ARM and ARM64 builds using our NMake project file at
https://www.cryptopp.com/wiki/Nmake_(Command_Line).

I did not test the VS2005 project files, however. They are probably
broke at the moment. They don't get much attention nowadays Since
Visual Studio 2010 made its appearance.

You might also be interested in
https://www.cryptopp.com/wiki/MSBuild_(Command_Line).

Jeff

Jonathan Wood

unread,
Apr 23, 2021, 4:10:18 PM4/23/21
to Crypto++ Users
The problems I'm having is trying to sort out which files I need. For example, those with main() defined in them probably won't work being compiled into my application. I couldn't disagree more with the layout, but I understand people think differently.

I was able to use the solution to build without errors. My preference would've been to add the project to my existing solution. But I can see this just isn't going to work the way I want it to work.

Beyond that, in trying to use the library, I'm having trouble figuring out which header files I need. I hoped there was one that would do it but now I'm doubting that's the case. I've posted another question about that.

Thanks for taking time to respond.

Jeffrey Walton

unread,
Apr 24, 2021, 7:10:23 AM4/24/21
to Crypto++ Users List
On Fri, Apr 23, 2021 at 4:10 PM Jonathan Wood <jw...@softcircuits.com> wrote:
>
> The problems I'm having is trying to sort out which files I need. For example, those with main() defined in them probably won't work being compiled into my application.

If you have access to a Linux machine, then run 'make sources'. It
tells you what sources go where. See below.

Visual Studio is a little different than Linux, however. Visual Studio
has a few *.asm files you will need. They are Microsoft assembler
(MASM) source files. They don't show up under Linux.

$ ls *.asm
rdrand.asm rdseed.asm x64dll.asm x64masm.asm

Another place you can look at is cryptest.nmake. The Nmake file
includes a list of artifacts for LIB_SRCS and LIB_OBS. See
https://github.com/weidai11/cryptopp/blob/master/cryptest.nmake.

Finally, you can look in the cryptlib.vcxproj file. But it's full of
XML markup. It's hard to do something useful with it, like create a
file list. (About all it is good for is Visual Studio IDE and
MSBuild).

> I was able to use the solution to build without errors. My preference would've been to add the project to my existing solution. But I can see this just isn't going to work the way I want it to work.

I think you can simply add cryptlib.vcxproj to your project.

You don't need the other projects: cryptest.vcxproj, cryptdll.vcxproj
or dlltest.vcxproj.

Also see https://www.cryptopp.com/wiki/Visual_Studio on the wiki.

> Beyond that, in trying to use the library, I'm having trouble figuring out which header files I need. I hoped there was one that would do it but now I'm doubting that's the case.

Yeah, that's a problem when you are unfamiliar with a library. I've
been trying to update the wiki samples that include the headers.

If you find a gap in the wiki, then please point it out. I'm thinking
we may be missing an example of integrating cryptlib.vcxproj into a
user's project. There's an old article I wrote years ago, but it is
really old: https://www.codeproject.com/Articles/16388/Compiling-and-Integrating-Crypto-into-the-Microsof

Jeff

$ make sources
***** Library sources *****
cryptlib.cpp cpu.cpp integer.cpp 3way.cpp adler32.cpp algebra.cpp algparam.cpp a
llocate.cpp arc4.cpp aria.cpp aria_simd.cpp ariatab.cpp asn.cpp authenc.cpp base
32.cpp base64.cpp basecode.cpp bfinit.cpp blake2.cpp blake2b_simd.cpp blake2s_si
md.cpp blowfish.cpp blumshub.cpp camellia.cpp cast.cpp casts.cpp cbcmac.cpp ccm.
cpp chacha.cpp chacha_avx.cpp chacha_simd.cpp chachapoly.cpp cham.cpp cham_simd.
cpp channels.cpp cmac.cpp crc.cpp crc_simd.cpp darn.cpp default.cpp des.cpp dess
p.cpp dh.cpp dh2.cpp dll.cpp donna_32.cpp donna_64.cpp donna_sse.cpp dsa.cpp eax
.cpp ec2n.cpp eccrypto.cpp ecp.cpp elgamal.cpp emsa2.cpp eprecomp.cpp esign.cpp
files.cpp filters.cpp fips140.cpp fipstest.cpp gcm.cpp gcm_simd.cpp gf256.cpp gf
2_32.cpp gf2n.cpp gf2n_simd.cpp gfpcrypt.cpp gost.cpp gzip.cpp hc128.cpp hc256.c
pp hex.cpp hight.cpp hmac.cpp hrtimer.cpp ida.cpp idea.cpp iterhash.cpp kalyna.c
pp kalynatab.cpp keccak.cpp keccak_core.cpp keccak_simd.cpp lea.cpp lea_simd.cpp
lsh256.cpp lsh512.cpp luc.cpp mars.cpp marss.cpp md2.cpp md4.cpp md5.cpp misc.c
pp modes.cpp mqueue.cpp mqv.cpp nbtheory.cpp oaep.cpp osrng.cpp padlkrng.cpp pan
ama.cpp pem_common.cpp pem_read.cpp pem_write.cpp pkcspad.cpp poly1305.cpp polyn
omi.cpp pssr.cpp pubkey.cpp queue.cpp rabbit.cpp rabin.cpp randpool.cpp rc2.cpp
rc5.cpp rc6.cpp rdrand.cpp rdtables.cpp rijndael.cpp rijndael_simd.cpp ripemd.cp
p rng.cpp rsa.cpp rw.cpp safer.cpp salsa.cpp scrypt.cpp seal.cpp seed.cpp serpen
t.cpp sha.cpp sha3.cpp sha_simd.cpp shacal2.cpp shacal2_simd.cpp shake.cpp shark
.cpp sharkbox.cpp simeck.cpp simon.cpp simon128_simd.cpp skipjack.cpp sm3.cpp sm
4.cpp sm4_simd.cpp sosemanuk.cpp speck.cpp speck128_simd.cpp square.cpp squaretb
.cpp sse_simd.cpp strciphr.cpp tea.cpp tftables.cpp threefish.cpp tiger.cpp tige
rtab.cpp ttmac.cpp tweetnacl.cpp twofish.cpp vmac.cpp wake.cpp whrlpool.cpp x509
cert.cpp xed25519.cpp xtr.cpp xtrcrypt.cpp xts.cpp zdeflate.cpp zinflate.cpp zli
b.cpp

***** Library headers *****
3way.h adler32.h adv_simd.h aes.h aes_armv4.h algebra.h algparam.h allocate.h ar
c4.h argnames.h aria.h arm_simd.h asn.h authenc.h base32.h base64.h basecode.h b
lake2.h blowfish.h blumshub.h camellia.h cast.h cbcmac.h ccm.h chacha.h chachapo
ly.h cham.h channels.h cmac.h config.h config_align.h config_asm.h config_cpu.h
config_cxx.h config_dll.h config_int.h config_misc.h config_ns.h config_os.h con
fig_ver.h cpu.h crc.h cryptlib.h darn.h default.h des.h dh.h dh2.h dll.h dmac.h
donna.h donna_32.h donna_64.h donna_sse.h drbg.h dsa.h eax.h ec2n.h eccrypto.h e
cp.h ecpoint.h elgamal.h emsa2.h eprecomp.h esign.h fhmqv.h files.h filters.h fi
ps140.h fltrimpl.h gcm.h gf256.h gf2_32.h gf2n.h gfpcrypt.h gost.h gzip.h hashfw
d.h hc128.h hc256.h hex.h hight.h hkdf.h hmac.h hmqv.h hrtimer.h ida.h idea.h in
teger.h iterhash.h kalyna.h keccak.h keywrap.h lea.h lsh.h lubyrack.h luc.h mars
.h md2.h md4.h md5.h mdc.h mersenne.h misc.h modarith.h modes.h modexppc.h mqueu
e.h mqv.h naclite.h nbtheory.h nr.h oaep.h oids.h osrng.h ossig.h padlkrng.h pan
ama.h pch.h pem.h pem_common.h pkcspad.h poly1305.h polynomi.h ppc_simd.h pssr.h
pubkey.h pwdbased.h queue.h rabbit.h rabin.h randpool.h rc2.h rc5.h rc6.h rdran
d.h rijndael.h ripemd.h rng.h rsa.h rw.h safer.h salsa.h scrypt.h seal.h secbloc
k.h secblockfwd.h seckey.h seed.h serpent.h serpentp.h sha.h sha1_armv4.h sha256
_armv4.h sha3.h sha512_armv4.h shacal2.h shake.h shark.h simeck.h simon.h simple
.h siphash.h skipjack.h sm3.h sm4.h smartptr.h sosemanuk.h speck.h square.h stdc
pp.h strciphr.h tea.h threefish.h tiger.h trap.h trunhash.h ttmac.h tweetnacl.h
twofish.h vmac.h wake.h whrlpool.h words.h x509cert.h xed25519.h xtr.h xtrcrypt.
h xts.h zdeflate.h zinflate.h zlib.h

***** Test sources *****
adhoc.cpp test.cpp bench1.cpp bench2.cpp bench3.cpp datatest.cpp dlltest.cpp fip
salgt.cpp validat0.cpp validat1.cpp validat2.cpp validat3.cpp validat4.cpp valid
at5.cpp validat6.cpp validat7.cpp validat8.cpp validat9.cpp validat10.cpp regtes
t1.cpp regtest2.cpp regtest3.cpp regtest4.cpp

***** Test headers *****
bench.h factory.h validate.h
make: Nothing to be done for 'sources'.
Reply all
Reply to author
Forward
0 new messages