Skip to content

Commit

Permalink
Fix TRUST_TOKEN experiment_v1 SRR map.
Browse files Browse the repository at this point in the history
Change-Id: I9e5c9b016cc0b3b7926df850d470e6367eb9c0bc
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/41364
Reviewed-by: David Benjamin <[email protected]>
Commit-Queue: David Benjamin <[email protected]>
  • Loading branch information
Steven Valdez authored and CQ bot account: [email protected] committed May 14, 2020
1 parent 3e4dfbb commit 78b3337
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion crypto/trust_token/trust_token.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,13 @@ int TRUST_TOKEN_ISSUER_redeem(const TRUST_TOKEN_ISSUER *ctx, uint8_t **out,
assert(strlen(kClientDataLabel) < strlen(kExpiryTimestampLabel));
assert(strlen(kPublicLabel) < strlen(kPrivateLabel));

size_t map_entries = 3;
if (ctx->method->use_token_hash) {
map_entries = 4;
}

if (!CBB_init(&srr, 0) ||
!add_cbor_map(&srr, 3) || // SRR map
!add_cbor_map(&srr, map_entries) || // SRR map
!add_cbor_text(&srr, kMetadataLabel, strlen(kMetadataLabel)) ||
!add_cbor_map(&srr, 2) || // Metadata map
!add_cbor_text(&srr, kPublicLabel, strlen(kPublicLabel)) ||
Expand Down
2 changes: 1 addition & 1 deletion crypto/trust_token/trust_token_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ TEST_P(TrustTokenMetadataTest, SetAndGetMetadata) {
"\x65\x73\x74\x61\x6d\x70\x1a\x00\xcc\x15\x7a";

const uint8_t kExpectedSRRTokenHash[] =
"\xa3\x68\x6d\x65\x74\x61\x64\x61\x74\x61\xa2\x66\x70\x75\x62\x6c\x69"
"\xa4\x68\x6d\x65\x74\x61\x64\x61\x74\x61\xa2\x66\x70\x75\x62\x6c\x69"
"\x63\x00\x67\x70\x72\x69\x76\x61\x74\x65\x00\x6a\x74\x6f\x6b\x65\x6e"
"\x2d\x68\x61\x73\x68\x58\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
Expand Down

0 comments on commit 78b3337

Please sign in to comment.