[tor-commits] [tor/master] Extract key length check into a new function, and check more fields.