Add ECIES_LEGACY_IV definition and fix cczp_init return type

This commit is contained in:
Ariel Abreu 2020-07-15 11:46:32 -04:00
parent 786e202c13
commit 553b0adc8f
No known key found for this signature in database
GPG Key ID: F4D43CC7053EA2B3
3 changed files with 4 additions and 2 deletions

View File

@ -9,6 +9,7 @@
#define ECIES_EPH_PUBKEY_IN_SHAREDINFO1 1
#define ECIES_EXPORT_PUB_STANDARD 2
#define ECIES_EXPORT_PUB_COMPACT 4
#define ECIES_LEGACY_IV 8 // is this right? someone please check
typedef struct ccecies_gcm {
const struct ccdigest_info *di;

View File

@ -128,7 +128,7 @@ CC_CONST CC_INLINE ccmod_prime_f *cczp_mod_prime(cczp_const_t zp)
return CCZP_CONST_T_ZP(zp)->mod_prime;
}
void cczp_init(cczp_t zp);
int cczp_init(cczp_t zp);
void cczp_mod(cczp_const_t zp, cc_unit *r, const cc_unit *s2n, cc_ws_t ws);

View File

@ -23,13 +23,14 @@ void shift_units_left(cc_size n, cc_unit* result, const cc_unit* operand, cc_siz
}
};
void cczp_init(cczp_t zp) {
int cczp_init(cczp_t zp) {
zp.zp->mod_prime = &cczp_mod;
const cc_unit* prime = cczp_prime(zp);
cc_size n = ccn_n(cczp_n(zp), prime);
ccn_make_recip(n, CCZP_RECIP(zp), prime);
return 0;
}
void cczp_mod(cczp_const_t zp, cc_unit* result, const cc_unit* operand, cc_ws_t ws) {