Sure.

More concerning is that you're only doing 5 rounds of Miller-Rabin. How big are your primes?