The small-scale dynamo and the amplification of magnetic fields in massive primordial haloes