[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructio
From: |
Ard Biesheuvel |
Subject: |
Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructions |
Date: |
Tue, 6 Feb 2018 18:57:55 +0000 |
On 6 February 2018 at 18:56, Ard Biesheuvel <address@hidden> wrote:
> On 6 February 2018 at 18:45, Peter Maydell <address@hidden> wrote:
>> On 22 January 2018 at 17:26, Ard Biesheuvel <address@hidden> wrote:
>>> This implements emulation of the new SHA-512 instructions that have
>>> been added as an optional extensions to the ARMv8 Crypto Extensions
>>> in ARM v8.2.
>>>
>>> Signed-off-by: Ard Biesheuvel <address@hidden>
>>
>>
>>> +void HELPER(crypto_sha512h)(void *vd, void *vn, void *vm)
>>> +{
>>> + uint64_t *rd = vd;
>>> + uint64_t *rn = vn;
>>> + uint64_t *rm = vm;
>>> +
>>> + rd[1] += S1_512(rm[1]) + cho512(rm[1], rn[0], rn[1]);
>>> + rd[0] += S1_512(rd[1] + rm[0]) + cho512(rd[1] + rm[0], rm[1], rn[0]);
>>
>> This gives the wrong answer if the destination register
>> happens to be the same as one of the inputs, because the
>> assignment to rd[1] will overwrite the input before the
>> calculation of rd[0] uses it.
>>
>
> It is supposed to use the new value of rd[1], so this is expected.
>
Ah hold on, I hit send too quickly, apologies.
Yes, if rd == rm, then it will assume the wrong value. I missed this
when doing the rewrite to use the new interface.
>> Some extra temporaries should fix this. I'll try fixing
>> that up locally and see if it passes tests then.
>>
>> thanks
>> -- PMM
- Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructions, Peter Maydell, 2018/02/06
- Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructions, Ard Biesheuvel, 2018/02/06
- Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructions,
Ard Biesheuvel <=
- Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructions, Peter Maydell, 2018/02/06
- Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructions, Peter Maydell, 2018/02/06
- Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructions, Peter Maydell, 2018/02/06
- Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructions, Ard Biesheuvel, 2018/02/06
- Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructions, Peter Maydell, 2018/02/06
- Re: [Qemu-devel] [PATCH v5 1/4] target/arm: implement SHA-512 instructions, Richard Henderson, 2018/02/07