summaryrefslogtreecommitdiff
path: root/src/sbearssl
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-05-27 08:04:26 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2021-05-27 08:04:26 +0000
commit807d1979262068c0679c4533eb23952f449ded61 (patch)
treea0ae017c3639b789c6724006d8496cc2d43efb97 /src/sbearssl
parentb7e1d8b5b4d09379b7652f77372f5d666f439b91 (diff)
downloads6-networking-807d1979262068c0679c4533eb23952f449ded61.tar.xz
Add backtrace invocation to debug spurious get_pkey call
Diffstat (limited to 'src/sbearssl')
-rw-r--r--src/sbearssl/sbearssl_x509_small_vtable.c11
1 files changed, 10 insertions, 1 deletions
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 <execinfo.h>
+#define getbt() do { void *stack[512] ; int r = backtrace(stack, 512) ; backtrace_symbols_fd(stack, r, 2) ; } while (0)
+#else
+#define getbt()
+#endif
+
#include <bearssl.h>
#include <skalibs/lolstdio.h>
@@ -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) ;
}