1

I can't compile the openssl headers for c++ on Angstrom distribution, arm core. The file "bn.h" in openssl needs some extra definitions. One of them is THIRTY_TWO_BIT. I don't want to define it manually cause I may dismiss some other defines.

What header files should I include to have the THIRTY_TWO_BIT defined and openssl headers compiled as a result?

kirill
  • 366
  • 1
  • 8

2 Answers2

1

Googling for #define THIRTY_TWO_BIT yields the result that opensslconf.h seems to define THIRTY_TWO_BIT, see Apples codebase here

Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
  • it only accures `#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)`. On my PC with ubuntu in QTcreator this part is lighted gray showing that it is not defined, so seems like this fragment is defined somewhere else. – kirill Feb 27 '14 at 17:39
  • 1
    @kirill That basically means the OpenSSL `Configure` script messes up the macro definitions. However, these macro definitions might be totally different on your embedded ARM device. THIRTY_TWO_BITS might even refer to x86... – Uli Köhler Feb 27 '14 at 17:42
  • @kirill For example if you habe a 64 bit PC, judging from the name of the definition, I'd assume that `THIRTY_TWO_BITS` would not be defined and that would be desired behaviour. – Uli Köhler Feb 27 '14 at 17:49
1

where is THIRTY_TWO_BIT defined?

Its defined by Configure based on the platform:

$ cd <openssl src dir>
$ grep -R THIRTY_TWO_BIT *
...
Configure:"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
Configure:"OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H  -D_ALL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
Configure:"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
...

Its used in other files, and available in opensslconf.h if it was defined during configure (as Uli pointed out):

...
crypto/opensslconf.h.in:#define THIRTY_TWO_BIT
crypto/bn/bn_lib.c:#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)
crypto/bn/bn_lib.c:#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)
crypto/bn/bn_gf2m.c:#ifdef THIRTY_TWO_BIT
crypto/bn/bn_gf2m.c:#ifdef THIRTY_TWO_BIT
crypto/bn/bn.h:#ifdef THIRTY_TWO_BIT
MacOS/opensslconf.h:#define THIRTY_TWO_BIT

I can't compile the openssl headers for c++ on Angstrom distribution, arm core. The file "bn.h" in openssl needs some extra definitions.

You might check in Configure for a similar platform, and then copy/add/modify it for your platform. Then, run ./Configure <your new platform> followed by a make all.

Your platform may already be available. There is no Angstrom, but there are ARM's available:

$ ./Configure
Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...]
[-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared]
[[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [sctp] [386] [--prefix=DIR]
[--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]

pick os/compiler from:
BC-32 BS2000-OSD BSD-generic32 BSD-generic64 BSD-ia64 BSD-sparc64 BSD-sparcv8 
BSD-x86 BSD-x86-elf BSD-x86_64 Cygwin Cygwin-pre1.3 DJGPP MPE/iX-gcc OS2-EMX 
OS390-Unix QNX6 QNX6-i386 ReliantUNIX SINIX SINIX-N UWIN VC-CE VC-WIN32 
VC-WIN64A VC-WIN64I aix-cc aix-gcc aix3-cc aix64-cc aix64-gcc android 
android-armv7 android-x86 aux3-gcc beos-x86-bone beos-x86-r5 bsdi-elf-gcc cc 
cray-j90 cray-t3e darwin-i386-cc darwin-ppc-cc darwin64-ppc-cc 
darwin64-x86_64-cc dgux-R3-gcc dgux-R4-gcc dgux-R4-x86-gcc dist gcc hpux-cc 
hpux-gcc hpux-ia64-cc hpux-ia64-gcc hpux-parisc-cc hpux-parisc-cc-o4 
hpux-parisc-gcc hpux-parisc1_1-cc hpux-parisc1_1-gcc hpux-parisc2-cc 
hpux-parisc2-gcc hpux64-ia64-cc hpux64-ia64-gcc hpux64-parisc2-cc 
hpux64-parisc2-gcc hurd-x86 iphoneos-cross irix-cc irix-gcc irix-mips3-cc 
irix-mips3-gcc irix64-mips4-cc irix64-mips4-gcc linux-alpha+bwx-ccc 
linux-alpha+bwx-gcc linux-alpha-ccc linux-alpha-gcc linux-aout linux-armv4 
linux-elf linux-generic32 linux-generic64 linux-ia32-icc linux-ia64 
linux-ia64-ecc linux-ia64-icc linux-ppc linux-ppc64 linux-sparcv8 
linux-sparcv9 linux-x86_64 linux32-s390x linux64-s390x linux64-sparcv9 mingw 
mingw64 ncr-scde netware-clib netware-clib-bsdsock netware-clib-bsdsock-gcc 
netware-clib-gcc netware-libc netware-libc-bsdsock netware-libc-bsdsock-gcc 
netware-libc-gcc newsos4-gcc nextstep nextstep3.3 osf1-alpha-cc osf1-alpha-gcc 
purify qnx4 rhapsody-ppc-cc sco5-cc sco5-gcc solaris-sparcv7-cc 
solaris-sparcv7-gcc solaris-sparcv8-cc solaris-sparcv8-gcc solaris-sparcv9-cc 
solaris-sparcv9-gcc solaris-x86-cc solaris-x86-gcc solaris64-sparcv9-cc 
solaris64-sparcv9-gcc solaris64-x86_64-cc solaris64-x86_64-gcc sunos-gcc 
tandem-c89 tru64-alpha-cc uClinux-dist uClinux-dist64 ultrix-cc ultrix-gcc 
unixware-2.0 unixware-2.1 unixware-7 unixware-7-gcc vos-gcc vxworks-mips 
vxworks-ppc405 vxworks-ppc60x vxworks-ppc750 vxworks-ppc750-debug 
vxworks-ppc860 vxworks-ppcgen vxworks-simlinux ...
jww
  • 97,681
  • 90
  • 411
  • 885