Hi, wrote a Qt-flavored version which might help you:
Using Qt 5.11.2 on my Ubuntu 18.04, I created a Qt console project.
I added LIBS += -lcrypto to my .pro file and clicked Build/Run qmake.
Then I changed main.cpp into this:
If you specify a normal string it prints the encrypted string in hex, and if you specify the hex string (beginning with 0x) then it prints the original plaintext. Hope this helps!