1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

build: don't use const for ed25519/cosi if gcc<5

This commit is contained in:
Pavol Rusnak 2017-04-02 02:51:09 +02:00
parent b666039f66
commit 900f4b0756
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 14 additions and 6 deletions

View File

@ -45,7 +45,7 @@ ed25519_publickey(const ed25519_secret_key sk, ed25519_public_key pk) {
} }
int int
ed25519_cosi_combine_publickeys(ed25519_public_key res, const ed25519_public_key *pks, size_t n) { ed25519_cosi_combine_publickeys(ed25519_public_key res, CONST ed25519_public_key *pks, size_t n) {
size_t i = 0; size_t i = 0;
ge25519 P; ge25519 P;
ge25519_pniels sump; ge25519_pniels sump;
@ -76,7 +76,7 @@ ed25519_cosi_combine_publickeys(ed25519_public_key res, const ed25519_public_key
} }
void void
ed25519_cosi_combine_signatures(ed25519_signature res, const ed25519_public_key R, const ed25519_cosi_signature *sigs, size_t n) { ed25519_cosi_combine_signatures(ed25519_signature res, const ed25519_public_key R, CONST ed25519_cosi_signature *sigs, size_t n) {
bignum256modm s, t; bignum256modm s, t;
size_t i = 0; size_t i = 0;

View File

@ -5,24 +5,32 @@
extern "C" { extern "C" {
#endif #endif
typedef unsigned char ed25519_cosi_signature[32];
typedef unsigned char ed25519_signature[64]; typedef unsigned char ed25519_signature[64];
typedef unsigned char ed25519_public_key[32]; typedef unsigned char ed25519_public_key[32];
typedef unsigned char ed25519_secret_key[32]; typedef unsigned char ed25519_secret_key[32];
typedef unsigned char curve25519_key[32]; typedef unsigned char curve25519_key[32];
typedef unsigned char ed25519_cosi_signature[32];
void ed25519_publickey(const ed25519_secret_key sk, ed25519_public_key pk); void ed25519_publickey(const ed25519_secret_key sk, ed25519_public_key pk);
int ed25519_cosi_combine_publickeys(ed25519_public_key res, const ed25519_public_key *pks, size_t n);
void ed25519_cosi_combine_signatures(ed25519_signature res, const ed25519_public_key R, const ed25519_cosi_signature *sigs, size_t n);
void ed25519_cosi_sign(const unsigned char *m, size_t mlen, const ed25519_secret_key key, const ed25519_secret_key nonce, const ed25519_public_key R, const ed25519_public_key pk, ed25519_cosi_signature sig);
int ed25519_sign_open(const unsigned char *m, size_t mlen, const ed25519_public_key pk, const ed25519_signature RS); int ed25519_sign_open(const unsigned char *m, size_t mlen, const ed25519_public_key pk, const ed25519_signature RS);
void ed25519_sign(const unsigned char *m, size_t mlen, const ed25519_secret_key sk, const ed25519_public_key pk, ed25519_signature RS); void ed25519_sign(const unsigned char *m, size_t mlen, const ed25519_secret_key sk, const ed25519_public_key pk, ed25519_signature RS);
void curve25519_scalarmult(curve25519_key mypublic, const curve25519_key secret, const curve25519_key basepoint); void curve25519_scalarmult(curve25519_key mypublic, const curve25519_key secret, const curve25519_key basepoint);
void curve25519_scalarmult_basepoint(curve25519_key mypublic, const curve25519_key secret); void curve25519_scalarmult_basepoint(curve25519_key mypublic, const curve25519_key secret);
#if __GNUC__ > 4
#define CONST const
#else
#define CONST
#endif
int ed25519_cosi_combine_publickeys(ed25519_public_key res, CONST ed25519_public_key *pks, size_t n);
void ed25519_cosi_combine_signatures(ed25519_signature res, const ed25519_public_key R, CONST ed25519_cosi_signature *sigs, size_t n);
void ed25519_cosi_sign(const unsigned char *m, size_t mlen, const ed25519_secret_key key, const ed25519_secret_key nonce, const ed25519_public_key R, const ed25519_public_key pk, ed25519_cosi_signature sig);
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif