cheated by porting stuff from sec1

Signed-off-by: Liew Zhao Wei <zhaoweiliew@gmail.com>