Note that this is bfgminer, with CPU. This is not supposed to have the latest CPU optimizations enabled as it's not used for that in years, maybe a decade or more.
if there's demand now what's really needed is instructions for cpu with AES support. for sure regular sha256() ,openssl, with hardware aes turned on there , is faster than yours now.