Skip to content

Commit

Permalink
Upgrade for OpenSSL 1.1.1p (#131)
Browse files Browse the repository at this point in the history
* upgrade for openssl 1.1.1p

Signed-off-by: Jing He <jing.j.he@intel.com>

* generated by:  $ diff ../openssl_source/openssl-1.1.1p/crypto/bn/x86_64-mont5.s ../openssl_source/openssl-1.1.1o/crypto/bn/x86_64-mont5.s

Signed-off-by: Jing He <jing.j.he@intel.com>

* generated by: (WSL) $ diff ../openssl_source/openssl-1.1.1p/crypto/bn/x86_64-mont5.asm ../openssl_source/openssl-1.1.1o/crypto/bn/x86_64-mont5.asm

Signed-off-by: Jing He <jing.j.he@intel.com>

* upgrade for openssl 1.1.1p

Signed-off-by: Jing He <jing.j.he@intel.com>
  • Loading branch information
jinghe-INTC authored Jul 4, 2022
1 parent 89fe512 commit 4c0b9a2
Show file tree
Hide file tree
Showing 5 changed files with 403 additions and 383 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Introduction
------------
The Intel® Software Guard Extensions SSL (Intel® SGX SSL) cryptographic library is intended to provide cryptographic services for Intel® Software Guard Extensions (SGX) enclave applications.
The Intel® SGX SSL cryptographic library is based on the underlying OpenSSL* Open Source project, providing a full-strength general purpose cryptography library.
Supported OpenSSL version is 1.1.1o. To work with 1.1.0 version please use "openssl_1.1.0" branch.
Supported OpenSSL version is 1.1.1p. To work with 1.1.0 version please use "openssl_1.1.0" branch.

In order to build Intel® SGX SSL libraries based on old OpenSSL version, checkout the tag with the corresponding versioning, e.g. lin_2.5_1.1.1c. Tag naming convention ``[lin/win]_<Intel(R) SGX SDK VERSION>_<OpenSSL VERSION>``.

Expand Down Expand Up @@ -35,7 +35,7 @@ Windows
(Note: Perl, NASM need to be included in machine's PATH variable)

To build Intel® SGX SSL package in Windows OS:
1. Download OpenSSL package into openssl_source/ directory. (tar.gz package, e.g. openssl-1.1.1o.tar.gz)
1. Download OpenSSL package into openssl_source/ directory. (tar.gz package, e.g. openssl-1.1.1p.tar.gz)
2. Download and install latest SGX SDK from [Intel Developer Zone](https://software.intel.com/en-us/sgx-sdk/download). You can find installation guide from the same website.
3. Change the directory to the SGXSSL path and enter the following command:
```
Expand All @@ -51,7 +51,7 @@ Linux
- Intel(R) SGX Linux latest release, including SDK, PSW, and driver

To build Intel® SGX SSL package in Linux OS:
1. Download OpenSSL 1.1.1o package into openssl_source/ directory. (tar.gz package, e.g. openssl-1.1.1o.tar.gz)
1. Download OpenSSL 1.1.1p package into openssl_source/ directory. (tar.gz package, e.g. openssl-1.1.1p.tar.gz)
2. Download and install latest SGX SDK from [01.org](https://01.org/intel-software-guard-extensions/downloads). You can find installation guide in the same website.
3. Source SGX SDK's environment variables.
4. Cd to Linux/ directory and run:
Expand Down
181 changes: 0 additions & 181 deletions openssl_source/Linux/x86_64-mont5.s
Original file line number Diff line number Diff line change
Expand Up @@ -2048,185 +2048,6 @@ __bn_post4x_internal:
ret
.cfi_endproc
.size __bn_post4x_internal,.-__bn_post4x_internal
.globl bn_from_montgomery
.type bn_from_montgomery,@function
.align 32
bn_from_montgomery:
.cfi_startproc
testl $7,%r9d
jz bn_from_mont8x
xorl %eax,%eax
ret
.cfi_endproc
.size bn_from_montgomery,.-bn_from_montgomery

.type bn_from_mont8x,@function
.align 32
bn_from_mont8x:
.cfi_startproc
.byte 0x67
movq %rsp,%rax
.cfi_def_cfa_register %rax
pushq %rbx
.cfi_offset %rbx,-16
pushq %rbp
.cfi_offset %rbp,-24
pushq %r12
.cfi_offset %r12,-32
pushq %r13
.cfi_offset %r13,-40
pushq %r14
.cfi_offset %r14,-48
pushq %r15
.cfi_offset %r15,-56
.Lfrom_prologue:

shll $3,%r9d
leaq (%r9,%r9,2),%r10
negq %r9
movq (%r8),%r8








leaq -320(%rsp,%r9,2),%r11
movq %rsp,%rbp
subq %rdi,%r11
andq $4095,%r11
cmpq %r11,%r10
jb .Lfrom_sp_alt
subq %r11,%rbp
leaq -320(%rbp,%r9,2),%rbp
jmp .Lfrom_sp_done

.align 32
.Lfrom_sp_alt:
leaq 4096-320(,%r9,2),%r10
leaq -320(%rbp,%r9,2),%rbp
subq %r10,%r11
movq $0,%r10
cmovcq %r10,%r11
subq %r11,%rbp
.Lfrom_sp_done:
andq $-64,%rbp
movq %rsp,%r11
subq %rbp,%r11
andq $-4096,%r11
leaq (%r11,%rbp,1),%rsp
movq (%rsp),%r10
cmpq %rbp,%rsp
ja .Lfrom_page_walk
jmp .Lfrom_page_walk_done

.Lfrom_page_walk:
leaq -4096(%rsp),%rsp
movq (%rsp),%r10
cmpq %rbp,%rsp
ja .Lfrom_page_walk
.Lfrom_page_walk_done:

movq %r9,%r10
negq %r9










movq %r8,32(%rsp)
movq %rax,40(%rsp)
.cfi_escape 0x0f,0x05,0x77,0x28,0x06,0x23,0x08
.Lfrom_body:
movq %r9,%r11
leaq 48(%rsp),%rax
pxor %xmm0,%xmm0
jmp .Lmul_by_1

.align 32
.Lmul_by_1:
movdqu (%rsi),%xmm1
movdqu 16(%rsi),%xmm2
movdqu 32(%rsi),%xmm3
movdqa %xmm0,(%rax,%r9,1)
movdqu 48(%rsi),%xmm4
movdqa %xmm0,16(%rax,%r9,1)
.byte 0x48,0x8d,0xb6,0x40,0x00,0x00,0x00
movdqa %xmm1,(%rax)
movdqa %xmm0,32(%rax,%r9,1)
movdqa %xmm2,16(%rax)
movdqa %xmm0,48(%rax,%r9,1)
movdqa %xmm3,32(%rax)
movdqa %xmm4,48(%rax)
leaq 64(%rax),%rax
subq $64,%r11
jnz .Lmul_by_1

.byte 102,72,15,110,207
.byte 102,72,15,110,209
.byte 0x67
movq %rcx,%rbp
.byte 102,73,15,110,218
movl OPENSSL_ia32cap_P+8(%rip),%r11d
andl $0x80108,%r11d
cmpl $0x80108,%r11d
jne .Lfrom_mont_nox

leaq (%rax,%r9,1),%rdi
call __bn_sqrx8x_reduction
call __bn_postx4x_internal

pxor %xmm0,%xmm0
leaq 48(%rsp),%rax
jmp .Lfrom_mont_zero

.align 32
.Lfrom_mont_nox:
call __bn_sqr8x_reduction
call __bn_post4x_internal

pxor %xmm0,%xmm0
leaq 48(%rsp),%rax
jmp .Lfrom_mont_zero

.align 32
.Lfrom_mont_zero:
movq 40(%rsp),%rsi
.cfi_def_cfa %rsi,8
movdqa %xmm0,0(%rax)
movdqa %xmm0,16(%rax)
movdqa %xmm0,32(%rax)
movdqa %xmm0,48(%rax)
leaq 64(%rax),%rax
subq $32,%r9
jnz .Lfrom_mont_zero

movq $1,%rax
movq -48(%rsi),%r15
.cfi_restore %r15
movq -40(%rsi),%r14
.cfi_restore %r14
movq -32(%rsi),%r13
.cfi_restore %r13
movq -24(%rsi),%r12
.cfi_restore %r12
movq -16(%rsi),%rbp
.cfi_restore %rbp
movq -8(%rsi),%rbx
.cfi_restore %rbx
leaq (%rsi),%rsp
.cfi_def_cfa_register %rsp
.Lfrom_epilogue:
ret
.cfi_endproc
.size bn_from_mont8x,.-bn_from_mont8x
.type bn_mulx4x_mont_gather5,@function
.align 32
bn_mulx4x_mont_gather5:
Expand Down Expand Up @@ -3790,9 +3611,7 @@ bn_gather5:
.cfi_endproc
.size bn_gather5,.-bn_gather5
.align 64

.Linc:
.long 0,0, 1,1
.long 2,2, 2,2
.byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,119,105,116,104,32,115,99,97,116,116,101,114,47,103,97,116,104,101,114,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0

Loading

0 comments on commit 4c0b9a2

Please sign in to comment.