Minimal check on parameters' contents.

This commit is contained in:
Itamar Turner-Trauring 2022-09-15 09:45:46 -04:00
parent 373a532829
commit 8d5f08771a

View File

@ -705,9 +705,13 @@ class Encoder(object):
only care about the length.
"""
params = self.uri_extension_data.copy()
assert params
params["crypttext_hash"] = b"\x00" * hashutil.CRYPTO_VAL_SIZE
params["crypttext_root_hash"] = b"\x00" * hashutil.CRYPTO_VAL_SIZE
params["share_root_hash"] = b"\x00" * hashutil.CRYPTO_VAL_SIZE
assert params.keys() == {
"codec_name", "codec_params", "size", "segment_size", "num_segments",
"needed_shares", "total_shares", "tail_codec_params",
"crypttext_hash", "crypttext_root_hash", "share_root_hash"
}, params.keys()
uri_extension = uri.pack_extension(params)
return len(uri_extension)