I have small software protocol that use socket to communicate with an external FPGA (through Ethernet). This FPGA is responsible about only encrypting the data using AES-CTR. I want to use this FPGA as a hardware crypto accelerator for ESP.

I just start by writing crypto kernel module that will call this protocol in order to
communicate with FPGA. Once I use this module for ESP the kernel crash. So I think the problem because of using the FPGA for encryption and the kernel crypto API is synchronize. Therefore, I decide to write crypto driver.

Is this the right way of doing it (creating the crypto driver that will call this protocol in order to communicate with FPGA). Also, could you please provide me with simple example for crypto driver to start writing my crypto driver.