activate leakmalloc support when LEAKMALLOC make variable is set

(mostly by markus@)
This commit is contained in:
Damien Miller
2012-03-15 13:27:43 +11:00
parent dfecc980bc
commit 3f69ecb299
9 changed files with 64 additions and 5 deletions

View File

@@ -1,5 +1,9 @@
# $OpenBSD:$
SUBDIR= ssh regress unittests
.if defined(LEAKMALLOC)
SUBDIR= leakmalloc ssh unittests
.else
SUBDIR= ssh unittests regress
.endif
.include <bsd.subdir.mk>

5
leakmalloc/Makefile Normal file
View File

@@ -0,0 +1,5 @@
# $OpenBSD:$
SUBDIR= leakmalloc regress
.include <bsd.subdir.mk>

View File

@@ -51,7 +51,7 @@ summary: ${PROG}
grep "^Total:" | cut -d' ' -f 2` -eq 22
clean:
rm ${PROG} *.o *.core leakmalloc.out
rm -f ${PROG} *.o *.core leakmalloc.out
.include <bsd.regress.mk>

View File

@@ -8,7 +8,6 @@ WARNINGS=Yes
CDIAGFLAGS= -Wall
CDIAGFLAGS+= -Werror
CDIAGFLAGS+= -Wpointer-arith
CDIAGFLAGS+= -Wuninitialized
CDIAGFLAGS+= -Wstrict-prototypes
CDIAGFLAGS+= -Wmissing-prototypes
CDIAGFLAGS+= -Wunused
@@ -39,3 +38,22 @@ DPADD+= ${.CURDIR}/../lib/shlib_version
LDADD+= -lcrypto -lz
DPADD+= ${LIBCRYPTO} ${LIBZ}
.endif
.if defined(LEAKMALLOC)
DEBUG= -g
COPTS= -O0
LEAKMALLOC_DIR= ${.CURDIR}/../../leakmalloc/leakmalloc
CFLAGS+= -I${LEAKMALLOC_DIR} -DWITH_LEAKMALLOC
LDFLAGS+= -L/usr/local/lib
LDADD+= -lleakmalloc -lexecinfo
. if exists(${LEAKMALLOC_DIR}/${__objdir})
LDADD+= -L${LEAKMALLOC_DIR}/${__objdir}
DPADD+= ${LEAKMALLOC_DIR}/${__objdir}/libleakmalloc.a
. else
LDADD+= -L${LEAKMALLOC_DIR}
DPADD+= ${LEAKMALLOC_DIR}/libleakmalloc.a
. endif
.else
CDIAGFLAGS+= -Wuninitialized
.endif

View File

@@ -15,6 +15,10 @@
#ifndef AUTHFILE_H
#define AUTHFILE_H
#ifdef WITH_LEAKMALLOC
#include "leakmalloc.h"
#endif
struct sshbuf;
struct sshkey;

View File

@@ -30,6 +30,9 @@
#include <openssl/ec.h>
#include "mac.h"
#ifdef WITH_LEAKMALLOC
#include "leakmalloc.h"
#endif
#define KEX_COOKIE_LEN 16

View File

@@ -32,6 +32,10 @@
#include <openssl/dsa.h>
#include <openssl/ec.h>
#ifdef WITH_LEAKMALLOC
#include "leakmalloc.h"
#endif
#define SSH_RSA_MINIMUM_MODULUS_SIZE 768
/* XXX compat, remove when we can */

View File

@@ -23,6 +23,10 @@
#include <openssl/bn.h>
#include <openssl/ec.h>
#ifdef WITH_LEAKMALLOC
#include "leakmalloc.h"
#endif
#define SSHBUF_SIZE_MAX 0x20000000 /* Hard maximum size */
#define SSHBUF_MAX_BIGNUM (8192 / 8) /* Max bignum *bytes* */
#define SSHBUF_MAX_ECPOINT ((528 * 2 / 8) + 1) /* Max EC point *bytes* */

View File

@@ -6,11 +6,9 @@
CDIAGFLAGS= -Wall
CDIAGFLAGS+= -Werror
CDIAGFLAGS+= -Wpointer-arith
CDIAGFLAGS+= -Wuninitialized
CDIAGFLAGS+= -Wstrict-prototypes
CDIAGFLAGS+= -Wmissing-prototypes
CDIAGFLAGS+= -Wunused
CDIAGFLAGS+= -Wuninitialized
CDIAGFLAGS+= -Wsign-compare
CDIAGFLAGS+= -Wshadow
CDIAGFLAGS+= -Wformat
@@ -40,3 +38,22 @@ DPADD+=${.CURDIR}/../../ssh/lib/libssh.a
LDADD+= -lcrypto
DPADD+= ${LIBCRYPTO}
.if defined(LEAKMALLOC)
DEBUG= -g
COPTS= -O0
LEAKMALLOC_DIR= ${.CURDIR}/../../leakmalloc/leakmalloc
CFLAGS+= -I${LEAKMALLOC_DIR} -DWITH_LEAKMALLOC
LDFLAGS+= -L/usr/local/lib
LDADD+= -lleakmalloc -lexecinfo
. if exists(${LEAKMALLOC_DIR}/${__objdir})
LDADD+= -L${LEAKMALLOC_DIR}/${__objdir}
DPADD+= ${LEAKMALLOC_DIR}/${__objdir}/libleakmalloc.a
. else
LDADD+= -L${LEAKMALLOC_DIR}
DPADD+= ${LEAKMALLOC_DIR}/libleakmalloc.a
. endif
.else
CDIAGFLAGS+= -Wuninitialized
.endif