summaryrefslogtreecommitdiff
path: root/sdk
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2017-02-11 16:18:02 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2017-02-11 16:18:02 +0000
commitc71bb2fb9237de8dbba5f2b8bb6ffe56010310f5 (patch)
tree33c3fcd9053dfdcdb0cc7773e605906afdfd8052 /sdk
parent042d9f4c0d1dd37d1cfc24413e7c8211f86fe0c8 (diff)
downloadtoolchains-c71bb2fb9237de8dbba5f2b8bb6ffe56010310f5.tar.gz
toolchains-c71bb2fb9237de8dbba5f2b8bb6ffe56010310f5.tar.bz2
m68k optimised version of OpenSSL
Diffstat (limited to 'sdk')
-rw-r--r--sdk/Makefile4
-rw-r--r--sdk/recipes/files/openssl/m68k-unknown-amigaos/crypto/bn/asm/bn_m68k.s1604
-rw-r--r--sdk/recipes/patches/openssl/Configure.p2
-rw-r--r--sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.Makefile.p12
-rw-r--r--sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.bn_div.c.p25
5 files changed, 1645 insertions, 2 deletions
diff --git a/sdk/Makefile b/sdk/Makefile
index b5a6d29..8850224 100644
--- a/sdk/Makefile
+++ b/sdk/Makefile
@@ -133,7 +133,6 @@ ifeq ($(TARGET),m68k-unknown-amigaos)
LIBJPEG_ENV := LDFLAGS="-lm"
LIBJPEG_TURBO_ENV := LDFLAGS="-lm"
LIBCURL_ENV := LIBS="-lm"
- EXTRAARGS_OPENSSL := no-asm
endif
ifeq ($(SDK_ITEMS),)
@@ -344,6 +343,9 @@ $(BUILDSTEPS)/openssl.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/zlib.d $(BUILDST
ifneq ($(realpath $(RECIPES)/patches/openssl/$(TARGET)),)
for p in `ls $(RECIPES)/patches/openssl/$(TARGET)/*.p` ; do $(PATCH) -d $(BUILDDIR)/openssl/openssl-$(VERSION_OPENSSL) -p0 <$$p ; done
endif
+ifneq ($(realpath $(RECIPES)/files/openssl/$(TARGET)),)
+ cp -r $(RECIPES)/files/openssl/$(TARGET)/* $(BUILDDIR)/openssl/openssl-$(VERSION_OPENSSL)
+endif
cd $(BUILDDIR)/openssl/openssl-$(VERSION_OPENSSL) && $(env) ./Configure --prefix=$(GCCSDK_INSTALL_ENV) $(TARGET) no-shared no-threads $(EXTRAARGS_OPENSSL)
cd $(BUILDDIR)/openssl/openssl-$(VERSION_OPENSSL) && $(env) make install
touch $@
diff --git a/sdk/recipes/files/openssl/m68k-unknown-amigaos/crypto/bn/asm/bn_m68k.s b/sdk/recipes/files/openssl/m68k-unknown-amigaos/crypto/bn/asm/bn_m68k.s
new file mode 100644
index 0000000..effdc6a
--- /dev/null
+++ b/sdk/recipes/files/openssl/m68k-unknown-amigaos/crypto/bn/asm/bn_m68k.s
@@ -0,0 +1,1604 @@
+/* Copyright (C) 2002 by Howard Chu <hyc@highlandsun.com>
+ *
+ * Rights for redistribution and usage in source and binary forms are
+ * granted according to the OpenSSL license. Warranty of any kind is
+ * disclaimed.
+ */
+
+/* This file is written for GNU as. All of the code is hand written by
+ * me. The code is suitable for Motorola 68020-68060 and all CPU32-based
+ * processors providing 64-bit multiply/divide instructions. On a 68030
+ * this code is over 4 times faster than the gcc -O3 code for RSA/DSA.
+ * I haven't paid any attention to instruction sequencing; there may be
+ * room for some further improvement.
+ */
+
+.text
+ .even
+.globl _bn_mul_add_words
+_bn_mul_add_words:
+ movm.l #0x3c00,-(sp)
+ move.l 20(sp),a0
+ move.l 24(sp),a1
+ clr.l d0
+ move.l d0,d5 /* Keep a 0 handy for addx carry bits */
+ move.l 28(sp),d4
+ jble 3f
+
+ move.l 32(sp),d3
+ moveq.l #-4,d2
+ and.l d4,d2
+ jbeq 2f
+1:
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ add.l (a0),d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ add.l (a0),d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ add.l (a0),d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ add.l (a0),d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ moveq.l #-4,d2
+ add.l d2,d4
+ and.l d4,d2
+ jbne 1b
+2:
+ tst.l d4
+ jbeq 3f
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ add.l (a0),d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ subq.l #1,d4
+ jbeq 3f
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ add.l (a0),d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ subq.l #1,d4
+ jbeq 3f
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ add.l (a0),d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+3:
+ movm.l (sp)+,#0x003c
+ rts
+
+ .even
+.globl _bn_mul_words
+_bn_mul_words:
+ movm.l #0x3c00,-(sp)
+ move.l 20(sp),a0
+ move.l 24(sp),a1
+ clr.l d0
+ move.l d0,d5
+ move.l 28(sp),d4
+ jble 3f
+
+ move.l 32(sp),d3
+ moveq.l #-4,d2
+ and.l d4,d2
+ jbeq 2f
+1:
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ moveq.l #-4,d2
+ add.l d2,d4
+ and.l d4,d2
+ jbne 1b
+2:
+ tst.l d4
+ jbeq 3f
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ subq.l #1,d4
+ jbeq 3f
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+
+ subq.l #1,d4
+ jbeq 3f
+
+ move.l d3,d1
+ mulu.l (a1)+,d2:d1
+ add.l d0,d1
+ addx.l d5,d2
+ move.l d1,(a0)+
+ move.l d2,d0
+3:
+ movm.l (sp)+,#0x003c
+ rts
+
+ .even
+.globl _bn_sqr_words
+_bn_sqr_words:
+ move.l d2,-(sp)
+ move.l 8(sp),a0
+ move.l 12(sp),a1
+ move.l 16(sp),d2
+ jble 3f
+
+ moveq.l #-4,d1
+ and.l d2,d1
+ jbeq 2f
+1:
+ move.l (a1)+,d0
+ mulu.l d0,d1:d0
+ move.l d0,(a0)+
+ move.l d1,(a0)+
+
+ move.l (a1)+,d0
+ mulu.l d0,d1:d0
+ move.l d0,(a0)+
+ move.l d1,(a0)+
+
+ move.l (a1)+,d0
+ mulu.l d0,d1:d0
+ move.l d0,(a0)+
+ move.l d1,(a0)+
+
+ move.l (a1)+,d0
+ mulu.l d0,d1:d0
+ move.l d0,(a0)+
+ move.l d1,(a0)+
+
+ moveq.l #-4,d1
+ add.l d1,d2
+ and.l d2,d1
+ jbne 1b
+2:
+ tst.l d2
+ jbeq 3f
+
+ move.l (a1)+,d0
+ mulu.l d0,d1:d0
+ move.l d0,(a0)+
+ move.l d1,(a0)+
+
+ subq.l #1,d2
+ jbeq 3f
+
+ move.l (a1)+,d0
+ mulu.l d0,d1:d0
+ move.l d0,(a0)+
+ move.l d1,(a0)+
+
+ subq.l #1,d2
+ jbeq 3f
+
+ move.l (a1)+,d0
+ mulu.l d0,d1:d0
+ move.l d0,(a0)+
+ move.l d1,(a0)+
+3:
+ move.l (sp)+,d2
+ rts
+
+ .even
+.globl _bn_mul_comba8
+_bn_mul_comba8:
+ movm.l #0x3c20,-(sp)
+ movm.l 24(sp),#0x0700
+ clr.l d2
+ move.l d2,d3
+ move.l d2,d4
+ move.l d2,d5
+ move.l (a1),d0
+ move.l (a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l d2,(a0)
+ move.l d5,d2
+ move.l (a1),d0
+ move.l 4(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 4(a1),d0
+ move.l (a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l d3,4(a0)
+ move.l d5,d3
+ move.l 8(a1),d0
+ move.l (a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 4(a1),d0
+ move.l 4(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l (a1),d0
+ move.l 8(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l d4,8(a0)
+ move.l d5,d4
+ move.l (a1),d0
+ move.l 12(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 4(a1),d0
+ move.l 8(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 8(a1),d0
+ move.l 4(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 12(a1),d0
+ move.l (a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l d2,12(a0)
+ move.l d5,d2
+ move.l 16(a1),d0
+ move.l (a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 12(a1),d0
+ move.l 4(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 8(a1),d0
+ move.l 8(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 4(a1),d0
+ move.l 12(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l (a1),d0
+ move.l 16(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l d3,16(a0)
+ move.l d5,d3
+ move.l (a1),d0
+ move.l 20(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 4(a1),d0
+ move.l 16(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 8(a1),d0
+ move.l 12(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 12(a1),d0
+ move.l 8(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 16(a1),d0
+ move.l 4(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 20(a1),d0
+ move.l (a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l d4,20(a0)
+ move.l d5,d4
+ move.l 24(a1),d0
+ move.l (a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 20(a1),d0
+ move.l 4(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 16(a1),d0
+ move.l 8(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 12(a1),d0
+ move.l 12(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 8(a1),d0
+ move.l 16(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 4(a1),d0
+ move.l 20(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l (a1),d0
+ move.l 24(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l d2,24(a0)
+ move.l d5,d2
+ move.l (a1),d0
+ move.l 28(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 4(a1),d0
+ move.l 24(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 8(a1),d0
+ move.l 20(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 12(a1),d0
+ move.l 16(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 16(a1),d0
+ move.l 12(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 20(a1),d0
+ move.l 8(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 24(a1),d0
+ move.l 4(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 28(a1),d0
+ move.l (a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l d3,28(a0)
+ move.l d5,d3
+ move.l 28(a1),d0
+ move.l 4(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 24(a1),d0
+ move.l 8(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 20(a1),d0
+ move.l 12(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 16(a1),d0
+ move.l 16(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 12(a1),d0
+ move.l 20(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 8(a1),d0
+ move.l 24(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 4(a1),d0
+ move.l 28(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l d4,32(a0)
+ move.l d5,d4
+ move.l 8(a1),d0
+ move.l 28(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 12(a1),d0
+ move.l 24(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 16(a1),d0
+ move.l 20(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 20(a1),d0
+ move.l 16(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 24(a1),d0
+ move.l 12(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 28(a1),d0
+ move.l 8(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l d2,36(a0)
+ move.l d5,d2
+ move.l 28(a1),d0
+ move.l 12(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 24(a1),d0
+ move.l 16(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 20(a1),d0
+ move.l 20(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 16(a1),d0
+ move.l 24(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 12(a1),d0
+ move.l 28(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l d3,40(a0)
+ move.l d5,d3
+ move.l 16(a1),d0
+ move.l 28(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 20(a1),d0
+ move.l 24(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 24(a1),d0
+ move.l 20(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l 28(a1),d0
+ move.l 16(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l d4,44(a0)
+ move.l d5,d4
+ move.l 28(a1),d0
+ move.l 20(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 24(a1),d0
+ move.l 24(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l 20(a1),d0
+ move.l 28(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d2
+ addx.l d1,d3
+ addx.l d5,d4
+
+ move.l d2,48(a0)
+ move.l d5,d2
+ move.l 24(a1),d0
+ move.l 28(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l 28(a1),d0
+ move.l 24(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d3
+ addx.l d1,d4
+ addx.l d5,d2
+
+ move.l d3,52(a0)
+ move.l d5,d3
+ move.l 28(a1),d0
+ move.l 28(a2),d1
+
+ mulu.l d1,d1:d0
+ add.l d0,d4
+ addx.l d1,d2
+ addx.l d5,d3
+
+ move.l d4,56(a0)
+ move.l d2,60(a0)
+
+ movm.l (sp)+,#0x043c
+ rts
+
+ .even
+.globl _bn_sqr_comba8
+_bn_sqr_comba8:
+ movm.l #0x3e00,-(sp)
+ move.l 24(sp),a1
+ move.l 28(sp),a0
+ clr.l d5
+ move.l (a0),d1
+ move.l d5,d3
+ move.l d5,d4
+ move.l d5,d6
+
+ mulu.l d1,d0:d1
+ add.l d1,d5
+ addx.l d0,d3
+ addx.l d6,d4
+
+ move.l d5,(a1)
+ move.l d6,d5
+ move.l 4(a0),d2
+ move.l (a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+
+ move.l d3,4(a1)
+ move.l d6,d3
+ move.l 4(a0),d1
+
+ mulu.l d1,d0:d1
+ add.l d1,d4
+ addx.l d0,d5
+ addx.l d6,d3
+
+ move.l 8(a0),d2
+ move.l (a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+
+ move.l d4,8(a1)
+ move.l d6,d4
+ move.l 12(a0),d2
+ move.l (a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+
+ move.l 8(a0),d2
+ move.l 4(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+
+ move.l d5,12(a1)
+ move.l d6,d5
+ move.l 8(a0),d1
+
+ mulu.l d1,d0:d1
+ add.l d1,d3
+ addx.l d0,d4
+ addx.l d6,d5
+
+ move.l 12(a0),d2
+ move.l 4(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+
+ move.l 16(a0),d2
+ move.l (a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+
+ move.l d3,16(a1)
+ move.l d6,d3
+ move.l 20(a0),d2
+ move.l (a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+
+ move.l 16(a0),d2
+ move.l 4(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+
+ move.l 12(a0),d2
+ move.l 8(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+
+ move.l d4,20(a1)
+ move.l d6,d4
+ move.l 12(a0),d1
+
+ mulu.l d1,d0:d1
+ add.l d1,d5
+ addx.l d0,d3
+ addx.l d6,d4
+
+ move.l 16(a0),d2
+ move.l 8(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+
+ move.l 20(a0),d2
+ move.l 4(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+
+ move.l 24(a0),d2
+ move.l (a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+
+ move.l d5,24(a1)
+ move.l d6,d5
+ move.l 28(a0),d2
+ move.l (a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+
+ move.l 24(a0),d2
+ move.l 4(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+
+ move.l 20(a0),d2
+ move.l 8(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+
+ move.l 16(a0),d2
+ move.l 12(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+
+ move.l d3,28(a1)
+ move.l d6,d3
+ move.l 16(a0),d1
+
+ mulu.l d1,d0:d1
+ add.l d1,d4
+ addx.l d0,d5
+ addx.l d6,d3
+
+ move.l 20(a0),d2
+ move.l 12(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+
+ move.l 24(a0),d2
+ move.l 8(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+
+ move.l 28(a0),d2
+ move.l 4(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+
+ move.l d4,32(a1)
+ move.l d6,d4
+ move.l 28(a0),d2
+ move.l 8(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+
+ move.l 24(a0),d2
+ move.l 12(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+
+ move.l 20(a0),d2
+ move.l 16(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+
+ move.l d5,36(a1)
+ move.l d6,d5
+ move.l 20(a0),d1
+
+ mulu.l d1,d0:d1
+ add.l d1,d3
+ addx.l d0,d4
+ addx.l d6,d5
+
+ move.l 24(a0),d2
+ move.l 16(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+
+ move.l 28(a0),d2
+ move.l 12(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+
+ move.l d3,40(a1)
+ move.l d6,d3
+ move.l 28(a0),d2
+ move.l 16(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+
+ move.l 24(a0),d2
+ move.l 20(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+ add.l d1,d4
+ addx.l d2,d5
+ addx.l d6,d3
+
+ move.l d4,44(a1)
+ move.l d6,d4
+ move.l 24(a0),d1
+
+ mulu.l d1,d0:d1
+ add.l d1,d5
+ addx.l d0,d3
+ addx.l d6,d4
+
+ move.l 28(a0),d2
+ move.l 20(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+ add.l d1,d5
+ addx.l d2,d3
+ addx.l d6,d4
+
+ move.l d5,48(a1)
+ move.l d6,d5
+ move.l 28(a0),d2
+ move.l 24(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+ add.l d1,d3
+ addx.l d2,d4
+ addx.l d6,d5
+
+ move.l d3,52(a1)
+ move.l d6,d3
+ move.l 28(a0),d1
+
+ mulu.l d1,d0:d1
+ add.l d1,d4
+ addx.l d0,d5
+ addx.l d6,d3
+
+ move.l d4,56(a1)
+ move.l d5,60(a1)
+ movm.l (sp)+,#0x7c
+ rts
+
+ .even
+.globl _bn_sqr_comba4
+_bn_sqr_comba4:
+ movm.l #0x3e00,-(sp)
+ move.l 24(sp),a1
+ move.l 28(sp),a0
+ clr.l d5
+ move.l (a0),d1
+ move.l d5,d4
+ move.l d5,d3
+ move.l d5,d6
+
+ mulu.l d1,d0:d1
+ add.l d1,d5
+ addx.l d0,d4
+ addx.l d6,d3
+
+ move.l d5,(a1)
+ move.l d6,d5
+ move.l 4(a0),d2
+ move.l (a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d3
+ addx.l d6,d5
+ add.l d1,d4
+ addx.l d2,d3
+ addx.l d6,d5
+
+ move.l d4,4(a1)
+ move.l d6,d4
+ move.l 4(a0),d1
+
+ mulu.l d1,d0:d1
+ add.l d1,d3
+ addx.l d0,d5
+ addx.l d6,d4
+
+ move.l 8(a0),d2
+ move.l (a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d5
+ addx.l d6,d4
+ add.l d1,d3
+ addx.l d2,d5
+ addx.l d6,d4
+
+ move.l d3,8(a1)
+ move.l d6,d3
+ move.l 12(a0),d2
+ move.l (a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d4
+ addx.l d6,d3
+ add.l d1,d5
+ addx.l d2,d4
+ addx.l d6,d3
+
+ move.l 8(a0),d2
+ move.l 4(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d5
+ addx.l d2,d4
+ addx.l d6,d3
+ add.l d1,d5
+ addx.l d2,d4
+ addx.l d6,d3
+
+ move.l d5,12(a1)
+ move.l d6,d5
+ move.l 8(a0),d1
+
+ mulu.l d1,d0:d1
+ add.l d1,d4
+ addx.l d0,d3
+ addx.l d6,d5
+
+ move.l 12(a0),d2
+ move.l 4(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d4
+ addx.l d2,d3
+ addx.l d6,d5
+ add.l d1,d4
+ addx.l d2,d3
+ addx.l d6,d5
+
+ move.l d4,16(a1)
+ move.l d6,d4
+ move.l 12(a0),d2
+ move.l 8(a0),d1
+
+ mulu.l d2,d2:d1
+ add.l d1,d3
+ addx.l d2,d5
+ addx.l d6,d4
+ add.l d1,d3
+ addx.l d2,d5
+ addx.l d6,d4
+
+ move.l d3,20(a1)
+ move.l d6,d3
+ move.l 12(a0),d1
+
+ mulu.l d1,d0:d1
+ add.l d1,d5
+ addx.l d0,d4
+ addx.l d6,d3
+
+ move.l d5,24(a1)
+ move.l d4,28(a1)
+ movm.l (sp)+,#0x7c
+ rts
+
+ .even
+.globl _bn_mul_comba4
+_bn_mul_comba4:
+ movm.l #0x3c20,-(sp)
+ move.l 24(sp),a2
+ move.l 28(sp),a0
+ move.l 32(sp),a1
+ clr.l d4
+ move.l (a0),d1
+ move.l (a1),d0
+ move.l d4,d3
+ move.l d4,d2
+ move.l d4,d5
+
+ mulu.l d1,d0:d1
+ add.l d1,d4
+ addx.l d0,d3
+ addx.l d5,d2
+
+ move.l d4,(a2)
+ move.l d5,d4
+ move.l (a0),d1
+ move.l 4(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d3
+ addx.l d0,d2
+ addx.l d5,d4
+
+ move.l 4(a0),d1
+ move.l (a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d3
+ addx.l d0,d2
+ addx.l d5,d4
+
+ move.l d3,4(a2)
+ move.l d5,d3
+ move.l 8(a0),d1
+ move.l (a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d2
+ addx.l d0,d4
+ addx.l d5,d3
+
+ move.l 4(a0),d1
+ move.l 4(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d2
+ addx.l d0,d4
+ addx.l d5,d3
+
+ move.l (a0),d1
+ move.l 8(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d2
+ addx.l d0,d4
+ addx.l d5,d3
+
+ move.l d2,8(a2)
+ move.l d5,d2
+ move.l (a0),d1
+ move.l 12(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d4
+ addx.l d0,d3
+ addx.l d5,d2
+
+ move.l 4(a0),d1
+ move.l 8(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d4
+ addx.l d0,d3
+ addx.l d5,d2
+
+ move.l 8(a0),d1
+ move.l 4(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d4
+ addx.l d0,d3
+ addx.l d5,d2
+
+ move.l 12(a0),d1
+ move.l (a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d4
+ addx.l d0,d3
+ addx.l d5,d2
+
+ move.l d4,12(a2)
+ move.l d5,d4
+ move.l 12(a0),d1
+ move.l 4(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d3
+ addx.l d0,d2
+ addx.l d5,d4
+
+ move.l 8(a0),d1
+ move.l 8(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d3
+ addx.l d0,d2
+ addx.l d5,d4
+
+ move.l 4(a0),d1
+ move.l 12(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d3
+ addx.l d0,d2
+ addx.l d5,d4
+
+ move.l d3,16(a2)
+ move.l d5,d3
+ move.l 8(a0),d1
+ move.l 12(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d2
+ addx.l d0,d4
+ addx.l d5,d3
+
+ move.l 12(a0),d1
+ move.l 8(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d2
+ addx.l d0,d4
+ addx.l d5,d3
+
+ move.l d2,20(a2)
+ move.l d5,d2
+ move.l 12(a0),d1
+ move.l 12(a1),d0
+
+ mulu.l d1,d0:d1
+ add.l d1,d4
+ addx.l d0,d3
+ addx.l d5,d2
+
+ move.l d4,24(a2)
+ move.l d3,28(a2)
+ movm.l (sp)+,#0x43c
+ rts
+
+/* bn_div_words should really just be inlined wherever it's used */
+
+ .even
+.globl _bn_div_words
+_bn_div_words:
+ move.l 4(sp),d1
+ move.l 8(sp),d0
+ divu.l 12(sp),d1:d0
+ rts
+
+ .even
+.globl _bn_add_words
+_bn_add_words:
+ movm.l #0x2030,-(sp)
+ movm.l 16(sp),#0x0f00
+ clr.l d0
+ tst.l a3
+ jble 3f
+
+/* d0 is 0, use this shift to clear the eXtend bit */
+ lsl.l #1,d0
+1:
+ move.l (a1)+,d1
+ move.l (a2)+,d2
+ addx.l d1,d2
+ move.l d2,(a0)+
+ subq.l #1,a3
+ tst.l a3
+ jble 2f
+
+ move.l (a1)+,d1
+ move.l (a2)+,d2
+ addx.l d1,d2
+ move.l d2,(a0)+
+ subq.l #1,a3
+ tst.l a3
+ jble 2f
+
+ move.l (a1)+,d1
+ move.l (a2)+,d2
+ addx.l d1,d2
+ move.l d2,(a0)+
+ subq.l #1,a3
+ tst.l a3
+ jble 2f
+
+ move.l (a1)+,d1
+ move.l (a2)+,d2
+ addx.l d1,d2
+ move.l d2,(a0)+
+ subq.l #1,a3
+ tst.l a3
+ jgt 1b
+2:
+ addx.l d0,d0
+3:
+ movm.l (sp)+,#0x0c04
+ rts
+
+ .even
+.globl _bn_sub_words
+_bn_sub_words:
+ movm.l #0x2030,-(sp)
+ movm.l 16(sp),#0x0f00
+ clr.l d0
+ tst.l a3
+ jble 3f
+
+ lsl.l #1,d0
+1:
+ move.l (a1)+,d2
+ move.l (a2)+,d1
+ subx.l d1,d2
+ move.l d2,(a0)+
+ subq.l #1,a3
+ tst.l a3
+ jble 2f
+
+ move.l (a1)+,d2
+ move.l (a2)+,d1
+ subx.l d1,d2
+ move.l d2,(a0)+
+ subq.l #1,a3
+ tst.l a3
+ jble 2f
+
+ move.l (a1)+,d2
+ move.l (a2)+,d1
+ subx.l d1,d2
+ move.l d2,(a0)+
+ subq.l #1,a3
+ tst.l a3
+ jble 2f
+
+ move.l (a1)+,d2
+ move.l (a2)+,d1
+ subx.l d1,d2
+ move.l d2,(a0)+
+ subq.l #1,a3
+ tst.l a3
+ jgt 1b
+2:
+ addx.l d0,d0
+3:
+ movm.l (sp)+,#0x0c04
+ rts
diff --git a/sdk/recipes/patches/openssl/Configure.p b/sdk/recipes/patches/openssl/Configure.p
index e9cde6c..c54b734 100644
--- a/sdk/recipes/patches/openssl/Configure.p
+++ b/sdk/recipes/patches/openssl/Configure.p
@@ -7,7 +7,7 @@
+"arm-unknown-riscos","arm-unknown-riscos-gcc:-DL_ENDIAN -DTERMIOS -DNO_SYS_UN_H -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG DES_RISC1::::::::::::::::::::echo",
+"m68k-atari-mint","m68k-atari-mint-gcc:-DB_ENDIAN -DTERMIOS -DNO_SYSLOG -DNO_SYS_UN_H -DOPENSSL_USE_IPV6=0 -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG DES_RISC1::::::::::::::::::::m68k-atari-mint-ranlib",
+"m5475-atari-mint","m5475-atari-mint-gcc:-DB_ENDIAN -DTERMIOS -DNO_SYSLOG -DNO_SYS_UN_H -DOPENSSL_USE_IPV6=0 -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG DES_RISC1::::::::::::::::::::m5475-atari-mint-ranlib",
-+"m68k-unknown-amigaos","m68k-unknown-amigaos-gcc:-DB_ENDIAN -DOPENSSL_SYS_AMIGAOS3 -DNO_SYSLOG -DHAVE_FORK=0 -DNO_SYS_PARAM_H -DNO_SYS_UN_H -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-lnet -lm:BN_LLONG DES_RISC1::::::::::::::::::::m68k-unknown-amigaos-ranlib",
++"m68k-unknown-amigaos","m68k-unknown-amigaos-gcc:-DB_ENDIAN -DOPENSSL_SYS_AMIGAOS3 -DNO_SYSLOG -DHAVE_FORK=0 -DNO_SYS_PARAM_H -DNO_SYS_UN_H -m68020 -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-lnet -lm:BN_LLONG::bn_m68k.o::::::::::::::::::m68k-unknown-amigaos-ranlib",
+"ppc-amigaos","ppc-amigaos-gcc:-DB_ENDIAN -DOPENSSL_SYS_AMIGAOS4 -DNO_SYSLOG -DHAVE_FORK=0 -DNO_SYS_PARAM_H -DNO_SYS_UN_H -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG RC4_CHAR RC4_CHUNK:${ppc32_asm}:linux32::::::ppc-amigaos-ranlib",
+"i686-w64-mingw32", "gcc:-DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -march=i486 -Wall::-D_MT:MINGW32:-lws2_32 -lgdi32 -lcrypt32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_asm}:coff:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin:.dll.a",
+
diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.Makefile.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.Makefile.p
new file mode 100644
index 0000000..8d3bfc6
--- /dev/null
+++ b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.Makefile.p
@@ -0,0 +1,12 @@
+--- crypto/bn/Makefile 2017-01-26 13:22:03.000000000 +0000
++++ crypto/bn/Makefile 2017-02-11 15:24:31.133017711 +0000
+@@ -60,6 +60,9 @@ lib: $(LIBOBJ)
+ $(RANLIB) $(LIB) || echo Never mind.
+ @touch lib
+
++bn_m68k.o: asm/bn_m68k.s
++ $(CC) $(CFLAGS) -c -o $@ asm/bn_m68k.s
++
+ bn-586.s: asm/bn-586.pl ../perlasm/x86asm.pl
+ $(PERL) asm/bn-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+ co-586.s: asm/co-586.pl ../perlasm/x86asm.pl
diff --git a/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.bn_div.c.p b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.bn_div.c.p
new file mode 100644
index 0000000..0d5492f
--- /dev/null
+++ b/sdk/recipes/patches/openssl/m68k-unknown-amigaos/crypto.bn.bn_div.c.p
@@ -0,0 +1,25 @@
+--- crypto/bn/bn_div.c 2017-01-26 13:22:03.000000000 +0000
++++ crypto/bn/bn_div.c 2017-02-11 16:06:29.437010335 +0000
+@@ -175,6 +175,22 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, cons
+ q; \
+ })
+ # define REMAINDER_IS_ALREADY_CALCULATED
++# elif defined(__mc68020__)
++ /* Same rationale as for i386. On the 68020-60/CPU32 the divu
++ * instruction will take a 64 bit dividend in a register pair
++ * and overwrite that pair with the remainder:quotient.
++ * Howard Chu
++ */
++# undef bn_div_words
++# define bn_div_words(n0,n1,d0) \
++ ({ asm volatile ( \
++ "divu.l %4,%2:%3" \
++ : "=d"(rem), "=d"(q) \
++ : "0"(n0), "1"(n1), "d"(d0) \
++ : "cc"); \
++ q; \
++ })
++# define REMAINDER_IS_ALREADY_CALCULATED
+ # endif /* __<cpu> */
+ # endif /* __GNUC__ */
+ # endif /* OPENSSL_NO_ASM */