Open ghost opened 8 years ago
Oh, just FYI, on another debian testing box, where I "accidently" had installed libpolarssl-dev, I ran into another issue (with clang 3.5.2, not relevant for me though):
src/tlsdate-helper.c:840:9: error: unknown type name 'x509_cert'; did you mean 'x509_crt'?
const x509_cert *certificate;
^~~~~~~~~
x509_crt
/usr/include/polarssl/x509_crt.h:100:1: note: 'x509_crt' declared here
x509_crt;
^
src/tlsdate-helper.c:850:3: warning: implicit declaration of function 'x509parse_dn_gets' is invalid in C99 [-Wimplicit-function-declaration]
x509parse_dn_gets(buf, 1024, &certificate->subject);
^
src/tlsdate-helper.c:853:30: error: no member named 'rsa' in 'struct _x509_crt'
public_key = &certificate->rsa;
~~~~~~~~~~~ ^
src/tlsdate-helper.c:984:3: error: unknown type name 'x509_cert'; did you mean 'x509_crt'?
x509_cert cacert;
^~~~~~~~~
x509_crt
/usr/include/polarssl/x509_crt.h:100:1: note: 'x509_crt' declared here
x509_crt;
^
src/tlsdate-helper.c:990:30: error: use of undeclared identifier 'x509_cert'; did you mean 'x509_crt'?
memset (&cacert, 0, sizeof(x509_cert));
^
/usr/include/polarssl/x509_crt.h:100:1: note: 'x509_crt' declared here
x509_crt;
^
src/tlsdate-helper.c:1004:17: warning: implicit declaration of function 'x509parse_crtfile' is invalid in C99 [-Wimplicit-function-declaration]
if (0 > x509parse_crtfile(&cacert, ca_cert_container))
^
src/tlsdate-helper.c:1008:17: warning: implicit declaration of function 'x509parse_crtpath' is invalid in C99 [-Wimplicit-function-declaration]
if (0 > x509parse_crtpath(&cacert, ca_cert_container))
^
src/tlsdate-helper.c:1107:3: warning: implicit declaration of function 'x509_free' is invalid in C99 [-Wimplicit-function-declaration]
x509_free (&cacert);
^
4 warnings and 4 errors generated.
x509_crt is the easy part. I'm not familiar with PolarSSL, but from 1.2 to 1.3 they have restructured the RSA module, from rsa_context ctx to pk_context ctx. So my quick fix changing "public_key = &certificate->rsa" to "public_key = &certificate->pk" compiled, but CCLD fails.
src/src_tlsdate_helper-tlsdate-helper.o: In function `check_key_length':
/home/daniel/code/tlsdate/src/tlsdate-helper.c:850: undefined reference to `x509parse_dn_gets'
src/src_tlsdate_helper-tlsdate-helper.o: In function `run_ssl':
/home/daniel/code/tlsdate/src/tlsdate-helper.c:1008: undefined reference to `x509parse_crtpath'
/home/daniel/code/tlsdate/src/tlsdate-helper.c:1004: undefined reference to `x509parse_crtfile'
/home/daniel/code/tlsdate/src/tlsdate-helper.c:1107: undefined reference to `x509_free'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:1704: recipe for target 'src/tlsdate-helper' failed
this needs more investigation if mbedTLS 1.3 has to work.
(1) AS_IF is provided by autoconf itself. autoconf-2.69-6 on my system defines it in /usr/share/autoconf/m4sugar/m4sh.m4. same goes for all the other AC/AS macros you describe. tlsdate must not mess around with m4_pattern_allow here.
(2) if you want to build tlsdate from git and/or run autotools, you must install the relevant dev packages. that includes pkg-config which provides pkg.m4. not a bug in tlsdate.
(3) tlsdate probably could use some symbol checks. OpenSSL is not friendly when it comes to disabling crypto funcs as it basically breaks the ABI.
(4) this isn't necessarily a bug. having a program call free() on all allocated buffers before calling exit() is both entirely pointless and a waste of CPU/resources. the kernel will automatically free all the memory when programs exits.
(5) if you want to request polarssl support, please file a new issue. creating one bug report with a ton of unrelated issues only creates a mess.
Hi,
I ran into a few issues compiling on debian testing.
1: configure.ac - _AS_IF([test "x${OPTPOLARSSL}" != "xno"
in configure.ac, the AS_IF call checking for PolarSSL produces errors on autoreconf -i with autoconf 2.69-9.
I fixed that quick'n'dirty using
but I'm sure there are more solid solutions.
2: configure.ac - _PKG_CHECKMODULES([LIBEVENT])
when pkg-config is not installed, configure throws a syntax error. I fixed that adding
Is there a better solution for this?
3: SSLv3_client_method() was dropped in Debian's OpenSSL
I fixed that using the following diff:
4: tlsdated is not completely free()ing all allocated memory when exiting
With ASAN (gcc) enabled, LeakSanitizer reports memory leaks after tlsdated exists:
There seems to be the need for some garbage collection.