Mbed-TLS / mbedtls

An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API. Releases are on a varying cadence, typically around 3 - 6 months between releases.
https://www.trustedfirmware.org/projects/mbed-tls/
Other
5.54k stars 2.6k forks source link

Can mbedtls be compiled with MSVC 2008? #1349

Closed xyuan240 closed 6 years ago

xyuan240 commented 6 years ago

Note: This is just a template, so feel free to use/remove the unnecessary things

Description


Bug

OS
Mbed windows ce

Question

I wonder if mbedtls can be compiled with MSVC 2008? Furthermore, could it be compiled and deployed for windows CE? Many thanks!

simonbutcher commented 6 years ago

Hi @xyuan240,

We don't test Windows CE in our build systems, and we only do test builds with Microsoft Visual Studio 2010 and later, but it's only a couple of years since we were building with older versions, and I know from customer feedback that there are users using Mbed TLS on Windows CE.

I should imagine if we don't compile cleanly, it's only a small amount of work to get it working, and if you do, your pull requests to fix it would be very welcome.

I'm closing this issue, as I think I've answered your question, but if you have further questions please feel free to follow up or reopen the issue.

despair86 commented 6 years ago

Furthermore, I have successfully compiled mbedtls, in whole and in parts, on Visual C++ 1.5 (16-bit) as well as the corresponding 32-bit compiler (VC++ 1.1)

The library requires only a C89 compiler, does not make any assumptions regarding the size of int, and a few certain features require either C99 or vendor extensions (namely, SHA-512 which uses long long)

From the knowledge base:

The code uses a restricted version of the C99 ISO standard. The only features from C99 (with comparison to C89 / ANSI C) used are:

  • the stdint.h header for fixed-width types such as uint32_t. (This is a freestanding header, fully portable implementations for C89 toolchains are available online)
  • the inline keyword (though we use __inline instead with some compilers known not to support it, such as armcc 5). (Most C89 compilers support this)
  • one-line comments with // (Same here)
  • bounded functions snprintf() and vsnprintf() (It may be possible to take the functions from libiberty if your compiler does not have these)
  • the long long and uint64_t types (Sometimes. Side note: the only IA-16 compiler known to implement 64-bit integers--using AX:BX:CX:DX--is openwatcom.)
  • to be pedantic, some string literals that are longer than the length that C89 compilers are required to support
  • to be really pedantic, trailing comas in enumerator lists.

As a result variables have to be defined at the top of the code block. In mbed TLS most variables are even defined at the top of the function block.

In the future we might start using more C99 (or even C11) features as support for those standard expands in common compilers.