diff options
Diffstat (limited to 'crypto/slh_dsa/slh_wots.c')
| -rw-r--r-- | crypto/slh_dsa/slh_wots.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/crypto/slh_dsa/slh_wots.c b/crypto/slh_dsa/slh_wots.c index 2776cc07c419..ea278fcd8412 100644 --- a/crypto/slh_dsa/slh_wots.c +++ b/crypto/slh_dsa/slh_wots.c @@ -31,7 +31,7 @@ * @param out The returned array of nibbles, with a size of 2*|in_len| */ static ossl_inline void slh_bytes_to_nibbles(const uint8_t *in, size_t in_len, - uint8_t *out) + uint8_t *out) { size_t consumed = 0; @@ -49,7 +49,7 @@ static ossl_inline void slh_bytes_to_nibbles(const uint8_t *in, size_t in_len, * which does a complicated base2^b(tobyte()) operation. */ static ossl_inline void compute_checksum_nibbles(const uint8_t *in, size_t in_len, - uint8_t *out) + uint8_t *out) { size_t i; uint16_t csum = 0; @@ -90,8 +90,8 @@ static ossl_inline void compute_checksum_nibbles(const uint8_t *in, size_t in_le * @returns 1 on success, or 0 on error. */ static int slh_wots_chain(SLH_DSA_HASH_CTX *ctx, const uint8_t *in, - uint8_t start_index, uint8_t steps, - const uint8_t *pk_seed, uint8_t *adrs, WPACKET *wpkt) + uint8_t start_index, uint8_t steps, + const uint8_t *pk_seed, uint8_t *adrs, WPACKET *wpkt) { const SLH_DSA_KEY *key = ctx->key; SLH_HASH_FUNC_DECLARE(key, hashf); @@ -136,8 +136,8 @@ static int slh_wots_chain(SLH_DSA_HASH_CTX *ctx, const uint8_t *in, * @returns 1 on success, or 0 on error. */ int ossl_slh_wots_pk_gen(SLH_DSA_HASH_CTX *ctx, - const uint8_t *sk_seed, const uint8_t *pk_seed, - uint8_t *adrs, uint8_t *pk_out, size_t pk_out_len) + const uint8_t *sk_seed, const uint8_t *pk_seed, + uint8_t *adrs, uint8_t *pk_out, size_t pk_out_len) { int ret = 0; const SLH_DSA_KEY *key = ctx->key; @@ -201,8 +201,8 @@ end: * @returns 1 on success, or 0 on error. */ int ossl_slh_wots_sign(SLH_DSA_HASH_CTX *ctx, const uint8_t *msg, - const uint8_t *sk_seed, const uint8_t *pk_seed, - uint8_t *adrs, WPACKET *sig_wpkt) + const uint8_t *sk_seed, const uint8_t *pk_seed, + uint8_t *adrs, WPACKET *sig_wpkt) { int ret = 0; const SLH_DSA_KEY *key = ctx->key; @@ -211,7 +211,7 @@ int ossl_slh_wots_sign(SLH_DSA_HASH_CTX *ctx, const uint8_t *msg, size_t i; size_t n = key->params->n; size_t len1 = SLH_WOTS_LEN1(n); /* 2 * n = the msg length in nibbles */ - size_t len = len1 + SLH_WOTS_LEN2; /* 2 * n + 3 (3 checksum nibbles) */ + size_t len = len1 + SLH_WOTS_LEN2; /* 2 * n + 3 (3 checksum nibbles) */ SLH_ADRS_DECLARE(sk_adrs); SLH_HASH_FUNC_DECLARE(key, hashf); @@ -239,7 +239,7 @@ int ossl_slh_wots_sign(SLH_DSA_HASH_CTX *ctx, const uint8_t *msg, set_chain_address(adrs, i); /* compute chain i signature */ if (!slh_wots_chain(ctx, sk, 0, msg_and_csum_nibbles[i], - pk_seed, adrs, sig_wpkt)) + pk_seed, adrs, sig_wpkt)) goto err; } ret = 1; @@ -264,9 +264,9 @@ err: * @returns 1 on success, or 0 on error. */ int ossl_slh_wots_pk_from_sig(SLH_DSA_HASH_CTX *ctx, - PACKET *sig_rpkt, const uint8_t *msg, - const uint8_t *pk_seed, uint8_t *adrs, - uint8_t *pk_out, size_t pk_out_len) + PACKET *sig_rpkt, const uint8_t *msg, + const uint8_t *pk_seed, uint8_t *adrs, + uint8_t *pk_out, size_t pk_out_len) { int ret = 0; const SLH_DSA_KEY *key = ctx->key; @@ -275,7 +275,7 @@ int ossl_slh_wots_pk_from_sig(SLH_DSA_HASH_CTX *ctx, size_t n = key->params->n; size_t len1 = SLH_WOTS_LEN1(n); size_t len = len1 + SLH_WOTS_LEN2; /* 2n + 3 */ - const uint8_t *sig_i; /* Pointer into |sig_rpkt| buffer */ + const uint8_t *sig_i; /* Pointer into |sig_rpkt| buffer */ uint8_t tmp[SLH_WOTS_LEN_MAX * SLH_MAX_N]; WPACKET pkt, *tmp_pkt = &pkt; size_t tmp_len = 0; @@ -295,9 +295,9 @@ int ossl_slh_wots_pk_from_sig(SLH_DSA_HASH_CTX *ctx, for (i = 0; i < len; ++i) { set_chain_address(adrs, i); if (!PACKET_get_bytes(sig_rpkt, &sig_i, n) - || !slh_wots_chain(ctx, sig_i, msg_and_csum_nibbles[i], - NIBBLE_MASK - msg_and_csum_nibbles[i], - pk_seed, adrs, tmp_pkt)) + || !slh_wots_chain(ctx, sig_i, msg_and_csum_nibbles[i], + NIBBLE_MASK - msg_and_csum_nibbles[i], + pk_seed, adrs, tmp_pkt)) goto err; } /* compress the computed public key value */ @@ -307,8 +307,8 @@ int ossl_slh_wots_pk_from_sig(SLH_DSA_HASH_CTX *ctx, if (!WPACKET_get_total_written(tmp_pkt, &tmp_len)) goto err; ret = hashf->T(ctx, pk_seed, wots_pk_adrs, tmp, tmp_len, - pk_out, pk_out_len); - err: + pk_out, pk_out_len); +err: if (!WPACKET_finish(tmp_pkt)) ret = 0; return ret; |
