Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Jeffrey Walton
On Mon, Mar 7, 2016 at 3:57 PM, Jeffrey Walton  wrote:
> On Sun, Mar 6, 2016 at 6:05 PM, Andy Polyakov  wrote:
 Hmm. So why do I see this on my macbook?

 $ arch
 i386
>>>
>>> Try "uname -m"
>>
>> This is not reliable. Because it must have changed recently, it used to
>> be i386 even on 64-bit systems. sysctl -n hw.optional.x86_64 is the way
>> to go, it's right there in ./config...
>
> ...
> However, there are two interesting ones on the PowerMac:
>
>   $ sysctl -A 2>/dev/null | grep hw | egrep 'machine|64'
>   hw.machine = Power Macintosh
>   hw.physmem = 2147483648
>   hw.l2settings = 2147483648
>   hw.optional.64bitops: 1
>   hw.cpu64bit_capable: 1

It looks like Apple is using either hw.optional.64bitops or
hw.optional.x86_64
(http://opensource.apple.com/source/xnu/xnu-1504.7.4/tools/tests/xnu_quick_test/misc.c?txt):

/*
 * Gets the bit'ed-ness of the current host. Returns either 32 or 64.
 * This get the hardware capability, but does not tell us whether this
 * binary is executing in 64 bit or 32 bit mode. Check sizeof long
 * or pointer to determine that.
 */
int get_bits()
{
  int  my_err, buf;
  size_t len = 0;
  int rval = 32;
  /*
   * On 32-bit systems the sysctls 64bitops and x86_64 don't
   * even exists, so if we don't find them then we assume
   * a 32-bit system.
   */

  /* Check for PPC 64 */
  if ((my_err = sysctlbyname("hw.optional.64bitops", NULL, , NULL,
0))) goto x86_64check; /* Request size */
  if (len > sizeof(buf)) goto x86_64check;
  if ((my_err = sysctlbyname("hw.optional.64bitops", , , NULL,
0))) goto x86_64check; /* Copy value out from kernel */
  if (buf == 1) rval = 64;
  goto finished;

x86_64check:
   /* Check for x86_64 */
  if ((my_err = sysctlbyname("hw.optional.x86_64", NULL, , NULL,
0))) goto finished; /* Request size */
  if (len > sizeof(buf)) goto finished;
  if ((my_err = sysctlbyname("hw.optional.x86_64", , , NULL,
0))) goto finished; /* Copy value out from kernel */
  if (buf == 1) rval = 64;

finished:
   return rval;
}
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Jeffrey Walton
On Sun, Mar 6, 2016 at 6:05 PM, Andy Polyakov  wrote:
>>> Hmm. So why do I see this on my macbook?
>>>
>>> $ arch
>>> i386
>>
>> Try "uname -m"
>
> This is not reliable. Because it must have changed recently, it used to
> be i386 even on 64-bit systems. sysctl -n hw.optional.x86_64 is the way
> to go, it's right there in ./config...

Throwing an OS X 10.5/PowerMac into the mix. Its a 64-bit PowerPC:

  $ machine
  ppc970

  $ sysctl -n hw.optional.x86_64
  second level name optional in hw.optional.x86_64 is invalid

  $ uname -m
  Power Macintosh

However, there are two interesting ones on the PowerMac:

  $ sysctl -A 2>/dev/null | grep hw | egrep 'machine|64'
  hw.machine = Power Macintosh
  hw.physmem = 2147483648
  hw.l2settings = 2147483648
  hw.optional.64bitops: 1
  hw.cpu64bit_capable: 1

And on a modern Intel with a Core-i7:

  $ sysctl -A 2>/dev/null | grep hw | egrep 'machine|64'
  hw.machine = x86_64
  hw.physmem = 2147483648
  hw.cachelinesize = 64
  hw.cpu64bit_capable: 1
  hw.cachelinesize: 64
  hw.optional.x86_64: 1
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Blumenthal, Uri - 0553 - MITLL
>>>And I get i486 (sic!) on proven to be 64-bit Mac.
>> 
>> Yes another proof that we cannot rely on “arch” on the newer Mac OS X
>> boxes.
>
>I meant that I get i486 from 'machine’! I.e. what I tried to say all
>along is that one can't trust 'arch' *nor* 'machine' or 'uname -m' to
>identify 64-bit Darwin. Well, if you want something that works even with
>older versions.

OK, your point is taken. But what does tell 64-bit from 32-bit? And how
badly do we need to know for sure?


We were talking about what the *default* should be, not about how to
determine 64-bit from 32-bit beyond any reasonable doubt (I think).

I’d conjecture that the older versions are becoming less and less relevant
as the time goes. So *now* we can (and should) safely set the default to
x86_64 for Darwin, and those still on 32-bit architecture can run
“./Configure whatever”.


smime.p7s
Description: S/MIME cryptographic signature
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Andy Polyakov
>>> Try 
>>> $ machine
>>>
>>> Apparently "arch" is not only old (the latest release was in July
>>> 2010), but it does not differentiate between Intel-32 and Intel-64.
>>>
>>> On my own Mac (proven to be 64-bit :) arch returns "i386", machine
>>> returns "x86_64h".
>>
>> And I get i486 (sic!) on proven to be 64-bit Mac.
> 
> Yes another proof that we cannot rely on “arch” on the newer Mac OS X
> boxes.

I meant that I get i486 from 'machine'! I.e. what I tried to say all
along is that one can't trust 'arch' *nor* 'machine' or 'uname -m' to
identify 64-bit Darwin. Well, if you want something that works even with
older versions.

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Blumenthal, Uri - 0553 - MITLL
On 3/7/16, 11:05 , "openssl-dev on behalf of Andy Polyakov"
 wrote:

>> Try 
>> $ machine
>> 
>> Apparently "arch" is not only old (the latest release was in July
>>2010), but it does not differentiate between Intel-32 and Intel-64.
>> 
>> On my own Mac (proven to be 64-bit :) arch returns "i386", machine
>>returns "x86_64h".
>
>And I get i486 (sic!) on proven to be 64-bit Mac.

Yes another proof that we cannot rely on “arch” on the newer Mac OS X
boxes.

>As already mentioned,
>these things has changed recently (all right, at some point), and for
>this reason something that worked earlier and keeps working in the same
>way should be preferable. Or at least one should account for the fact
>that things has changed.

I agree. But don’t know how to accomplish that.

>What's h after x86_64h anyway?

Sorry, I don’t have the slightest idea. :-(


smime.p7s
Description: S/MIME cryptographic signature
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Andy Polyakov
> Try 
> $ machine
> 
> Apparently "arch" is not only old (the latest release was in July 2010), but 
> it does not differentiate between Intel-32 and Intel-64. 
> 
> On my own Mac (proven to be 64-bit :) arch returns "i386", machine returns 
> "x86_64h".

And I get i486 (sic!) on proven to be 64-bit Mac. As already mentioned,
these things has changed recently (all right, at some point), and for
this reason something that worked earlier and keeps working in the same
way should be preferable. Or at least one should account for the fact
that things has changed.

What's h after x86_64h anyway?

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Blumenthal, Uri - 0553 - MITLL
Try 
$ machine

Apparently "arch" is not only old (the latest release was in July 2010), but it 
does not differentiate between Intel-32 and Intel-64. 

On my own Mac (proven to be 64-bit :) arch returns "i386", machine returns 
"x86_64h".

Oh, and do hook up BB-10 to LTE - an absolute must for running 64-bit stuff on 
Macs. :-) :) :)

Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network.
  Original Message  
From: Ben Laurie
Sent: Monday, March 7, 2016 04:22
To: OpenSSL development
Reply To: openssl-dev@openssl.org
Subject: Re: [openssl-dev] MacOS defaults?

On 6 March 2016 at 22:40, Viktor Dukhovni <openssl-us...@dukhovni.org> wrote:
>
>> On Mar 6, 2016, at 12:00 PM, Ben Laurie <b...@links.org> wrote:
>>
>> Hmm. So why do I see this on my macbook?
>>
>> $ arch
>> i386
>
> Try "uname -m"

x86_64

But AIUI, uname -m tells me what hardware I've got, arch tells me what
mode it is running in...
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev



smime.p7s
Description: S/MIME cryptographic signature
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Thomas Francis, Jr.
> On Mar 7, 2016, at 5:01 AM, Ben Laurie  wrote:
> 
> On 7 March 2016 at 09:59, Andy Polyakov  wrote:
>> Hmm. So why do I see this on my macbook?
>> 
>> $ arch
>> i386
> 
> Try "uname -m"
 
 This is not reliable. Because it must have changed recently, it used to
 be i386 even on 64-bit systems. sysctl -n hw.optional.x86_64 is the way
 to go, it's right there in ./config...
>>> 
>>> Sure, and that is used to decide whether to offer the 64 bit version.
>>> But its not helping me on what should be default.
>> 
>> I thought suggestion was to default to 64 bit whenever it is an option.
>> And uname -m *was* returning i386 even on system capable of executing
>> 64-bit code. So that sysctl is something that works in *either* situation.
> 
> The question is: which is better? I've been told there's no advantage
> to 64 bit on MacOS unless you need the extra address space - if that's
> so, then we should default to 32 bit, I think.

As with all x86-64 systems, compiling for 64-bit will enable the compiler to 
use many more registers, generally resulting in faster code.  The same is _not_ 
true of 64-bit PPC, where the advice you list above is (almost) accurate.  
Don’t compile for 64-bit PPC unless you need the extra address space, or you 
need instructions that are only available for the 64-bit processor.  I suspect 
the advice you heard was geared toward Mac OS on PPC, not x86.

I haven’t checked out everything in OpenSSL, but I can say that several 
programs I’ve written which use OpenSSL for SHA-2, SHA-1, MD5, AES, and 3DES 
run the crypto routines _much_ faster when compiled as 64-bit than as 32-bit 
(that was not isolating OpenSSL’s libcrypto, but isolating the code that 
invoked those routines).  The overall application performance was also greatly 
improved.  Memory usage was slightly higher, since pointers are larger, of 
course.  And that held true for Mac OS X (10.6 and later), Windows (2003 Server 
- 2012 Server and 7 and later), Linux (don’t remember which kernels), and 
FreeBSD (8.0 and later).  I expect it’ll continue to hold true, so I don’t 
expect to keep testing it.


> -- 
> openssl-dev mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
> 

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Ben Laurie
On 7 March 2016 at 09:59, Andy Polyakov  wrote:
> Hmm. So why do I see this on my macbook?
>
> $ arch
> i386

 Try "uname -m"
>>>
>>> This is not reliable. Because it must have changed recently, it used to
>>> be i386 even on 64-bit systems. sysctl -n hw.optional.x86_64 is the way
>>> to go, it's right there in ./config...
>>
>> Sure, and that is used to decide whether to offer the 64 bit version.
>> But its not helping me on what should be default.
>
> I thought suggestion was to default to 64 bit whenever it is an option.
> And uname -m *was* returning i386 even on system capable of executing
> 64-bit code. So that sysctl is something that works in *either* situation.

The question is: which is better? I've been told there's no advantage
to 64 bit on MacOS unless you need the extra address space - if that's
so, then we should default to 32 bit, I think.
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Andy Polyakov
 Hmm. So why do I see this on my macbook?

 $ arch
 i386
>>>
>>> Try "uname -m"
>>
>> This is not reliable. Because it must have changed recently, it used to
>> be i386 even on 64-bit systems. sysctl -n hw.optional.x86_64 is the way
>> to go, it's right there in ./config...
> 
> Sure, and that is used to decide whether to offer the 64 bit version.
> But its not helping me on what should be default.

I thought suggestion was to default to 64 bit whenever it is an option.
And uname -m *was* returning i386 even on system capable of executing
64-bit code. So that sysctl is something that works in *either* situation.

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Ben Laurie
On 6 March 2016 at 23:05, Andy Polyakov  wrote:
>>> Hmm. So why do I see this on my macbook?
>>>
>>> $ arch
>>> i386
>>
>> Try "uname -m"
>
> This is not reliable. Because it must have changed recently, it used to
> be i386 even on 64-bit systems. sysctl -n hw.optional.x86_64 is the way
> to go, it's right there in ./config...

Sure, and that is used to decide whether to offer the 64 bit version.
But its not helping me on what should be default.
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-07 Thread Ben Laurie
On 6 March 2016 at 22:40, Viktor Dukhovni  wrote:
>
>> On Mar 6, 2016, at 12:00 PM, Ben Laurie  wrote:
>>
>> Hmm. So why do I see this on my macbook?
>>
>> $ arch
>> i386
>
> Try "uname -m"

x86_64

But AIUI, uname -m tells me what hardware I've got, arch tells me what
mode it is running in...
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-06 Thread Andy Polyakov
>> Hmm. So why do I see this on my macbook?
>>
>> $ arch
>> i386
> 
> Try "uname -m"

This is not reliable. Because it must have changed recently, it used to
be i386 even on 64-bit systems. sysctl -n hw.optional.x86_64 is the way
to go, it's right there in ./config...

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-06 Thread Viktor Dukhovni

> On Mar 6, 2016, at 12:00 PM, Ben Laurie  wrote:
> 
> Hmm. So why do I see this on my macbook?
> 
> $ arch
> i386

Try "uname -m"

-- 
Viktor.

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-06 Thread Andy Polyakov
> Hmm. So why do I see this on my macbook?
> 
> $ arch
> i386

I suppose you have to hook up BlackBerry 10 with Verizon LTE plan? :-)
:-) :-)


-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-06 Thread Ben Laurie
Hmm. So why do I see this on my macbook?

$ arch
i386

On 6 March 2016 at 15:27, Blumenthal, Uri - 0553 - MITLL 
wrote:

> Yes I think it's way past time to make this change. 64-bit has been the
> norm for ages.
>
>
> Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network.
> *From: *Ben Laurie
> *Sent: *Sunday, March 6, 2016 06:21
> *To: *OpenSSL development
> *Reply To: *openssl-dev@openssl.org
> *Subject: *[openssl-dev] MacOS defaults?
>
> Currently OpenSSL defaults to 32 bit in MacOS. I'm told it might be better
> to default to 64 bit these days.
>
> Does anyone have any views?
>
>
>
> --
> openssl-dev mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
>
>
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-06 Thread Viktor Dukhovni

> On Mar 6, 2016, at 6:20 AM, Ben Laurie  wrote:
> 
> Currently OpenSSL defaults to 32 bit in MacOS. I'm told it might be better to 
> default to 64 bit these days.
> 
> Does anyone have any views?

I support a switch to a 64bit default.

-- 
Viktor.

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


Re: [openssl-dev] MacOS defaults?

2016-03-06 Thread Blumenthal, Uri - 0553 - MITLL
Yes I think it's way past time to make this change. 64-bit has been the norm 
for ages.

Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network.
From: Ben Laurie
Sent: Sunday, March 6, 2016 06:21
To: OpenSSL development
Reply To: openssl-dev@openssl.org
Subject: [openssl-dev] MacOS defaults?

Currently OpenSSL defaults to 32 bit in MacOS. I'm told it might be better to 
default to 64 bit these days.

Does anyone have any views?




smime.p7s
Description: S/MIME cryptographic signature
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev