summaryrefslogtreecommitdiff
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-07-13 23:12:03 +0200
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2014-07-24 05:33:50 +0000
commit2944d8b97ce4e046acea39589623c91b0e9bcf4e (patch)
tree48c54e4feb399d92c17416f5df2ab53d6fc0f386 /epan/tvbuff.c
parentfc983cfca2bb6ea21bfa5c813cce0ad490792ee2 (diff)
downloadwireshark-2944d8b97ce4e046acea39589623c91b0e9bcf4e.tar.gz
ssl: clarify meaning of StringInfo, cleanup PRFs, master_secret
It was not clear whether the data_len member of StringInfo refers to the allocated memory (as was done for session_ticket) or the length of the actual data. This is clarified in a comment. To keep the invariant "data_len refers to the length of meaningful data", some code has been moved just in case some intermediate code fails: - Setting session_ticket.data_len vs tvb_memcpy to session_ticket.data. - PRF functions would expect the data length as input to a paramter named "out". This is highly confusing, so another parameter has been added to signify the requested length, "out_len". This also helps holding up the invariant. - For prf() calls, out.data_len does not need to be initialized but passed as parameter. Other PRF-related changes: - Change the PRF functions to return a boolean instead of an int. - tls_hash: return void as it cannot fail and remove related error handling from callers. Fix a memleak of label_seed if tls_hash was successful. - tls_hash: add comments to clarify its functionality, whitespace. - ssl3_generate_export_iv could not fail, so make it void. Also added an out_len param to pass the target length. - In prf(), replaced if-conditions for SSL version by a switch. - In ssl_generate_keyring_material, the scope of some variable has been tightened. - ssl_session_init: explicitly set data_len to 0. This is strictly not necessary as the callers have already zeroed out the memory, but that has not been documented. Other changes related to master_secret (ssl_save_session[_ticket]): - Initialize master_secret.data_len to 0 in ssl_session_init as the master_secret is unusable at that point. - Remove the hack that tests whether master_secret.data is non-empty. - Replace hardcoded master_secret length (48) from wmem_alloc0(). - Introduce macro for master secret length, use this in SslDecryptSession, for parsing from keyfile and converting pre-master secret to master secret (prf). - Use (master_secret + 1) to refer to the part after the struct rather than adding the size manually to a gchar-casted master_secret. Change-Id: Ie1ea448db54e828b904568224486147a3d962522 Reviewed-on: https://code.wireshark.org/review/3030 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/tvbuff.c')
0 files changed, 0 insertions, 0 deletions