summaryrefslogtreecommitdiffstats
path: root/src/libgcrypt-test.c
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2012-04-22 14:36:06 (GMT)
committerTony Theodore <tonyt@logyst.com>2012-04-22 14:36:06 (GMT)
commit1cb26d3feb79d2cb8c1a7117207943f385f11b35 (patch)
tree67d05fc6b3d5f235d63861caa6fea6f6a033118c /src/libgcrypt-test.c
parent6ead4f1cde43f1b234b7fddda633eb60bf65638f (diff)
downloadmxe-1cb26d3feb79d2cb8c1a7117207943f385f11b35.zip
mxe-1cb26d3feb79d2cb8c1a7117207943f385f11b35.tar.gz
mxe-1cb26d3feb79d2cb8c1a7117207943f385f11b35.tar.bz2
package libgcrypt: add test program and prefixed libgcrypt-config
Diffstat (limited to 'src/libgcrypt-test.c')
-rw-r--r--src/libgcrypt-test.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/libgcrypt-test.c b/src/libgcrypt-test.c
new file mode 100644
index 0000000..5b4ec31
--- /dev/null
+++ b/src/libgcrypt-test.c
@@ -0,0 +1,32 @@
+/*
+ * This file is part of MXE.
+ * See index.html for further information.
+ */
+
+#include <stdio.h>
+#include <gcrypt.h>
+
+int main(int argc, char *argv[])
+{
+ (void)argc;
+ (void)argv;
+
+ if (!gcry_check_version (GCRYPT_VERSION)) {
+ fputs ("libgcrypt version mismatch\n", stderr);
+ exit (2);
+ }
+
+ 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);
+
+ if (!gcry_control (GCRYCTL_INITIALIZATION_FINISHED_P)) {
+ fputs ("libgcrypt has not been initialized\n", stderr);
+ abort ();
+ }
+
+ printf("gcrypt version: %s", GCRYPT_VERSION );
+
+ return 0;
+}