Re: fipscanister with assembly language optimization and non-SSE2 capable processors?

2012-12-19 Thread Jeffrey Walton
On Tue, Dec 18, 2012 at 11:15 PM, Bill Durant cipherte...@gmail.com wrote:
 Is it not possible to build a FIPS-capable OpenSSL with assembly language 
 optimization enabled in the fipscanister that works under non-SSE2 capable 
 processors?

 On SUSE Linux Enterprise Server 10, I have built the fipscanister with 
 assembly language optimization enabled as follows:

 ./config fipscanisterbuild

 Next I built a FIPS-capable OpenSSL using this fipscanister.

 And then I built a simple application that just calls FIPS_mode_set(1) to 
 enable FIPS mode.

 When I run that app on a system with a processor that lacks support for the 
 SSE2 instruction set, I get the following error:

 SSL: 
 0:755466380:fips.c:319:0:error:2D07808C:lib(45):func(120):reason(140)

 But when I build the fipcanister *without* assembly language optimization 
 enabled as follows:

 ./config fipscanisterbuild no-asm

 The same app works fine and FIPS mode can be enabled.

 Per code inspection of the OpenSSL sources, it appears like the following 
 code is the one that prevents FIPS enabling (in fips/fips.c):

 #ifdef OPENSSL_IA32_SSE2
 {
 extern unsigned int OPENSSL_ia32cap_P[2];
 if ((OPENSSL_ia32cap_P[0]  (125|126)) != (125|126))
 {
 FIPSerr(FIPS_F_FIPS_MODULE_MODE_SET,FIPS_R_UNSUPPORTED_PLATFORM);
 fips_selftest_fail = 1;
 ret = 0;
 goto end;
 }
 OPENSSL_ia32cap_P[0] |= (128);/* set shared cache   */
 OPENSSL_ia32cap_P[1] = ~(1(60-32));  /* clear AVX*/
 }
 #endif

 And BTW, building the FIPS-capble OpenSSL with the no-sse2 option as follows 
 does not fix the issue:

 ./config fips --prefix=$FIPSDIR no-sse2 no-idea no-mdc2 no-rc5 shared

 The problem is with the fipscanister itself.  It needs to be built with 
 assembly language optimization disabled in order to get into FIPS mode under 
 non-SSE2 processors.

 So how to build a FIPS-capable OpenSSL with assembly language optimization 
 enabled in the fipscanister that works under non-SSE2 capable processors?

 Is that not possible?
No (first question); Yes (second question) (if I count questions
correctly). From the User Guide 2.0 (page 24-25):

Note that for x86 there are three possible optimization levels:

1. No optimization (plain C)
2. SSE2 optimization
3. AES-NI+PCLMULQDQ+SSSE3 optimization

Note that other theoretically possible combinations (e.g. AES-NI only,
or SSE3 only) are not enabled individually15, so that a processor
which does not support all three of AES-NI, PCLMULQDQ, and SSSE3 will
fall back to using only SSE2 optimization.

Jeff
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: fipscanister with assembly language optimization and non-SSE2 capable processors?

2012-12-19 Thread Bill Durant
Hello Jeffrey:

Thank you for the response.

So FIPS mode enable is supported on non-SSE2 processors *only* with a 
fipscanister that is built with the no-asm option?

Thanks,

Bill
On Dec 19, 2012, at 1:13 AM, Jeffrey Walton wrote:

 On Tue, Dec 18, 2012 at 11:15 PM, Bill Durant cipherte...@gmail.com wrote:
 Is it not possible to build a FIPS-capable OpenSSL with assembly language 
 optimization enabled in the fipscanister that works under non-SSE2 capable 
 processors?
 
 On SUSE Linux Enterprise Server 10, I have built the fipscanister with 
 assembly language optimization enabled as follows:
 
./config fipscanisterbuild
 
 Next I built a FIPS-capable OpenSSL using this fipscanister.
 
 And then I built a simple application that just calls FIPS_mode_set(1) to 
 enable FIPS mode.
 
 When I run that app on a system with a processor that lacks support for the 
 SSE2 instruction set, I get the following error:
 
SSL: 
 0:755466380:fips.c:319:0:error:2D07808C:lib(45):func(120):reason(140)
 
 But when I build the fipcanister *without* assembly language optimization 
 enabled as follows:
 
 ./config fipscanisterbuild no-asm
 
 The same app works fine and FIPS mode can be enabled.
 
 Per code inspection of the OpenSSL sources, it appears like the following 
 code is the one that prevents FIPS enabling (in fips/fips.c):
 
 #ifdef OPENSSL_IA32_SSE2
{
extern unsigned int OPENSSL_ia32cap_P[2];
if ((OPENSSL_ia32cap_P[0]  (125|126)) != (125|126))
{
FIPSerr(FIPS_F_FIPS_MODULE_MODE_SET,FIPS_R_UNSUPPORTED_PLATFORM);
fips_selftest_fail = 1;
ret = 0;
goto end;
}
OPENSSL_ia32cap_P[0] |= (128);/* set shared cache   */
OPENSSL_ia32cap_P[1] = ~(1(60-32));  /* clear AVX*/
}
 #endif
 
 And BTW, building the FIPS-capble OpenSSL with the no-sse2 option as follows 
 does not fix the issue:
 
./config fips --prefix=$FIPSDIR no-sse2 no-idea no-mdc2 no-rc5 shared
 
 The problem is with the fipscanister itself.  It needs to be built with 
 assembly language optimization disabled in order to get into FIPS mode under 
 non-SSE2 processors.
 
 So how to build a FIPS-capable OpenSSL with assembly language optimization 
 enabled in the fipscanister that works under non-SSE2 capable processors?
 
 Is that not possible?
 No (first question); Yes (second question) (if I count questions
 correctly). From the User Guide 2.0 (page 24-25):
 
 Note that for x86 there are three possible optimization levels:
 
 1. No optimization (plain C)
 2. SSE2 optimization
 3. AES-NI+PCLMULQDQ+SSSE3 optimization
 
 Note that other theoretically possible combinations (e.g. AES-NI only,
 or SSE3 only) are not enabled individually15, so that a processor
 which does not support all three of AES-NI, PCLMULQDQ, and SSSE3 will
 fall back to using only SSE2 optimization.
 
 Jeff
 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   majord...@openssl.org

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: fipscanister with assembly language optimization and non-SSE2 capable processors?

2012-12-19 Thread Steve Marquess
On 12/19/2012 05:21 AM, Bill Durant wrote:
 Hello Jeffrey:
 
 Thank you for the response.
 
 So FIPS mode enable is supported on non-SSE2 processors *only* with a 
 fipscanister that is built with the no-asm option?

Correct. That's an unfortunate limitation of the requirements of the
validation process, where each code path permutation has to be
separately tested at non-trivial expense. So even though it would easy
in the code to do a runtime selection of the appropriate optimizations,
we couldn't afford to validate each permutation independently. Hence the
three tiers of optimization.

Also note that for the most recent validation (2.0 module, #1747) there
aren't many no-asm platforms, so effectively non-SSE2 capable x86
processors aren't supported on many O/Ses.

-Steve M.

-- 
Steve Marquess
OpenSSL Software Foundation, Inc.
1829 Mount Ephraim Road
Adamstown, MD  21710
USA
+1 877 673 6775 s/b
+1 301 874 2571 direct
marqu...@opensslfoundation.com
marqu...@openssl.com
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: fipscanister with assembly language optimization and non-SSE2 capable processors?

2012-12-19 Thread Bill Durant
Wow... That is certainly a very unfortunate limitation... Thank you for 
clarifying... Bill

On Dec 19, 2012, at 6:40 AM, Steve Marquess wrote:

 On 12/19/2012 05:21 AM, Bill Durant wrote:
 Hello Jeffrey:
 
 Thank you for the response.
 
 So FIPS mode enable is supported on non-SSE2 processors *only* with a 
 fipscanister that is built with the no-asm option?
 
 Correct. That's an unfortunate limitation of the requirements of the
 validation process, where each code path permutation has to be
 separately tested at non-trivial expense. So even though it would easy
 in the code to do a runtime selection of the appropriate optimizations,
 we couldn't afford to validate each permutation independently. Hence the
 three tiers of optimization.
 
 Also note that for the most recent validation (2.0 module, #1747) there
 aren't many no-asm platforms, so effectively non-SSE2 capable x86
 processors aren't supported on many O/Ses.
 
 -Steve M.
 
 -- 
 Steve Marquess
 OpenSSL Software Foundation, Inc.
 1829 Mount Ephraim Road
 Adamstown, MD  21710
 USA
 +1 877 673 6775 s/b
 +1 301 874 2571 direct
 marqu...@opensslfoundation.com
 marqu...@openssl.com

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


fipscanister with assembly language optimization and non-SSE2 capable processors?

2012-12-18 Thread Bill Durant
Hello:

Is it not possible to build a FIPS-capable OpenSSL with assembly language 
optimization enabled in the fipscanister that works under non-SSE2 capable 
processors?

On SUSE Linux Enterprise Server 10, I have built the fipscanister with assembly 
language optimization enabled as follows:

./config fipscanisterbuild

Next I built a FIPS-capable OpenSSL using this fipscanister.

And then I built a simple application that just calls FIPS_mode_set(1) to 
enable FIPS mode.

When I run that app on a system with a processor that lacks support for the 
SSE2 instruction set, I get the following error:

SSL: 
0:755466380:fips.c:319:0:error:2D07808C:lib(45):func(120):reason(140)

But when I build the fipcanister *without* assembly language optimization 
enabled as follows:

./config fipscanisterbuild no-asm

The same app works fine and FIPS mode can be enabled.

Per code inspection of the OpenSSL sources, it appears like the following code 
is the one that prevents FIPS enabling (in fips/fips.c):

#ifdef OPENSSL_IA32_SSE2
{
extern unsigned int OPENSSL_ia32cap_P[2];
if ((OPENSSL_ia32cap_P[0]  (125|126)) != (125|126))
{
FIPSerr(FIPS_F_FIPS_MODULE_MODE_SET,FIPS_R_UNSUPPORTED_PLATFORM);
fips_selftest_fail = 1;
ret = 0;
goto end;
}
OPENSSL_ia32cap_P[0] |= (128);/* set shared cache   */
OPENSSL_ia32cap_P[1] = ~(1(60-32));  /* clear AVX*/
}
#endif

And BTW, building the FIPS-capble OpenSSL with the no-sse2 option as follows 
does not fix the issue:

./config fips --prefix=$FIPSDIR no-sse2 no-idea no-mdc2 no-rc5 shared

The problem is with the fipscanister itself.  It needs to be built with 
assembly language optimization disabled in order to get into FIPS mode under 
non-SSE2 processors.

So how to build a FIPS-capable OpenSSL with assembly language optimization 
enabled in the fipscanister that works under non-SSE2 capable processors?

Is that not possible?

Thanks,

Bill


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: fipscanister with assembly language optimization and non-SSE2 capable processors?

2012-12-18 Thread Jakob Bohm

On 12/19/2012 5:15 AM, Bill Durant wrote:

Hello:

Is it not possible to build a FIPS-capable OpenSSL with assembly language 
optimization enabled in the fipscanister that works under non-SSE2 capable 
processors?

On SUSE Linux Enterprise Server 10, I have built the fipscanister with assembly 
language optimization enabled as follows:

./config fipscanisterbuild

Next I built a FIPS-capable OpenSSL using this fipscanister.

And then I built a simple application that just calls FIPS_mode_set(1) to 
enable FIPS mode.

When I run that app on a system with a processor that lacks support for the 
SSE2 instruction set, I get the following error:

SSL: 
0:755466380:fips.c:319:0:error:2D07808C:lib(45):func(120):reason(140)

But when I build the fipcanister *without* assembly language optimization 
enabled as follows:

./config fipscanisterbuild no-asm

The same app works fine and FIPS mode can be enabled.

Per code inspection of the OpenSSL sources, it appears like the following code 
is the one that prevents FIPS enabling (in fips/fips.c):

#ifdef OPENSSL_IA32_SSE2
 {
 extern unsigned int OPENSSL_ia32cap_P[2];
 if ((OPENSSL_ia32cap_P[0]  (125|126)) != (125|126))
 {
 FIPSerr(FIPS_F_FIPS_MODULE_MODE_SET,FIPS_R_UNSUPPORTED_PLATFORM);
 fips_selftest_fail = 1;
 ret = 0;
 goto end;
 }
 OPENSSL_ia32cap_P[0] |= (128);/* set shared cache   */
 OPENSSL_ia32cap_P[1] = ~(1(60-32));  /* clear AVX*/
 }
#endif

And BTW, building the FIPS-capble OpenSSL with the no-sse2 option as follows 
does not fix the issue:

./config fips --prefix=$FIPSDIR no-sse2 no-idea no-mdc2 no-rc5 shared

The problem is with the fipscanister itself.  It needs to be built with 
assembly language optimization disabled in order to get into FIPS mode under 
non-SSE2 processors.

So how to build a FIPS-capable OpenSSL with assembly language optimization 
enabled in the fipscanister that works under non-SSE2 capable processors?

Is that not possible?



I don't know, and I am a bit scared to hear this, as the programs I link 
with (non-FIPS) OpenSSL are intended to work on all x86 CPUs.


I though the basic OpenSSL code had runtime checks for SSE2 availability 
and would then use different code paths/implementation

subroutines accordingly.  It would be deeply ironic if the least
changeable OpenSSL binary (the fipscanister) lacked this basic test.


Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org