Skip to content

Commit 082b7e0

Browse files
committed
src/wolfcrypto_shim.h: in chacha20poly1305_encrypt(), always log error if wc_ChaCha20Poly1305_Final() returns nonzero. fixes new -Wunused-result.
1 parent b3bc227 commit 082b7e0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/wolfcrypto_shim.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,17 @@
5555
#include <linux/kernel.h>
5656
#include <linux/scatterlist.h>
5757

58+
#define PRNT_NZ(...) \
59+
({ \
60+
int _ret = (__VA_ARGS__); \
61+
if (_ret) { \
62+
printk(KERN_NOTICE "%s@%d: %d\n", __FILE__, __LINE__, _ret); \
63+
} \
64+
_ret;
65+
})
66+
5867
#ifdef DEBUG
59-
#define DBG_PRNT_NZ(...) ({ int _ret = (__VA_ARGS__); \
60-
if (_ret) \
61-
printk(KERN_NOTICE "%s@%d: %d\n", __FILE__, __LINE__, _ret); _ret; \
62-
})
68+
#define DBG_PRNT_NZ(...) PRNT_NZ(__VA_ARGS__)
6369
#else
6470
#define DBG_PRNT_NZ(...) (__VA_ARGS__)
6571
#endif
@@ -168,7 +174,7 @@ chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len,
168174
if (src_len)
169175
DBG_PRNT_NZ(wc_ChaCha20Poly1305_UpdateData(&aead, src, dst,
170176
(u32)src_len));
171-
DBG_PRNT_NZ(wc_ChaCha20Poly1305_Final(&aead, dst + src_len));
177+
PRNT_NZ(wc_ChaCha20Poly1305_Final(&aead, dst + src_len));
172178
}
173179

174180
static inline __attribute__((unused)) bool

0 commit comments

Comments
 (0)