Modern CPUs already have dedicated crypto instructions which are pretty fast, without the cost of copying to another device's memory, loading a program, waiting for it to execute, then copying the output back.
https://en.wikipedia.org/wiki/AES_instruction_set