A circuit based upon the feedback circuit below may or may not suit your needs.

simulate this circuit – Schematic created using CircuitLab
The output of the feedback circuit \$V_{fb}\$ is given by the formula
$$V_{fb} = V_{out}-V_{ref}+V_{fb0}$$
\$V_{out}\$ is the output voltage of the DC-DC converter. \$V_{ref}\$ is the voltage you wish to track. \$V_{fb0}\$ is the feedback voltage expected by the converter chip when the output voltage is at its target value. \$V_{fb0}\$ is often \$1.250\$ V, but varies by type of chip.
The right hand "circuit" is just present for testing purposes.
It is possible that using this circuit for the feedback of a buck converter may require adjustments to the compensation of the converter's feedback loop. I really don't know the answer, so I am shining a spotlight to the clouds as a sort of Bat Signal in the hopes that VerbalKint sees it and can comment.
An alternative circuit is this.

simulate this circuit
The output of this circuit is
$$V_{fb} = \frac{V_{out}-V_{ref}}{2}+V_{fb0}$$
It has the advantage that the op-amp is not in the feedback loop of the DC-DC converter, or vice-versa, but is only in the path between \$V_{ref}\$ and the summing node. A disadvantage of this circuit is that it requires a negative supply rail for the op-amp, i.e. the output of the op-amp will be negative if \$V_{ref}\gt 2V_{fb0}\$.
Here is yet a third alternative circuit is this.

simulate this circuit
The output of this circuit is
$$V_{fb} = \frac{V_{out}-V_{ref}}{11} + V_{fb0}$$
This circuit has the property that the output of the op-amp is not negative as long as
$$11V_{fb0}>V_{ref}$$
Since your original specification is that \$V_{ref} \le 10\$ V, if \$V_{fb0} = 1.25\$ V, you will not need a negative supply for your op-amp.
[In previous answers where I used an op-amp with a inverting gain of absolute value less than 1, I received notes of concern in comments. To answer these concerns in advance, I refer to this discussion, especially the first response from Michael Steffes.]