]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Add ATTR_UNSIGNED_WRAPS to fix various ubsan issues
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 16 Aug 2021 12:36:37 +0000 (15:36 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 18 Aug 2021 06:41:11 +0000 (06:41 +0000)
src/auth/crypt-blowfish.c
src/lib/numpack.c
src/lib/sha3.c

index afb2841b0737f01c32bf8ccc76aacdc3dc592b9c..460f8cf6889ab4be2c48c3c057df3d36af0001cf 100644 (file)
@@ -437,7 +437,8 @@ static void BF_encode(char *dst, const BF_word *src, size_t size)
        } while (sptr < end);
 }
 
-static void BF_swap(BF_word *x, int count)
+static void ATTR_UNSIGNED_WRAPS
+BF_swap(BF_word *x, int count)
 {
        static int endianness_check = 1;
        char *is_little_endian = (char *)&endianness_check;
@@ -534,7 +535,8 @@ static void BF_swap(BF_word *x, int count)
                *(ptr - 1) = R; \
        } while (ptr < &data.ctx.S[3][0xFF]);
 
-static void BF_set_key(const char *key, BF_key expanded, BF_key initial,
+static void ATTR_UNSIGNED_WRAPS
+BF_set_key(const char *key, BF_key expanded, BF_key initial,
     unsigned char flags)
 {
        const char *ptr = key;
index 51cc0271edb36f806bece7bee50c6e1e646c169c..8a59f3a01d5cf69223504c499a0a7524d784f594 100644 (file)
@@ -16,6 +16,7 @@ void numpack_encode(buffer_t *buf, uint64_t num)
 }
 
 int numpack_decode(const uint8_t **p, const uint8_t *end, uint64_t *num_r)
+       ATTR_UNSIGNED_WRAPS
 {
        const uint8_t *c = *p;
        uint64_t value = 0;
index a8c0b14d5d5c6873c6a2ed765a75851de9d35821..3b40ddd524aa0f4b9055343f49409f6f862a3af5 100644 (file)
@@ -69,7 +69,7 @@ static const unsigned keccakf_piln[24] = {
 /* generally called after SHA3_KECCAK_SPONGE_WORDS-ctx->capacityWords words
  * are XORed into the state s
  */
-static void
+static void ATTR_UNSIGNED_WRAPS
 keccakf(uint64_t s[25])
 {
        int i, j, round;