SM2

Borrowed from libsm.