.\"
.\" ----------------------------------------------------------------------------
.\"
-.\" Copyright (c) 2019 Fabio Scotoni
+.\" Copyright (c) 2019-2020 Fabio Scotoni
.\" All rights reserved.
.\"
.\"
.\"
.\" ----------------------------------------------------------------------------
.\"
-.\" Written in 2019 by Fabio Scotoni
+.\" Written in 2019-2020 by Fabio Scotoni
.\"
.\" To the extent possible under law, the author(s) have dedicated all copyright
.\" and related neighboring rights to this software to the public domain
static void
my_init(void *ctx)
{
- struct outer_ctx *octx = ctx;
+ struct outer_ctx *octx = (struct outer_ctx *)ctx;
SHA512Init(&octx->hash_ctx);
}
static void
my_update(void *ctx, const uint8_t *msg, size_t len)
{
- struct outer_ctx *octx = ctx;
+ struct outer_ctx *octx = (struct outer_ctx *)ctx;
SHA512Update(&octx->hash_ctx, msg, len);
}
static void
my_final(void *ctx, uint8_t *hash)
{
- struct outer_ctx *octx = ctx;
+ struct outer_ctx *octx = (struct outer_ctx *)ctx;
SHA512Final(hash, &octx->hash_ctx);
}
crypto_ed25519_sign(theirs, sk, NULL, msg, sizeof(msg));
struct outer_ctx ctx;
- crypto_sign_init_first_pass_custom_hash((void*)&ctx,
+ crypto_sign_ctx_abstract *actx = (crypto_sign_ctx_abstract*)&ctx;
+ crypto_sign_init_first_pass_custom_hash(actx,
sk, NULL, &my_vtable);
crypto_wipe(sk, sizeof(sk));
- crypto_sign_update( (void*)&ctx, msg, sizeof(msg));
- crypto_sign_init_second_pass((void*)&ctx);
- crypto_sign_update( (void*)&ctx, msg, sizeof(msg));
- crypto_sign_final( (void*)&ctx, mine);
+ crypto_sign_update( actx, msg, sizeof(msg));
+ crypto_sign_init_second_pass(actx);
+ crypto_sign_update( actx, msg, sizeof(msg));
+ crypto_sign_final( actx, mine);
if (crypto_verify64(theirs, mine) != 0) {
fprintf(stderr, "theirs != mine\en");