The only quote here that speaks of justification rather than salvation is the first one, and it mentions "or desire thereof". So....that is consistent with the usual quote provided to support BOD. There is no contradiction. Both say "desire" for the laver of regeneration/the Sacrament can effect justification....but it does not say it effects salvation.
It starts by saying the sacraments are necessary for salvation, a BOD is not a sacrament, so a BOD on it's own is useless. Right from the start of that canon, Trent answers the question for all who think a BOD on it's own is salvific, it is not.
And yes, they both say "or desire thereof" - But the seventh session is talking about the sacrament of Holy Communion for example, (Spiritual communion) or Penance (Perfect Contrition) or whatever because there, they are talking about all of the sacraments.
The decree on justification in the 4th session is speaking strictly of only of the sacrament of baptism. The two "or desire thereof's" are used in different teachings and have two completely different meanings....neither of which teach a BOD.
In saying that justification "cannot be effected without the laver of regeneration" - Trent could have stopped right there since on their own, these words admit that there is no justification without the sacrament. So stopping right there, no sacrament= no justification / no justification = no salvation. So really, nothing more needs to be said in that regard.
But, seemingly to directly condemn a baptism of desire, they added the words;
"or the desire thereof." Justification
"cannot be effected without the laver of regeneration or the desire thereof." Trent does not say that "justification cannot be effected without the laver of regeneration, or
without the desire thereof.
They of course then end by confirming the necessity of the sacrament with the Scripture;
"as it is written; unless a man be born again of water and the Holy Ghost, he cannot enter into the Kingdom of God."
The other thing to note, is that by saying
"If anyone saith....without them, or without the desire thereof,
men obtain of God, through faith alone, the grace of justification....let him be anathema." This is not teaching that a desire will guarantee the grace of justification, only that justification will not be obtained without it.