[riot-notifications] [RIOT] add sha256 implementation (#96)

Oleg Hahm notifications at github.com
Fri Aug 9 17:24:36 CEST 2013


> +
> +#else /* __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__ */
> +
> +static void be32enc(void *pp, uint32_t u)
> +{
> +    unsigned char *p = pp;
> +    p[0] = (u >> 24) & 0xff;
> +    p[1] = (u >> 16) & 0xff;
> +    p[2] = (u >>  8) & 0xff;
> +    p[3] = (u >>  0) & 0xff;
> +}
> +
> +static uint32_t be32dec(const void *pp)
> +{
> +    unsigned char const *p = pp;
> +    return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);

For a MSP-430 I got:
```
sha256.c: In function ‘be32dec’:
sha256.c:55:5: warning: left shift count >= width of type [enabled by default]
sha256.c:55:5: warning: left shift count >= width of type [enabled by default]
```
leading to wrong results.

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/96/files#r5685446
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20130809/9be9e1df/attachment.html>


More information about the notifications mailing list