Re: Cross compiling 1.2.2 for the Analog Devices Blackfin -- FIPS_text_start()/FIPS_text_end() returns 0 on the target

2014-01-17 Thread Mike Crowe
Hi folks,

I've patched fips_canister.c to properly retrieve the blackfin
instruction pointer.  When I run openssl on the target now, I now get
reasonable numbers (though they still don't match incore).


===
root:/> OPENSSL_FIPS=1 openssl ciphers FIPS
SIG:
sig: 0x2e1f9e0
FIPS_text_start: 0x2d3cd88
FIPS_text_end=0x2d624cc
FIPS_rodata_start=0x2dd0294
FIPS_rodata_end=0x2dd5568
FIPS_signature=0x2e361fc

.text:0x2d3cd88+153412=0x2d624cc
.rodata:0x2dd0294+21204=0x2dd5568
Computed:   3098a7d1ede446fb5c4bef2d5568b7ea7edd2f68
HMAC_SHA1_SIG:  1f176a4fb51e3f477180c7d62f5af03c900d8e8c

FINGERPRINT_premain: FIPS_signature mismatch
===




FWIW, incore shows:
===
FIPS_rodata_end=000D5568
FIPS_rodata_start=000D0294
FIPS_signature=001081FC
FIPS_text_end=000624CC
FIPS_text_start=0003CD88
FINGERPRINT_ascii_value=000D6000
DOTrodata=000D0294
DOTrodata_OFF=000D0294
DOTtext=0003CB50
DOTtext_OFF=0003CB50
TSTART 568
TLEN 153412
TOFF 249216
INCORE_ADJUST -8
RSTART 0
RLEN 21204
ROFF 852628
FSTART 23916
FLEN 40
FOFF 876544
Signature is: 1f176a4fb51e3f477180c7d62f5af03c900d8e8c
===
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: Cross compiling 1.2.2 for the Analog Devices Blackfin -- FIPS_text_start()/FIPS_text_end() returns 0 on the target

2014-01-17 Thread Mike Crowe
Hi Stacy, sorry, should have included that:


On Fri, Jan 17, 2014 at 12:17 PM, Stacy Devino  wrote:
> Are you compiling for the uclinux distro or something similar?

ucLinux -- 2.6.34

> Are you using the 16 or 32-bit arch?

The blackfin is a 32-bit little-endian machine


> Are you utilizing the DSP or trying to?

Not utilizing DSP.  Running the FIPS code as-is.


A typical compile looks like:

bfin-linux-uclibc-gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC
-DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIO -O3
-fomit-frame-pointer -Wall -DHMAC_EXT=\"${HMAC_EXT:-sha1}\" -DEMBED
-D__uClinux__ -I/opt/uclinux-usb34-rc5-bootecc-prod1  -mcpu=bf524-any
-c -o fips.o fips.c

The link for fipscanister looks like:

bfin-linux-uclibc-gcc -I. -I.. -I../include -fPIC -DOPENSSL_PIC
-DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIO -O3
-fomit-frame-pointer -Wall -DHMAC_EXT="sha1" -r -nostdlib -o
fipscanister.o fips_start.o fips.o ../crypto/aes/aes_cfb.o
../crypto/aes/aes_ecb.o ../crypto/aes/aes_ofb.o ../crypto/bn/bn_add.o
../crypto/bn/bn_blind.o ../crypto/bn/bn_ctx.o ../crypto/bn/bn_div.o
../crypto/bn/bn_exp2.o ../crypto/bn/bn_exp.o ../crypto/bn/bn_gcd.o
../crypto/bn/bn_lib.o ../crypto/bn/bn_mod.o ../crypto/bn/bn_mont.o
../crypto/bn/bn_mul.o ../crypto/bn/bn_prime.o ../crypto/bn/bn_rand.o
../crypto/bn/bn_recp.o ../crypto/bn/bn_shift.o ../crypto/bn/bn_sqr.o
../crypto/bn/bn_word.o ../crypto/bn/bn_x931p.o
../crypto/buffer/buf_str.o ../crypto/cryptlib.o
../crypto/des/cfb64ede.o ../crypto/des/cfb64enc.o
../crypto/des/cfb_enc.o ../crypto/des/ecb3_enc.o
../crypto/des/ecb_enc.o ../crypto/des/ofb64ede.o
../crypto/des/ofb64enc.o ../crypto/des/fcrypt.o
../crypto/des/set_key.o ../crypto/dsa/dsa_utl.o
../crypto/dsa/dsa_sign.o ../crypto/dsa/dsa_vrf.o ../crypto/err/err.o
../crypto/evp/digest.o ../crypto/evp/enc_min.o ../crypto/evp/e_aes.o
../crypto/evp/e_des3.o ../crypto/evp/p_sign.o ../crypto/evp/p_verify.o
../crypto/mem_clr.o ../crypto/mem.o ../crypto/rand/md_rand.o
../crypto/rand/rand_egd.o ../crypto/rand/randfile.o
../crypto/rand/rand_lib.o ../crypto/rand/rand_os2.o
../crypto/rand/rand_unix.o ../crypto/rand/rand_win.o
../crypto/rsa/rsa_lib.o ../crypto/rsa/rsa_none.o
../crypto/rsa/rsa_oaep.o ../crypto/rsa/rsa_pk1.o
../crypto/rsa/rsa_pss.o ../crypto/rsa/rsa_ssl.o
../crypto/rsa/rsa_x931.o ../crypto/sha/sha1dgst.o
../crypto/sha/sha256.o ../crypto/sha/sha512.o ../crypto/uid.o
../crypto/bn/bn_asm.o ../crypto/aes/aes_core.o ../crypto/aes/aes_cbc.o
../crypto/des/des_enc.o ../crypto/des/fcrypt_b.o
sha/fips_sha1_selftest.o hmac/fips_hmac.o hmac/fips_hmac_selftest.o
rand/fips_rand.o rand/fips_rand_selftest.o des/fips_des_selftest.o
aes/fips_aes_selftest.o dsa/fips_dsa_ossl.o dsa/fips_dsa_gen.o
dsa/fips_dsa_selftest.o dsa/fips_dsa_key.o dsa/fips_dsa_lib.o
dsa/fips_dsa_sign.o rsa/fips_rsa_eay.o rsa/fips_rsa_gen.o
rsa/fips_rsa_selftest.o rsa/fips_rsa_x931g.o rsa/fips_rsa_sign.o
rsa/fips_rsa_lib.o dh/fips_dh_check.o dh/fips_dh_gen.o
dh/fips_dh_key.o dh/fips_dh_lib.o fips_end.o
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: Cross compiling 1.2.2 for the Analog Devices Blackfin -- FIPS_text_start()/FIPS_text_end() returns 0 on the target

2014-01-17 Thread Mike Crowe
Hi folks,

I'm almost out of my depth, and really need help on the next step.

I've that the in-system fingerprint comparison fails with a
"FINGERPRINT_premain: FIPS_signature mismatch" error

incore DEBUG=1 output gives:
=
TARGET: elf32-bfinfdpic
FIPS_rodata_end=000D5374
FIPS_rodata_start=000D00A0
FIPS_signature=00107F34
FIPS_text_end=000622F4
FIPS_text_start=0003CD28
FINGERPRINT_ascii_value=000D5D68
DOTrodata=000D00A0
DOTrodata_OFF=000D00A0
DOTtext=0003CAF0
DOTtext_OFF=0003CAF0
TSTART 568
TLEN 153036
TOFF 249132
INCORE_ADJUST 4
RSTART 0
RLEN 21204
ROFF 852128
FSTART 23752
FLEN 40
FOFF 875880
Signature is: 9b51309edb5d373a6f1e5b0c3cc8e554317539ae
=


I've created a test file to examine the various parameters.  On the
device, it shows:
=
Computed: c1133792c1ced10fadfe2ab6eb7946d79bfec490
HMAC_SHA1_SIG: 9b51309edb5d373a6f1e5b0c3cc8e554317539ae

FIPS_text_start(): 0
FIPS_text_end()=0
FIPS_rodata_start=48038048 (0x2DD00A0)
FIPS_rodata_end=48059252 (0x2DD5374)
=

So, I see these issues:
1) FIPS_text_start()/FIPS_text_end() returns 0
2) rodata start/end both offset by 0x2D0


Can anybody help point me to my next steps?
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org