From 807d1979262068c0679c4533eb23952f449ded61 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 27 May 2021 08:04:26 +0000 Subject: Add backtrace invocation to debug spurious get_pkey call --- src/sbearssl/sbearssl_x509_small_vtable.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/sbearssl') diff --git a/src/sbearssl/sbearssl_x509_small_vtable.c b/src/sbearssl/sbearssl_x509_small_vtable.c index d589c94..8fc7f46 100644 --- a/src/sbearssl/sbearssl_x509_small_vtable.c +++ b/src/sbearssl/sbearssl_x509_small_vtable.c @@ -1,5 +1,12 @@ /* ISC license. */ +#ifdef DEBUG +#include +#define getbt() do { void *stack[512] ; int r = backtrace(stack, 512) ; backtrace_symbols_fd(stack, r, 2) ; } while (0) +#else +#define getbt() +#endif + #include #include @@ -22,8 +29,9 @@ static void start_cert (br_x509_class const **c, uint32_t len) sbearssl_x509_small_context *ctx = INSTANCE(c) ; ctx->minimal.vtable->start_cert(&ctx->minimal.vtable, len) ; - LOLDEBUG("small_context: start_cert %u", ctx->i) ; if (!ctx->i) br_sha256_init(&ctx->hashctx) ; + LOLDEBUG("small_context: start_cert %u", ctx->i) ; + getbt() ; } static void append (br_x509_class const **c, unsigned char const *s, size_t len) @@ -68,6 +76,7 @@ static br_x509_pkey const *get_pkey(br_x509_class const *const *c, unsigned int { sbearssl_x509_small_context *ctx = INSTANCE(c) ; LOLDEBUG("small_context: get_pkey") ; + getbt() ; return ctx->minimal.vtable->get_pkey(&ctx->minimal.vtable, usages) ; } -- cgit v1.2.3