[squeak-dev] [ERROR}[5.3] building ByteArrays from HEX strings are now failing

Robert robert.withers at pm.me
Thu Mar 5 16:17:09 UTC 2020


Hey Nicolas! All tests are Green! 226% increase in speed!

In squeak 5.3 on linux64, with the plugins. Your fixes to DESPlugin resolved the only issue with them! I am so grateful for your help. I regenerated them, using 2719, and they are published here.

https://www.dropbox.com/sh/yhv253rwrhq0q5p/AAB7PKP2KPiGpDnIyule2h_Ia?dl=0

We would welcome any of such offerings from other platforms, published here as well.

---

The current Cryptography code for 5.3 is

Cryptography-v5.3-rww.118

http://www.squeaksource.com/@qKpleED0lBkWy2gu/bmQatj-3

---

The following are two parts of two profiles of running the Cryptography tests, with and without the plugins.

WITHOUT PLUGINS
 - 2375 tallies, 2414 msec.

**Leaves**
17.3% {418ms} ThirtyTwoBitRegister>>leftRotateBy:
13.4% {324ms} ThirtyTwoBitRegister>>bitXor:
12.2% {295ms} ThirtyTwoBitRegister>>+=
7.0% {169ms} [] SystemProgressMorph(Morph)>>updateDropShadowCache
5.2% {126ms} ThirtyTwoBitRegister>>bitAnd:
3.7% {88ms} CryptoElGamalTest(TestCase)>>timeout:after:
3.4% {81ms} ThirtyTwoBitRegister>>load:
3.3% {79ms} SmallInteger>>digitLength
2.3% {55ms} GrafPort>>copyBits
2.2% {53ms} ThirtyTwoBitRegister>>bitOr:
2.1% {52ms} ByteArray>>bitXor:
1.7% {42ms} DisplayScreen(Form)>>depth
1.7% {42ms} SHA1>>hashStream:
1.6% {39ms} GrafPort>>fillRoundRect:radius:
1.4% {35ms} SHA256NonPrimitive>>expandedBlock:
1.4% {35ms} ThirtyTwoBitRegister>>bitShift:
1.3% {33ms} ThirtyTwoBitRegister class>>new
1.2% {28ms} Point>>=

**Memory**
    old            +16,777,216 bytes
    young        -17,706,008 bytes
    used        -928,792 bytes
    free        +17,706,008 bytes

**GCs**
    full            0 totalling 0 ms (0% uptime)
    incr            227 totalling 44 ms (1.8% uptime), avg 0.2 ms
    tenures        315 (avg 0 GCs/tenure)
    root table    0 overflows

WITH PLUGINS
- 1056 tallies, 1073 msec.

**Leaves**
16.4% {176ms} [] SystemProgressMorph(Morph)>>updateDropShadowCache
7.4% {79ms} CryptoElGamalTest(TestCase)>>timeout:after:
6.2% {66ms} Point>>=
5.4% {58ms} ByteArray>>bitXor:
4.5% {48ms} DisplayScreen(Form)>>depth
3.9% {42ms} GrafPort>>fillRoundRect:radius:
3.8% {41ms} GrafPort(BitBlt)>>basicDisplayString:from:to:at:strikeFont:kern:
3.4% {37ms} SmallInteger(Number)>>isZero
3.4% {37ms} SHA1>>hashStream:
3.2% {35ms} GrafPort>>copyBits
2.6% {27ms} SHA1>>finalHash
2.5% {26ms} ThirtyTwoBitRegister>>byteAt:
2.4% {25ms} SmallInteger(Number)>>negative
2.2% {23ms} SystemProgressMorph(Morph)>>setProperty:toValue:
2.1% {22ms} SmallInteger>>digitLength
1.8% {19ms} SHA256WithPrimitive(SHA256)>>hashStream:
1.8% {19ms} OrderedCollection>>do:
1.6% {17ms} ThirtyTwoBitRegister>>bitXor:
1.5% {16ms} LargePositiveInteger(Integer)>>asByteArrayOfSize:

**Memory**
    old            +16,777,216 bytes
    young        -20,673,880 bytes
    used        -3,896,664 bytes
    free        +20,673,880 bytes

**GCs**
    full            0 totalling 0 ms (0% uptime)
    incr            53 totalling 12 ms (1.1% uptime), avg 0.2 ms
    tenures        0
    root table    0 overflows

In comparing the times, 2414 / 1073 = 226% increase in speed of running the profile. That's pretty fast! What are my #tinyBenchmarks?

tinyBenchmarks =  '2,500,000,000 bytecodes/sec; 180,000,000 sends/sec'.

Thanks for all the help. You all rock!

K, r

On 3/4/20 4:23 PM, Nicolas Cellier wrote:

> Hi Robert,
>
> If I save a Squeak5.3-19431-64bit.image with the Cryptography package preloaded,
> and put a simple test in a file test-crypto.st, for example:
>
> CryptoDESTest suite run.!
>
> Then the Simulator invocation should be something like (with my own path):
>
> | sis |
> sis := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur64BitMemoryManager).
> sis desiredNumStackPages: 8.
> sis assertValidExecutionPointersAtEachStep: false.
> sis openOn: '/Users/nicolas/Smalltalk/Squeak/trunk/Squeak5.3-19431-64bit.image'.
> sis systemAttributes
> at: 2 put: '/Users/nicolas/Smalltalk/Squeak/trunk/test-crypto.st'.
> sis openAsMorph; run
>
> Le mer. 4 mars 2020 à 20:26, Robert via Squeak-dev <squeak-dev at lists.squeakfoundation.org> a écrit :
>
>> Hi Eliot,
>>
>> Do I want too? Or am I obligated? Very well then, I am trying the StackVMSimulator. Should I debug down to a primitive call to a cryptoplugin? Or what should I do? I'll need to prep an image.
>>
>> I will need to get another Pi.
>>
>> kindly,
>> robert
>>
>> On 3/4/20 11:43 AM, Eliot Miranda wrote:
>>
>>> Hi Rob,
>>>
>>>> On Mar 4, 2020, at 7:57 AM, Robert via Squeak-dev [<squeak-dev at lists.squeakfoundation.org>](mailto:squeak-dev at lists.squeakfoundation.org) wrote:
>>>
>>>> 
>>>>
>>>> Are there instructions for building Bochs, Nicolas?
>>>
>>> If you want to work on the cryptography plugins then as Nicolas suggests you can use the StackInterpreterSimulator.  You don’t need to use the JIT to work on a plugin, and the StackInterpreterSimulator is probably twice as fast as the JIT simulator (CogVMSimulator) since it isn’t simulating machine code, only interpreting bytecode.
>>>
>>>> tyk, r
>>>>
>>>> On 3/4/20 10:50 AM, Robert wrote:
>>>>
>>>>> Hi yo hehr, Nicolas,
>>>>>
>>>>> I tried the first block, in the simulation window, but it was missing BochsIA64 or some. I then ran the third block, a StackVM as you suggested. I ran it against my Cryptography repair image, rabbit, and very slooowly reselected the tests and ran them, in proogrress...
>>>>>
>>>>> We sure would be appreciating etwas help, as if there was a little angel out there who offers plugin repair and SHA512 code/plugin. Praying for an angel!
>>>>>
>>>>> tyk, r
>>>>>
>>>>> On 3/4/20 8:50 AM, Nicolas Cellier wrote:
>>>>>
>>>>>> Hi Robert,
>>>>>> normally, most of VM/plugins development should take place with the VM-simulation from within the SpurVMMaker.image  (unless the plugin extensively call C functions from external libraries).
>>>>>> You will find a Worksapce with some simulation examples.
>>>>>> Then you might detect the error from within Smalltalk with debuggers etc...
>>>>>> I recommend simulating a Stack VM for a beginning (or you'll need to compile the Bochs plugin, which is currently difficult on linux...).
>>>>>>
>>>>>> Le mer. 4 mars 2020 à 14:40, Robert via Squeak-dev <squeak-dev at lists.squeakfoundation.org> a écrit :
>>>>>>
>>>>>>> Hi Levente,
>>>>>>>
>>>>>>> Yes, I see what you are saying. Without the Crypto plugins, all the Crypto tests run green.
>>>>>>>
>>>>>>> With the Crypto plugins, things get messed up. ByteArray class>>#fromHexString: still completes, but the KeyHolder>>#key SEG-FAULTS the vm (called from CryptoRC2Test>>#testARC2). Additionally, the following two tests fail: CryptoDESTest>>#testDESCBC and CryptoDESTest>>#testTripleDESCBC.
>>>>>>>
>>>>>>> The SEG-FAULT comes from this code:
>>>>>>>
>>>>>>> KeyHolder new
>>>>>>>     data: KeyHolderData new;
>>>>>>>     encryptKey: #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) asByteArray;
>>>>>>>     key
>>>>>>>
>>>>>>> tyk, r
>>>>>>>
>>>>>>> On 3/4/20 8:10 AM, Levente Uzonyi wrote:
>>>>>>>
>>>>>>>> Hi Robert,
>>>>>>>>
>>>>>>>> I just ran all test cases of Cryptography-v5.3-rww.118.mcz in a fresh 5.3
>>>>>>>> image on 64-bit linux using the stock VM (no Cryptography plugins), and
>>>>>>>> all the tests are green.
>>>>>>>> ByteArray class >> #fromHexString: and methods sent by it were last
>>>>>>>> modified in 2010, and they do not accept non-hexadecimal digits in the
>>>>>>>> input string.
>>>>>>>>
>>>>>>>> Levente
>>>>>>>>
>>>>>>>> On Wed, 4 Mar 2020, Robert via Squeak-dev wrote:
>>>>>>>>
>>>>>>>>> In squeak 5.3, building ByteArrays from HEX strings are now failing,
>>>>>>>>> after years of passing within the Cryptography tests.
>>>>>>>>>
>>>>>>>>> The first doIt works, while the other two are now failing in the
>>>>>>>>> #readHexFrom: method...
>>>>>>>>> PASSING
>>>>>>>>> ByteArray fromHexString: '06a9214036b8a15b512e03d534120006'
>>>>>>>>>
>>>>>>>>> FAILING
>>>>>>>>> ByteArray fromHexString: '16rc286696d887c9aa0611bbb3e2025a45a'
>>>>>>>>> ByteArray fromHexString: '00000000 00000000'
>>>>>>>>>
>>>>>>>>> This is causing multiple test failures in the Cryptography test suite.
>>>>>>>>>
>>>>>>>>> tyk, r
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200305/59f3e867/attachment.html>


More information about the Squeak-dev mailing list