The former.
It is a single word 'whomsoever', not two words 'whom' and 'soever' as it is mentioned by you. The sentence 'To whomsoever it may concern' means the matter which would follow this sentence may have...
¿A quién va dirigido ...
a quien corresponda,
When you do not know who will be receiving the letter.