Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jul 2015 19:38:37 +0530
From:      Vijay Rajah <me@rvijay.me>
To:        FreeBSD questions <freebsd-questions@freebsd.org>
Subject:   Openssl + Via Padlock
Message-ID:  <55A274E5.50903@rvijay.me>

next in thread | raw e-mail | index | archive | help
Hello List,

I have a system with VIA chipset. I want to compile openssl with padlock 
support. I'm  getting "Illegal instruction" error, when I try to use the 
sha256library

root@my-host:~ # dd if=/dev/zero bs=1M count=512 | 
/usr/local/bin/openssl sha256
Illegal instruction (core dumped)


This is a dedicated server. This is a fresh install of FreeBSD 10.1. I 
installed Openssl from ports

Here are the details..

root@my-host:~ # uname -a
FreeBSD my-host 10.1-RELEASE-p10 FreeBSD 10.1-RELEASE-p10 #0: Wed May 13 
06:54:13 UTC 2015 
root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
root@my-host:~ # freebsd-version
10.1-RELEASE-p14

root@my-host:~  # /usr/local/bin/openssl version
OpenSSL 1.0.2d 9 Jul 2015

root@my-host:~ # /usr/local/bin/openssl engine
(dynamic) Dynamic engine loading support
(padlock) VIA PadLock: RNG ACE2 PHE NANO

root@my-host:~ # dmesg | grep -i via
CPU: VIA Nano processor U2250 (1.6GHz Capable) (1596.04-MHz K8-class CPU)
   VIA Padlock Features=0x70dcc<RNG,AES,AES-CTR,SHA1,SHA256>
.
.
.

root@my-host:~ # kldstat
Id Refs Address            Size     Name
  1   10 0xffffffff80200000 1756638  kernel
  2    1 0xffffffff81a11000 26c7     pflog.ko
  3    1 0xffffffff81a14000 32339    pf.ko
  4    1 0xffffffff81a47000 2b1d     padlock.ko
  5    1 0xffffffff81a4a000 1f565    crypto.ko

Examining the core file with GDB give me the following

# gdb /usr/local/bin/openssl openssl.core
.
.
(gdb) bt
#0  0x00000008014f2c7e in padlock_sha256_update () from 
/usr/local/lib/engines/libpadlock.so
#1  0x0000000800c3499f in md_read () from /usr/local/lib/libcrypto.so.8
#2  0x0000000800c1c724 in BIO_read () from /usr/local/lib/libcrypto.so.8
#3  0x00000000004228d0 in do_fp ()
#4  0x0000000000422683 in dgst_main ()
#5  0x000000000041b77d in do_cmd ()
#6  0x000000000041b606 in main ()
(gdb) disassemble 0x00000008014f2c7e
.
.
.
0x00000008014f2c7b <padlock_sha256_update+395>:    mov %rdx,%rcx
*0x00000008014f2c7e <padlock_sha256_update+398>:    xsha256 *
0x00000008014f2c81 <padlock_sha256_update+401>:    shl $0x6,%rdx
.
.
.

Hence, it appears that the openssl command fails at the "xsha256" 
instruction. This appears to be VIA chip's instruction??

Any ideas as to why this is failing?

-Thanks in advance
Vijay




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55A274E5.50903>