krb5: Use iovecs for internal checksum handling
Modify the signature of the checksum operation in the krb5_checksum_type structure so that it processes iovecs rather than solid blocks of data. Update all of the implementations of these functions for all of the checksum types that we support so that they process iovecs, either by iterating through the iovec in each function, or by calling _krb5_evp_digest_iov or _krb5_evp_hmac_iov() Update callers of these functions so that they turn their single blocks of data into a single iovec of the correct type before calling checksum
This commit is contained in:

committed by
Jeffrey Altman

parent
3484f092e5
commit
ca756f0f7f
@@ -58,9 +58,9 @@ static struct _krb5_key_type keytype_arcfour = {
|
||||
krb5_error_code
|
||||
_krb5_HMAC_MD5_checksum(krb5_context context,
|
||||
struct _krb5_key_data *key,
|
||||
const void *data,
|
||||
size_t len,
|
||||
unsigned usage,
|
||||
const struct krb5_crypto_iov *iov,
|
||||
int niov,
|
||||
Checksum *result)
|
||||
{
|
||||
EVP_MD_CTX *m;
|
||||
@@ -73,6 +73,7 @@ _krb5_HMAC_MD5_checksum(krb5_context context,
|
||||
unsigned char tmp[16];
|
||||
unsigned char ksign_c_data[16];
|
||||
krb5_error_code ret;
|
||||
int i;
|
||||
|
||||
m = EVP_MD_CTX_create();
|
||||
if (m == NULL)
|
||||
@@ -93,7 +94,10 @@ _krb5_HMAC_MD5_checksum(krb5_context context,
|
||||
t[2] = (usage >> 16) & 0xFF;
|
||||
t[3] = (usage >> 24) & 0xFF;
|
||||
EVP_DigestUpdate(m, t, 4);
|
||||
EVP_DigestUpdate(m, data, len);
|
||||
for (i = 0; i < niov; i++) {
|
||||
if (_krb5_crypto_iov_should_sign(&iov[i]))
|
||||
EVP_DigestUpdate(m, iov[i].data.data, iov[i].data.length);
|
||||
}
|
||||
EVP_DigestFinal_ex (m, tmp, NULL);
|
||||
EVP_MD_CTX_destroy(m);
|
||||
|
||||
|
Reference in New Issue
Block a user