Skip to content

Commit

Permalink
test(TPM::Attestation#key): update test setup
Browse files Browse the repository at this point in the history
Now, when the algorithm is `ECDSA`, the `unique` field of the `pubArea`
should include two sized buffers instead of just one.
  • Loading branch information
santiagorodriguez96 committed Dec 13, 2024
1 parent c388625 commit 4c35d2c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/tpm/key_attestation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@
t_public.parameters.scheme = TPM::ALG_ECDSA
t_public.parameters.curve_id = curve_id
t_public.parameters.kdf = TPM::ALG_NULL
t_public.unique.buffer = attested_key.public_key.to_bn.to_s(2)[1..-1]

public_key_bytes = attested_key.public_key.to_bn.to_s(2)[1..-1]
coordinate_length = public_key_bytes.size / 2
t_public.unique.x.buffer = public_key_bytes[0..(coordinate_length - 1)]
t_public.unique.y.buffer = public_key_bytes[coordinate_length..-1]

t_public.to_binary_s
end
Expand Down

0 comments on commit 4c35d2c

Please sign in to comment.