Merge pull request #8634 from daverodgman/iar-fixes
IAR warning fix & some improvements
This commit is contained in:
commit
a69c782351
2 changed files with 27 additions and 2 deletions
|
@ -180,6 +180,16 @@ inline void mbedtls_put_unaligned_uint64(void *p, uint64_t x)
|
||||||
#define MBEDTLS_BSWAP32 __rev
|
#define MBEDTLS_BSWAP32 __rev
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Detect IAR built-in byteswap routine */
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#if defined(__ARM_ACLE)
|
||||||
|
#include <arm_acle.h>
|
||||||
|
#define MBEDTLS_BSWAP16(x) ((uint16_t) __rev16((uint32_t) (x)))
|
||||||
|
#define MBEDTLS_BSWAP32 __rev
|
||||||
|
#define MBEDTLS_BSWAP64 __revll
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Where compiler built-ins are not present, fall back to C code that the
|
* Where compiler built-ins are not present, fall back to C code that the
|
||||||
* compiler may be able to detect and transform into the relevant bswap or
|
* compiler may be able to detect and transform into the relevant bswap or
|
||||||
|
@ -224,10 +234,25 @@ static inline uint64_t mbedtls_bswap64(uint64_t x)
|
||||||
#endif /* !defined(MBEDTLS_BSWAP64) */
|
#endif /* !defined(MBEDTLS_BSWAP64) */
|
||||||
|
|
||||||
#if !defined(__BYTE_ORDER__)
|
#if !defined(__BYTE_ORDER__)
|
||||||
|
|
||||||
|
#if defined(__LITTLE_ENDIAN__)
|
||||||
|
/* IAR defines __xxx_ENDIAN__, but not __BYTE_ORDER__ */
|
||||||
|
#define MBEDTLS_IS_BIG_ENDIAN 0
|
||||||
|
#elif defined(__BIG_ENDIAN__)
|
||||||
|
#define MBEDTLS_IS_BIG_ENDIAN 1
|
||||||
|
#else
|
||||||
static const uint16_t mbedtls_byte_order_detector = { 0x100 };
|
static const uint16_t mbedtls_byte_order_detector = { 0x100 };
|
||||||
#define MBEDTLS_IS_BIG_ENDIAN (*((unsigned char *) (&mbedtls_byte_order_detector)) == 0x01)
|
#define MBEDTLS_IS_BIG_ENDIAN (*((unsigned char *) (&mbedtls_byte_order_detector)) == 0x01)
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define MBEDTLS_IS_BIG_ENDIAN ((__BYTE_ORDER__) == (__ORDER_BIG_ENDIAN__))
|
|
||||||
|
#if (__BYTE_ORDER__) == (__ORDER_BIG_ENDIAN__)
|
||||||
|
#define MBEDTLS_IS_BIG_ENDIAN 1
|
||||||
|
#else
|
||||||
|
#define MBEDTLS_IS_BIG_ENDIAN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* !defined(__BYTE_ORDER__) */
|
#endif /* !defined(__BYTE_ORDER__) */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -91,7 +91,7 @@ int mbedtls_ccm_setkey(mbedtls_ccm_context *ctx,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue