summaryrefslogtreecommitdiff
path: root/src/g10lib.h
diff options
context:
space:
mode:
authorXi Wang <xi.wang@gmail.com>2012-08-14 18:54:40 -0400
committerWerner Koch <wk@gnupg.org>2012-08-16 10:48:03 +0200
commit2c54c4da19d3a79e9f749740828026dd41f0521a (patch)
treeacd346d2c038018c59db3697cc07e8fb0d36e073 /src/g10lib.h
parent2196728e2252917849c1be94417258076767021b (diff)
downloadlibgcrypt-2c54c4da19d3a79e9f749740828026dd41f0521a.tar.gz
Replace deliberate division by zero with _gcry_divide_by_zero.
* mpi/mpi-pow.c: Replace 1 / msize. * mpi/mpih-div.c: Replace 1 / dsize. * src/misc.c: Add _gcry_divide_by_zero. -- 1) Division by zero doesn't "provoke a signal" on architectures like PowerPC. 2) C compilers like clang will optimize away these divisions, even though the code tries "to make the compiler not remove" them. This patch redirects these cases to _gcry_divide_by_zero.
Diffstat (limited to 'src/g10lib.h')
-rw-r--r--src/g10lib.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/g10lib.h b/src/g10lib.h
index ec86c976..c580c085 100644
--- a/src/g10lib.h
+++ b/src/g10lib.h
@@ -101,6 +101,8 @@ void _gcry_bug (const char *file, int line);
void _gcry_assert_failed (const char *expr, const char *file, int line);
#endif
+void _gcry_divide_by_zero (void) JNLIB_GCC_A_NR;
+
const char *_gcry_gettext (const char *key) GCC_ATTR_FORMAT_ARG(1);
void _gcry_fatal_error(int rc, const char *text ) JNLIB_GCC_A_NR;
void _gcry_log( int level, const char *fmt, ... ) JNLIB_GCC_A_PRINTF(2,3);