krb5_error_code ret;
iov[0].flags = KRB5_CRYPTO_TYPE_STREAM;
- iov[0].data = *input;
+ iov[0].data.data = malloc(input->length);
+ if (iov[0].data.data == NULL)
+ return ENOMEM;
+
+ memcpy(iov[0].data.data, input->data, input->length);
+ iov[0].data.length = input->length;
iov[1].flags = KRB5_CRYPTO_TYPE_DATA;
iov[1].data.data = NULL;
usage, ivec,
iov, sizeof(iov)/sizeof(iov[0]));
if (ret != 0)
- return ret;
+ goto cleanup;
- if (output->length < iov[1].data.length)
- return KRB5_BAD_MSIZE;
+ if (output->length < iov[1].data.length) {
+ ret = KRB5_BAD_MSIZE;
+ goto cleanup;
+ }
memcpy(output->data, iov[1].data.data, iov[1].data.length);
output->length = iov[1].data.length;
+cleanup:
+ zap(iov[0].data.data, iov[0].data.length);
+ free(iov[0].data.data);
+
return ret;
}