libtom / libtomcrypt

LibTomCrypt is a fairly comprehensive, modular and portable cryptographic toolkit that provides developers with a vast array of well known published block ciphers, one-way hash functions, chaining modes, pseudo-random number generators, public key cryptography and a plethora of other routines.
https://www.libtom.net
Other
1.51k stars 449 forks source link

ltc_math_descriptor redefinition error when attempting to compile using LTM as math provider. #642

Closed Allevon412 closed 3 months ago

Allevon412 commented 3 months ago

Prerequisites

Description

[Description of the issue]

My issue is in attempting to compile the libtomcrypt library using visual studio 2022. I hit the following error when I attempt to using the tommath.lib library as the math provider. I have the following math provider defined in tomcrypt_custom.h

/ ---> math provider? <--- /

ifndef LTC_NO_MATH

/ LibTomMath /

define LTM_DESC

/ TomsFastMath / / #define TFM_DESC /

/ GNU Multiple Precision Arithmetic Library / / #define GMP_DESC /

endif / LTC_NO_MATH /

Severity Code Description Project File Line Suppression State Details Error C2371 'ltc_math_descriptor': redefinition; different basic types libtomcrypt D:\OffsecTools\libtomcrypt\src\headers\tomcrypt_math.h 501

Steps to Reproduce

Version

define SCRYPT "1.18.2-develop"

You can get this information from the define SCRYPT in src/include/tomcrypt.h or your local git repository by running git describe --always --tags --dirty. Also, please include the compiler, the compiler version, the architecture and (if applicable) the MPI provider, the OS and what version of the OS you're experiencing the issue. Windows 10 x64 bit Visual Studio compiler 2022.

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

sjaeckel commented 3 months ago

Can you please give more details on how to reproduce the error?

We're successfully building ltc+ltm with MSVC in our AppVeyor CI jobs, so I suspect a configuration issue, resp. an issue with how you build the libraries.

Allevon412 commented 3 months ago

Here are some more screenshots of my current configuration. What other information do you think you would need?

image image image

Allevon412 commented 3 months ago

any word on this? all i tried to do was build using default settings in MSVS 2022 release x64 bit architecture.

Allevon412 commented 3 months ago

Nvm I got it to build by adding #pragma once to the tomcrypt_custom.h file to negate the redefinition. I am assuming the header being included in multiple files caused a weird compiler error where it was being defined everywhere.