krb5: Store a digest context in the crypto structure
Creating and destroying an EVP_CTX_MD structure with every hash operation is very expensive. Speed things up by caching one within the krb5_crypto structure. krb5_crypto can already only be safely used by one thread at a time - adding a message digest context here shouldn't introduce any further threading risks. Users of the stashed context must be careful to ensure that they call no other hash functions whilst they are in the middle of using the context.
This commit is contained in:

committed by
Jeffrey Altman

parent
fa1e998b53
commit
e50faea7f0
@@ -106,7 +106,7 @@ AES_SHA1_PRF(krb5_context context,
|
||||
|
||||
iov[0].data = *in;
|
||||
iov[0].flags = KRB5_CRYPTO_TYPE_DATA;
|
||||
ret = (*ct->checksum)(context, NULL, 0, iov, 1, &result);
|
||||
ret = (*ct->checksum)(context, crypto, NULL, 0, iov, 1, &result);
|
||||
if (ret) {
|
||||
krb5_data_free(&result.checksum);
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user