MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / buildSHA

Function buildSHA

extra/yassl/src/handshake.cpp:195–220  ·  view source on GitHub ↗

calculate SHA hash for finished

Source from the content-addressed store, hash-verified

193
194// calculate SHA hash for finished
195void buildSHA(SSL& ssl, Finished& fin, const opaque* sender)
196{
197
198 opaque sha_result[SHA_LEN];
199 opaque sha_inner[SIZEOF_SENDER + SECRET_LEN + PAD_SHA];
200 opaque sha_outer[SECRET_LEN + PAD_SHA + SHA_LEN];
201
202 const opaque* master_secret =
203 ssl.getSecurity().get_connection().master_secret_;
204
205 // make sha inner
206 memcpy(sha_inner, sender, SIZEOF_SENDER);
207 memcpy(&sha_inner[SIZEOF_SENDER], master_secret, SECRET_LEN);
208 memcpy(&sha_inner[SIZEOF_SENDER + SECRET_LEN], PAD1, PAD_SHA);
209
210 ssl.useHashes().use_SHA().get_digest(sha_result, sha_inner,
211 sizeof(sha_inner));
212
213 // make sha outer
214 memcpy(sha_outer, master_secret, SECRET_LEN);
215 memcpy(&sha_outer[SECRET_LEN], PAD2, PAD_SHA);
216 memcpy(&sha_outer[SECRET_LEN + PAD_SHA], sha_result, SHA_LEN);
217
218 ssl.useHashes().use_SHA().get_digest(fin.set_sha(), sha_outer,
219 sizeof(sha_outer));
220}
221
222
223// sanity checks on encrypted message size

Callers 1

buildFinishedFunction · 0.85

Calls 2

get_digestMethod · 0.80
set_shaMethod · 0.80

Tested by

no test coverage detected