Is this really an assertion error? This function will return negative salt size merely if your key is too small for your digest.