uECC_HashContext => const uECC_HashContext

This is an important piece of "documentation" as it indicates to the
caller that a uECC_HashContext can be initialized and subsequently
used multiple times (for multiple signatures).
This commit is contained in:
Andrew Ruder
2015-12-23 15:42:14 -06:00
parent 0d853de6d1
commit 451d53a62e
3 changed files with 14 additions and 12 deletions
+4 -4
View File
@@ -265,11 +265,11 @@ void finish_SHA256(uECC_HashContext *base, uint8_t *hash_result) {
}
*/
typedef struct uECC_HashContext {
void (*init_hash)(struct uECC_HashContext *context);
void (*update_hash)(struct uECC_HashContext *context,
void (*init_hash)(const struct uECC_HashContext *context);
void (*update_hash)(const struct uECC_HashContext *context,
const uint8_t *message,
unsigned message_size);
void (*finish_hash)(struct uECC_HashContext *context, uint8_t *hash_result);
void (*finish_hash)(const struct uECC_HashContext *context, uint8_t *hash_result);
unsigned block_size; /* Hash function block size in bytes, eg 64 for SHA-256. */
unsigned result_size; /* Hash function result size in bytes, eg 32 for SHA-256. */
uint8_t *tmp; /* Must point to a buffer of at least (2 * result_size + block_size) bytes. */
@@ -299,7 +299,7 @@ Returns 1 if the signature generated successfully, 0 if an error occurred.
int uECC_sign_deterministic(const uint8_t *private_key,
const uint8_t *message_hash,
unsigned hash_size,
uECC_HashContext *hash_context,
const uECC_HashContext *hash_context,
uint8_t *signature,
uECC_Curve curve);