Code review comment for lp:~rene-hummen/hipl/puzzle-fixes

Revision history for this message
Diego Biurrun (diego-biurrun) wrote :

 review needs-fixing

On Wed, Apr 13, 2011 at 08:50:53AM +0000, René Hummen wrote:
> René Hummen has proposed merging lp:~rene-hummen/hipl/puzzle-fixes into lp:hipl.
>
> --- lib/core/solve.c 2011-01-24 10:21:17 +0000
> +++ lib/core/solve.c 2011-04-13 08:50:40 +0000
> @@ -43,108 +46,183 @@
>
> +/** This data type represents the ordered input for the hash function used to
> + * solve a given puzzle challenge as defined in RFC 5201 - Appendix A */
> +struct puzzle_hash_input {
> + uint8_t puzzle[PUZZLE_LENGTH];
> + hip_hit_t initiator_hit;
> + hip_hit_t responder_hit;
> + uint8_t solution[PUZZLE_LENGTH];
> +} __attribute__ ((packed));
> +
> +int hip_solve_puzzle(const uint8_t puzzle[PUZZLE_LENGTH],
> + const uint8_t difficulty,
> + const hip_hit_t initiator_hit,
> + const hip_hit_t responder_hit,
> + uint8_t solution[PUZZLE_LENGTH])
> +{

Just pass a puzzle_hash_input struct to the function and you go down
from five to two parameters.

> +int hip_verify_puzzle_solution(const uint8_t puzzle[PUZZLE_LENGTH],
> + const uint8_t solution[PUZZLE_LENGTH],
> + const uint8_t difficulty,
> + const hip_hit_t initiator_hit,
> + const hip_hit_t responder_hit)
> +{

same

Diego

review: Needs Fixing

« Back to merge proposal