Multiplicative and linear dependence in finite fields and on elliptic curves modulo primes