Use stdint types where reasonable

Using uint32_t instead of unsigned int for the unpacked work struct ensures
the code is working correctly on ABIs with ints narrower than 32 bits.

While this would constitute a API/ABI change on some systems in theory,
most likely all systems using libuecc so far have uint8_t == unsigned char
and uint32_t == unsigned int.

Also, coding style cleanup.
This commit is contained in:
Matthias Schiffer 2015-10-06 21:16:36 +02:00
parent 89f8a35c71
commit c917cec3ef
3 changed files with 173 additions and 116 deletions

View file

@ -27,6 +27,9 @@
#ifndef _LIBUECC_ECC_H_
#define _LIBUECC_ECC_H_
#include <stdint.h>
/**
* A 256 bit integer
*
@ -34,7 +37,7 @@
*/
typedef union _ecc_int256 {
/** Data bytes */
unsigned char p[32];
uint8_t p[32];
} ecc_int256_t;
/**
@ -44,10 +47,10 @@ typedef union _ecc_int256 {
* it should always be packed.
*/
typedef struct _ecc_25519_work {
unsigned int X[32];
unsigned int Y[32];
unsigned int Z[32];
unsigned int T[32];
uint32_t X[32];
uint32_t Y[32];
uint32_t Z[32];
uint32_t T[32];
} ecc_25519_work_t;
/**