All operations expect the destination buffer to fit the selected size. And for simplicity STATE_WAIT is not supported. Additionally, remove single block ECB and just use the normal function.