Let $Q(x_1,\ldots,x_n):=x_1^2+\cdots+x_n^2$ be an $n$-ary quadratic form.
Given a finite set of (rational) primes $S$ is there an algorithm or theorem that describes all solutions to $Q(x_1,\ldots,x_n)=K$ subject to:
the primes divisors of $x_i$ and $K$ all lie in $S$ and
each $x_i$ divides $K$?
I would also be interested in the more general version where we allow positive integer coefficients.