I had a similar problem, except I was trying to compile on a Solaris x86 machine. setarch is not available in Solaris, so I could not use the simpler approach suggested in one of the other answers here.
The 'config' script for OpenSSL is a shell wrapper which determines what it thinks is the target system, then calls the 'Configure' perl script, which does the heavy lifting. Configure has a lot of built in targets: you can use 'perl Configure TABLE' to get a list of all of them. It is a case of selecting the target you need from the available list.
So, if you want to force it to build for a target other than the one it thinks you should, you can call 'Configure' directly, passing the name of the target you want. For example, to get my Solaris 32 bit build to work, I used:
./Configure solaris-x86-cc --shared
or, in the case of the original question, if it was a Linux system you could use:
./Configure linux-generic32 --shared