summaryrefslogtreecommitdiff
path: root/md5_utils.c
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2016-05-04 19:22:23 -0700
committerJames Zern <jzern@google.com>2016-05-04 19:23:47 -0700
commitf26fccf3b294d538ddcfde00a35e0de2080c1cee (patch)
treef37ff33dd3a0881c5db11556e853025f3bcf53e5 /md5_utils.c
parent3d7e2677dfc4c4cd9c508e905e0800f449f9c3e5 (diff)
downloadlibvpx-f26fccf3b294d538ddcfde00a35e0de2080c1cee.tar
libvpx-f26fccf3b294d538ddcfde00a35e0de2080c1cee.tar.gz
libvpx-f26fccf3b294d538ddcfde00a35e0de2080c1cee.tar.bz2
libvpx-f26fccf3b294d538ddcfde00a35e0de2080c1cee.zip
md5_utils,MD5Transform: don't check for unsigned overflow
this transform is well-defined and relies on unsigned rollover Change-Id: Ia39f3a65a7a07ac871bf857d2684c9839862c2aa
Diffstat (limited to 'md5_utils.c')
-rw-r--r--md5_utils.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/md5_utils.c b/md5_utils.c
index f4f893a2d..a9b979a41 100644
--- a/md5_utils.c
+++ b/md5_utils.c
@@ -150,12 +150,23 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx) {
#define MD5STEP(f,w,x,y,z,in,s) \
(w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
+#if defined(__clang__) && defined(__has_attribute)
+#if __has_attribute(no_sanitize)
+#define VPX_NO_UNSIGNED_OVERFLOW_CHECK \
+ __attribute__((no_sanitize("unsigned-integer-overflow")))
+#endif
+#endif
+
+#ifndef VPX_NO_UNSIGNED_OVERFLOW_CHECK
+#define VPX_NO_UNSIGNED_OVERFLOW_CHECK
+#endif
+
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
-void
+VPX_NO_UNSIGNED_OVERFLOW_CHECK void
MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) {
register UWORD32 a, b, c, d;
@@ -238,4 +249,6 @@ MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) {
buf[3] += d;
}
+#undef VPX_NO_UNSIGNED_OVERFLOW_CHECK
+
#endif