mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-05 20:55:46 +03:00
cmake: detect "bounded" compiler attribute
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
acc1ade74a
commit
ebd76bf347
@@ -327,6 +327,11 @@ int main(void) {
|
|||||||
}" HAVE_COMPILER__FUNCTION__)
|
}" HAVE_COMPILER__FUNCTION__)
|
||||||
|
|
||||||
|
|
||||||
|
check_c_source_compiles("
|
||||||
|
void chacha_keysetup(struct chacha_ctx *x, const u_char *k, u_int kbits)
|
||||||
|
__attribute__((__bounded__(__minbytes__, 2, CHACHA_MINKEYLEN)));
|
||||||
|
int main(void) { return 0; }" HAVE_GCC_BOUNDED_ATTRIBUTE)
|
||||||
|
|
||||||
if (WITH_DEBUG_CRYPTO)
|
if (WITH_DEBUG_CRYPTO)
|
||||||
set(DEBUG_CRYPTO 1)
|
set(DEBUG_CRYPTO 1)
|
||||||
endif (WITH_DEBUG_CRYPTO)
|
endif (WITH_DEBUG_CRYPTO)
|
||||||
|
@@ -199,6 +199,8 @@
|
|||||||
#cmakedefine HAVE_COMPILER__FUNC__ 1
|
#cmakedefine HAVE_COMPILER__FUNC__ 1
|
||||||
#cmakedefine HAVE_COMPILER__FUNCTION__ 1
|
#cmakedefine HAVE_COMPILER__FUNCTION__ 1
|
||||||
|
|
||||||
|
#cmakedefine HAVE_GCC_BOUNDED_ATTRIBUTE 1
|
||||||
|
|
||||||
/* Define to 1 if you want to enable GSSAPI */
|
/* Define to 1 if you want to enable GSSAPI */
|
||||||
#cmakedefine WITH_GSSAPI 1
|
#cmakedefine WITH_GSSAPI 1
|
||||||
|
|
||||||
|
@@ -20,13 +20,22 @@ struct chacha_ctx {
|
|||||||
#define CHACHA_BLOCKLEN 64
|
#define CHACHA_BLOCKLEN 64
|
||||||
|
|
||||||
void chacha_keysetup(struct chacha_ctx *x, const uint8_t *k, uint32_t kbits)
|
void chacha_keysetup(struct chacha_ctx *x, const uint8_t *k, uint32_t kbits)
|
||||||
__attribute__((__bounded__(__minbytes__, 2, CHACHA_MINKEYLEN)));
|
#ifdef HAVE_GCC_BOUNDED_ATTRIBUTE
|
||||||
|
__attribute__((__bounded__(__minbytes__, 2, CHACHA_MINKEYLEN)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
void chacha_ivsetup(struct chacha_ctx *x, const uint8_t *iv, const uint8_t *ctr)
|
void chacha_ivsetup(struct chacha_ctx *x, const uint8_t *iv, const uint8_t *ctr)
|
||||||
|
#ifdef HAVE_GCC_BOUNDED_ATTRIBUTE
|
||||||
__attribute__((__bounded__(__minbytes__, 2, CHACHA_NONCELEN)))
|
__attribute__((__bounded__(__minbytes__, 2, CHACHA_NONCELEN)))
|
||||||
__attribute__((__bounded__(__minbytes__, 3, CHACHA_CTRLEN)));
|
__attribute__((__bounded__(__minbytes__, 3, CHACHA_CTRLEN)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
void chacha_encrypt_bytes(struct chacha_ctx *x, const uint8_t *m,
|
void chacha_encrypt_bytes(struct chacha_ctx *x, const uint8_t *m,
|
||||||
uint8_t *c, uint32_t bytes)
|
uint8_t *c, uint32_t bytes)
|
||||||
|
#ifdef HAVE_GCC_BOUNDED_ATTRIBUTE
|
||||||
__attribute__((__bounded__(__buffer__, 2, 4)))
|
__attribute__((__bounded__(__buffer__, 2, 4)))
|
||||||
__attribute__((__bounded__(__buffer__, 3, 4)));
|
__attribute__((__bounded__(__buffer__, 3, 4)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
#endif /* CHACHA_H */
|
#endif /* CHACHA_H */
|
||||||
|
@@ -11,8 +11,11 @@
|
|||||||
|
|
||||||
void poly1305_auth(uint8_t out[POLY1305_TAGLEN], const uint8_t *m, size_t inlen,
|
void poly1305_auth(uint8_t out[POLY1305_TAGLEN], const uint8_t *m, size_t inlen,
|
||||||
const uint8_t key[POLY1305_KEYLEN])
|
const uint8_t key[POLY1305_KEYLEN])
|
||||||
|
#ifdef HAVE_GCC_BOUNDED_ATTRIBUTE
|
||||||
__attribute__((__bounded__(__minbytes__, 1, POLY1305_TAGLEN)))
|
__attribute__((__bounded__(__minbytes__, 1, POLY1305_TAGLEN)))
|
||||||
__attribute__((__bounded__(__buffer__, 2, 3)))
|
__attribute__((__bounded__(__buffer__, 2, 3)))
|
||||||
__attribute__((__bounded__(__minbytes__, 4, POLY1305_KEYLEN)));
|
__attribute__((__bounded__(__minbytes__, 4, POLY1305_KEYLEN)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
#endif /* POLY1305_H */
|
#endif /* POLY1305_H */
|
||||||
|
Reference in New Issue
Block a user