aboutsummaryrefslogtreecommitdiff
path: root/scratchpad/scratchpad.c
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-10-30 19:59:52 +0100
committerDennis Brentjes <d.brentjes@gmail.com>2016-10-30 20:00:41 +0100
commit7ecf4ae11df97efa2113dad8855eb8d9cb1a9498 (patch)
treee1db61559ececd182488d78b52b0d75ee0eca3f1 /scratchpad/scratchpad.c
parenta3e62d3bc6e7f75949726f9a8dafe03e757e869b (diff)
downloadcmix-7ecf4ae11df97efa2113dad8855eb8d9cb1a9498.tar.gz
cmix-7ecf4ae11df97efa2113dad8855eb8d9cb1a9498.tar.bz2
cmix-7ecf4ae11df97efa2113dad8855eb8d9cb1a9498.zip
Adds a small testcase to trace down the memory leaks I was having.
Diffstat (limited to 'scratchpad/scratchpad.c')
-rw-r--r--scratchpad/scratchpad.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/scratchpad/scratchpad.c b/scratchpad/scratchpad.c
index 1cb2e56..49a484f 100644
--- a/scratchpad/scratchpad.c
+++ b/scratchpad/scratchpad.c
@@ -8,13 +8,35 @@
#include <stdio.h>
#include <string.h>
+#include <stddef.h>
void cmix_buffer_scratch();
void crypto_api_scratch();
void gcrypt_scratch();
int main(int argc, char* argv[]) {
- gcrypt_scratch();
+ if (!gcry_check_version (GCRYPT_VERSION)) {
+ fprintf(stderr, "libgcrypt version mismatch\n");
+ exit(-1);
+ }
+
+ gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
+ gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
+ gcry_control (GCRYCTL_RESUME_SECMEM_WARN);
+ gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+
+ size_t parse_error_offset;
+ gcry_error_t error;
+
+ char bytes[] = "a";
+ gcry_mpi_t x;// = gcry_mpi_snew(0);
+ error = gcry_mpi_scan(&x, GCRYMPI_FMT_USG, bytes, 1, &parse_error_offset);
+
+ gcry_mpi_release(x);
+
+ if(error) {
+ return -1;
+ }
return 0;
}