Tsquared is the squared Mahalanobis distance (with estimated covariance) between the observed mean and the null hypothesis mean. So use the following (untested):
S = cov(X); /* observed covariance */
xbar = mean(X); /* observed mean */
T2 = m*(xbar - mean)`*inv(S)*(xbar - mean);