3 ms·
Except there was stuff going on related to this: Security-55471/libsecurity_ssl/security_ssl/tls_digest.c #ifdef KERNEL static int HashSHA1Update(S
by mzs 13y ago
Except there was stuff going on related to this:
Security-55471/libsecurity_ssl/security_ssl/tls_digest.c
#ifdef KERNEL
static int HashSHA1Update(SSLBuffer *digestCtx, const SSLBuffer *data)
{
return ccHashUpdate(ccsha1_di(), digestCtx, data);
}
#else
static int HashSHA1Update(SSLBuffer *digestCtx, const SSLBuffer *data)
{
/* 64 bits cast: safe, SSL records are always smaller than 2^32 bytes */
assert(digestCtx->length >= sizeof(CC_SHA1_CTX));
CC_SHA1_CTX *ctx = (CC_SHA1_CTX *)digestCtx->data;
CC_SHA1_Update(ctx, data->data, (CC_LONG)data->length);
return 0;
}
#endif
const HashReference SSLHashSHA1 =
{
SSL_SHA1_DIGEST_LENGTH,
40,
SSL_SHA1_CONTEXT_SIZE,
HashSHA1Init,
HashSHA1Update,
HashSHA1Final,
HashSHA1Close,
HashSHA1Clone
};
Security-55179.13/libsecurity_ssl/security_ssl/sslDigests.c
static OSStatus HashSHA1Update(SSLBuffer *digestCtx, const SSLBuffer *data)
{
/* 64 bits cast: safe, SSL records are always smaller than 2^32 bytes */
assert(digestCtx->length >= sizeof(CC_SHA1_CTX));
CC_SHA1_CTX *ctx = (CC_SHA1_CTX *)digestCtx->data;
CC_SHA1_Update(ctx, data->data, (CC_LONG)data->length);
return noErr;
}
const HashReference SSLHashSHA1 =
{
sizeof(CC_SHA1_CTX),
CC_SHA1_DIGEST_LENGTH,
40,
HashSHA1Init,
HashSHA1Update,
HashSHA1Final,
HashSHA1Close,
HashSHA1Clone
};
Do you see how there was some simple refactoring going on there in the structure and how the entire in-kernel functionality was added? I could totally see debugging function being created and sprinkled in all the places after all the update()s were called while verifying kernel stuff was working then removed and in this one place one line not enough deleted.
edit: Ha, I had my own copy paste error after getting bad gateway error, I fixed the duplicated code, sorry.