sm4 impl and unit testing