Page 9 of the user's guide has a claim that if $u$ is twice differentiable at $\hat{x}$ and
$$ u\left(x\right)\leq u\left(\hat{x}\right)+\left\langle p,x-\hat{x}\right\rangle +\frac{1}{2}\left\langle X\left(x-\hat{x}\right),x-\hat{x}\right\rangle +o\left(\left|x-\hat{x}\right|^{2}\right) $$
as $x\rightarrow\hat{x}$, then $p=Du\left(\hat{x}\right)$ and $D^2u\left(\hat{x}\right) \leq X$. I can see that this implies
$$ 0\leq\left\langle p-Du\left(\hat{x}\right),x-\hat{x}\right\rangle +\frac{1}{2}\left\langle \left(X-D^{2}u\left(\hat{x}\right)\right)\left(x-\hat{x}\right),x-\hat{x}\right\rangle +o\left(\left|x-\hat{x}\right|^{2}\right) $$
and that $D^2u\left(\hat{x}\right)\leq X$ whenever $p=Du\left(\hat{x}\right)$, but I do not see how to show $p=Du\left(\hat{x}\right)$.
Suppose $p\neq Du(\hat x)$. Take $a=p-Du(\hat x)$ and consider the point $x=\hat x-ta$ for $t>0$ small. Consider your estimate $$ 0\leq\left\langle p-Du\left(\hat{x}\right),x-\hat{x}\right\rangle +\frac{1}{2}\left\langle \left(X-D^{2}u\left(\hat{x}\right)\right)\left(x-\hat{x}\right),x-\hat{x}\right\rangle +o\left(\left|x-\hat{x}\right|^{2}\right) $$ for this choice of $x$. The first term on RHS is $-t|a|^2$ (which is strictly negative for $t>0$) and the rest is $O(t^2)$. Thus for $t$ sufficiently small the estimate fails.