mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-12-22 12:31:07 +00:00
Fix various cast-qual bugs.
This commit is contained in:
parent
dfa89d80d8
commit
a98753b6ef
4 changed files with 27 additions and 27 deletions
|
@ -75,10 +75,10 @@ cryb_be32enc(void *p, uint32_t u32)
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
cryb_be32dec(const void *p)
|
cryb_be32dec(const void *p)
|
||||||
{
|
{
|
||||||
return ((uint32_t)((uint8_t *)p)[3] |
|
return ((uint32_t)((const uint8_t *)p)[3] |
|
||||||
(uint32_t)((uint8_t *)p)[2] << 8 |
|
(uint32_t)((const uint8_t *)p)[2] << 8 |
|
||||||
(uint32_t)((uint8_t *)p)[1] << 16 |
|
(uint32_t)((const uint8_t *)p)[1] << 16 |
|
||||||
(uint32_t)((uint8_t *)p)[0] << 24);
|
(uint32_t)((const uint8_t *)p)[0] << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -97,14 +97,14 @@ cryb_be64enc(void *p, uint64_t u64)
|
||||||
static inline uint64_t
|
static inline uint64_t
|
||||||
cryb_be64dec(const void *p)
|
cryb_be64dec(const void *p)
|
||||||
{
|
{
|
||||||
return ((uint64_t)((uint8_t *)p)[7] |
|
return ((uint64_t)((const uint8_t *)p)[7] |
|
||||||
(uint64_t)((uint8_t *)p)[6] << 8 |
|
(uint64_t)((const uint8_t *)p)[6] << 8 |
|
||||||
(uint64_t)((uint8_t *)p)[5] << 16 |
|
(uint64_t)((const uint8_t *)p)[5] << 16 |
|
||||||
(uint64_t)((uint8_t *)p)[4] << 24 |
|
(uint64_t)((const uint8_t *)p)[4] << 24 |
|
||||||
(uint64_t)((uint8_t *)p)[3] << 32 |
|
(uint64_t)((const uint8_t *)p)[3] << 32 |
|
||||||
(uint64_t)((uint8_t *)p)[2] << 40 |
|
(uint64_t)((const uint8_t *)p)[2] << 40 |
|
||||||
(uint64_t)((uint8_t *)p)[1] << 48 |
|
(uint64_t)((const uint8_t *)p)[1] << 48 |
|
||||||
(uint64_t)((uint8_t *)p)[0] << 56);
|
(uint64_t)((const uint8_t *)p)[0] << 56);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -119,10 +119,10 @@ cryb_le32enc(void *p, uint32_t u32)
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
cryb_le32dec(const void *p)
|
cryb_le32dec(const void *p)
|
||||||
{
|
{
|
||||||
return ((uint32_t)((uint8_t *)p)[0] |
|
return ((uint32_t)((const uint8_t *)p)[0] |
|
||||||
(uint32_t)((uint8_t *)p)[1] << 8 |
|
(uint32_t)((const uint8_t *)p)[1] << 8 |
|
||||||
(uint32_t)((uint8_t *)p)[2] << 16 |
|
(uint32_t)((const uint8_t *)p)[2] << 16 |
|
||||||
(uint32_t)((uint8_t *)p)[3] << 24);
|
(uint32_t)((const uint8_t *)p)[3] << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -141,14 +141,14 @@ cryb_le64enc(void *p, uint64_t u64)
|
||||||
static inline uint64_t
|
static inline uint64_t
|
||||||
cryb_le64dec(const void *p)
|
cryb_le64dec(const void *p)
|
||||||
{
|
{
|
||||||
return ((uint64_t)((uint8_t *)p)[0] |
|
return ((uint64_t)((const uint8_t *)p)[0] |
|
||||||
(uint64_t)((uint8_t *)p)[1] << 8 |
|
(uint64_t)((const uint8_t *)p)[1] << 8 |
|
||||||
(uint64_t)((uint8_t *)p)[2] << 16 |
|
(uint64_t)((const uint8_t *)p)[2] << 16 |
|
||||||
(uint64_t)((uint8_t *)p)[3] << 24 |
|
(uint64_t)((const uint8_t *)p)[3] << 24 |
|
||||||
(uint64_t)((uint8_t *)p)[4] << 32 |
|
(uint64_t)((const uint8_t *)p)[4] << 32 |
|
||||||
(uint64_t)((uint8_t *)p)[5] << 40 |
|
(uint64_t)((const uint8_t *)p)[5] << 40 |
|
||||||
(uint64_t)((uint8_t *)p)[6] << 48 |
|
(uint64_t)((const uint8_t *)p)[6] << 48 |
|
||||||
(uint64_t)((uint8_t *)p)[7] << 56);
|
(uint64_t)((const uint8_t *)p)[7] << 56);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
*/
|
*/
|
||||||
#undef GET_ULONG_LE
|
#undef GET_ULONG_LE
|
||||||
#define GET_ULONG_LE(n,b,i) \
|
#define GET_ULONG_LE(n,b,i) \
|
||||||
do { (n) = le32dec((uint8_t *)(b) + (i)); } while (0)
|
do { (n) = le32dec((const uint8_t *)(b) + (i)); } while (0)
|
||||||
|
|
||||||
#undef PUT_ULONG_LE
|
#undef PUT_ULONG_LE
|
||||||
#define PUT_ULONG_LE(n,b,i) \
|
#define PUT_ULONG_LE(n,b,i) \
|
||||||
|
|
|
@ -279,7 +279,7 @@ void sha384_final( sha384_ctx *ctx, uint8_t *output )
|
||||||
last = (int)( ctx->total[0] & 0x7F );
|
last = (int)( ctx->total[0] & 0x7F );
|
||||||
padn = ( last < 112 ) ? ( 112 - last ) : ( 240 - last );
|
padn = ( last < 112 ) ? ( 112 - last ) : ( 240 - last );
|
||||||
|
|
||||||
sha384_update( ctx, (uint8_t *) sha384_padding, padn );
|
sha384_update( ctx, (const uint8_t *) sha384_padding, padn );
|
||||||
sha384_update( ctx, msglen, 16 );
|
sha384_update( ctx, msglen, 16 );
|
||||||
|
|
||||||
PUT_UINT64_BE( ctx->state[0], output, 0 );
|
PUT_UINT64_BE( ctx->state[0], output, 0 );
|
||||||
|
|
|
@ -279,7 +279,7 @@ void sha512_final( sha512_ctx *ctx, uint8_t *output )
|
||||||
last = (int)( ctx->total[0] & 0x7F );
|
last = (int)( ctx->total[0] & 0x7F );
|
||||||
padn = ( last < 112 ) ? ( 112 - last ) : ( 240 - last );
|
padn = ( last < 112 ) ? ( 112 - last ) : ( 240 - last );
|
||||||
|
|
||||||
sha512_update( ctx, (uint8_t *) sha512_padding, padn );
|
sha512_update( ctx, (const uint8_t *) sha512_padding, padn );
|
||||||
sha512_update( ctx, msglen, 16 );
|
sha512_update( ctx, msglen, 16 );
|
||||||
|
|
||||||
PUT_UINT64_BE( ctx->state[0], output, 0 );
|
PUT_UINT64_BE( ctx->state[0], output, 0 );
|
||||||
|
|
Loading…
Reference in a new issue