Re: [cryptopp-users] Flipped bit in chacha encrypted file, avx vs sse

2021-09-17 Thread Jeffrey Walton


On Friday, September 17, 2021 at 8:25:00 PM UTC-4 Jeffrey Walton wrote:

> On Thu, Sep 16, 2021 at 8:42 PM austin clifton  
> wrote: 
> > 
> > I have an issue which I believe may be a bug. I followed the 
> instructions from the "Bug Report" page on the cryptopp wiki and all tests 
> in cryptest.exe are passing, so figured I should post here first and make 
> sure it isn't a build related issue. 
>
> We're tracking this issue at 
> https://github.com/weidai11/cryptopp/issues/1069.
>

We disabled the AVX2 implementation at 
https://github.com/weidai11/cryptopp/commit/f0a32f0c6a51.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/163a502d-c641-49a8-8f5a-1441a891d74fn%40googlegroups.com.


Re: [cryptopp-users] Re: Retrieving public key from x and y

2021-09-17 Thread Jeffrey Walton


On Friday, September 17, 2021 at 11:26:25 AM UTC-4 skullm...@gmail.com 
wrote:

> ... The final goal is to build a JWT and sign it with the public key, 
> constructed out of x and y. If I can find a way to use the public key 
> directly, that may be a workaround of that problem - in the end I don't 
> want a temporary file output anyway. It only grinds my gears that it works 
> when compiled on "not-my-machine"-devices. 
>

For JWT, see https://www.cryptopp.com/wiki/JSON_Web_Encryption . It should 
supply most of the pieces you need for the tokens.

If the JWE article has gaps that are needed for JWT, we can write an 
article specifically for JWT.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/62b26e8e-c133-43dc-9394-9b6c55bf9349n%40googlegroups.com.


Re: [cryptopp-users] Flipped bit in chacha encrypted file, avx vs sse

2021-09-17 Thread austin clifton
Great, thanks for the update. I'll follow the conversation over there.

On Friday, September 17, 2021 at 5:42:17 PM UTC-7 Jeffrey Walton wrote:

> On Friday, September 17, 2021 at 8:25:00 PM UTC-4 Jeffrey Walton wrote:
>
>> On Thu, Sep 16, 2021 at 8:42 PM austin clifton  
>> wrote: 
>> > 
>> > I have an issue which I believe may be a bug. I followed the 
>> instructions from the "Bug Report" page on the cryptopp wiki and all tests 
>> in cryptest.exe are passing, so figured I should post here first and make 
>> sure it isn't a build related issue. 
>>
>> We're tracking this issue at 
>> https://github.com/weidai11/cryptopp/issues/1069.
>>
>
> We disabled the AVX2 implementation at 
> https://github.com/weidai11/cryptopp/commit/f0a32f0c6a51.
>
> Jeff
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/fac31d30-5d7d-4576-94c2-9a45f6190ae9n%40googlegroups.com.


Re: [cryptopp-users] Re: Retrieving public key from x and y

2021-09-17 Thread Benjamin Schäfer
Correction: I have to encrypt the JWT, not sign it. Signing is with the 
private key - which I don't have. I will take a look at the article and the 
linking. Maybe that will bring some hints for me. Thanks again :)

Jeffrey Walton schrieb am Samstag, 18. September 2021 um 05:11:31 UTC+2:

> On Friday, September 17, 2021 at 11:26:25 AM UTC-4 skullm...@gmail.com 
> wrote:
>
>> ... The final goal is to build a JWT and sign it with the public key, 
>> constructed out of x and y. If I can find a way to use the public key 
>> directly, that may be a workaround of that problem - in the end I don't 
>> want a temporary file output anyway. It only grinds my gears that it works 
>> when compiled on "not-my-machine"-devices. 
>>
>
> For JWT, see https://www.cryptopp.com/wiki/JSON_Web_Encryption . It 
> should supply most of the pieces you need for the tokens.
>
> If the JWE article has gaps that are needed for JWT, we can write an 
> article specifically for JWT.
>
> Jeff
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/8592faec-1ab3-4097-b219-dffd84efae9en%40googlegroups.com.


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-17 Thread Samyukta Yagati
Thanks for your help! Resolved, the issue was in my Makefile flags.

On Friday, September 17, 2021 at 3:11:53 PM UTC-7 Mouse wrote:

> Sorry, I've no idea what your makefile looks like, or how to convey the 
> working flags to it. 
>
> On Sep 17, 2021, at 16:39, Samyukta Yagati  wrote:
>
> (I currently have -l:libcryptopp.a in my LDFLAGS)
>
>
>
> On Friday, September 17, 2021 at 1:38:31 PM UTC-7 Samyukta Yagati wrote:
>
>> Ah I see -- I'm using make with a custom makefile to build the source 
>> files in my project, is there a way to translate this to flags in the 
>> makefile?
>>
>> On Thursday, September 16, 2021 at 6:31:25 PM UTC-7 Mouse wrote:
>>
>>> Say, you have a file that includes Crypto++ headers and needs linking 
>>> with Crypto++ library. And Crypto++ is installed into /usr/local. 
>>>
>>> Then, the following would be sufficient: 
>>>
>>> clang++ -o my_binary -I/usr/local/include my_source.cpp -L 
>>> /usr/local/lib -lcryptopp -lm 
>>>
>>> (I'm not sure if "-lm" is still necessary) 
>>>
>>>
>>> > On Sep 16, 2021, at 19:28, Samyukta Yagati  
>>> wrote: 
>>> > 
>>>
>> -- 
> You received this message because you are subscribed to the Google Groups 
> "Crypto++ Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cryptopp-user...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/cryptopp-users/436b6393-8bb5-4b5e-b50c-1bb71da7aa24n%40googlegroups.com
>  
> 
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/47a1a5be-9275-4bd2-b669-7d6bb4de22afn%40googlegroups.com.


Re: [cryptopp-users] Flipped bit in chacha encrypted file, avx vs sse

2021-09-17 Thread Jeffrey Walton
On Fri, Sep 17, 2021 at 2:31 PM austin clifton  wrote:
>
> Hey Jeff, thanks for the fast response!
>
> Yes, the encrypted sha from your AMD CPUs matches what I get on my Ryzen 7 
> 3700X.
>
> The encrypted sha from the i7 is 
> 8F16077454F8477594CAD4304126B0A6F30C8C4D2536E2441FFFD320656E1DF1. That's also 
> the sha I get if I disable AVX on my Ryzen when compiling cryptopp.
>
> I'm not sure which sha is "correct" but we are seeing the same behavior 
> across the AMD CPUs. Would it make sense to disable assembly altogether to 
> get a reference encrypted sha256?

Yes, that is what I usually do when I need a reference. I add
-DCRYPTOPP_DISABLE_ASM to CXXFLAGS. That removes all inline assembly
and intrinsics.

In the case of ChaCha there is another option for a reference. You can
use Bernstein's reference implementation. I use the author's
implementation for test vectors, when available. I keep them stashed
away at https://github.com/noloader/cryptopp-test.

Note that Bernstein's ChaCah and the IETF's ChaCha are slightly
different. Bernstein uses a 64-bit counter that starts at 0 and cannot
wrap. IETF uses a 32-bit counter that can wrap. The IETF never
specified what to do when wrap occurs.

> We are seeing the same behavior from MSVC and GCC compilers. I can try master 
> with GCC here too but sounds like that fix is unrelated?

Yeah, I think that is an issue with the CPU, not the compiler.

> I'll try to glean more useful data from logs I have here. We distribute 
> encrypted assets to lots of machines (all running Windows) but I have to dig 
> around some.

The guy to ask is Agner Fog, https://www.agner.org. I'm not sure
whether he runs a mailing list.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8%3DH%2BXwUP6XUyaVRGC%3DSC91PfBDwPncC33YvoySihUsXzQ%40mail.gmail.com.


Re: [cryptopp-users] Flipped bit in chacha encrypted file, avx vs sse

2021-09-17 Thread Jeffrey Walton
On Thu, Sep 16, 2021 at 8:42 PM austin clifton  wrote:
>
> I have an issue which I believe may be a bug. I followed the instructions 
> from the "Bug Report" page on the cryptopp wiki and all tests in cryptest.exe 
> are passing, so figured I should post here first and make sure it isn't a 
> build related issue.

We're tracking this issue at https://github.com/weidai11/cryptopp/issues/1069.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8%3D_k4ZHt1E0Gj8d_D2-Kf3PU9AB5VXhUmRa1HJLXdsiHQ%40mail.gmail.com.


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-17 Thread Uri Blumenthal
Sorry, I've no idea what your makefile looks like, or how to convey the working 
flags to it. 

> On Sep 17, 2021, at 16:39, Samyukta Yagati  wrote:
> 
> (I currently have -l:libcryptopp.a in my LDFLAGS)
> 
>> On Friday, September 17, 2021 at 1:38:31 PM UTC-7 Samyukta Yagati wrote:
>> Ah I see -- I'm using make with a custom makefile to build the source files 
>> in my project, is there a way to translate this to flags in the makefile?
>> 
>>> On Thursday, September 16, 2021 at 6:31:25 PM UTC-7 Mouse wrote:
>>> Say, you have a file that includes Crypto++ headers and needs linking with 
>>> Crypto++ library. And Crypto++ is installed into /usr/local. 
>>> 
>>> Then, the following would be sufficient: 
>>> 
>>> clang++ -o my_binary -I/usr/local/include my_source.cpp -L /usr/local/lib 
>>> -lcryptopp -lm 
>>> 
>>> (I'm not sure if "-lm" is still necessary) 
>>> 
>>> 
>>> > On Sep 16, 2021, at 19:28, Samyukta Yagati  wrote: 
>>> > 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Crypto++ Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cryptopp-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/cryptopp-users/436b6393-8bb5-4b5e-b50c-1bb71da7aa24n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/15C7DC99-680F-49DA-891A-5D60B9B904C2%40gmail.com.


smime.p7s
Description: S/MIME cryptographic signature


Re: [cryptopp-users] Re: Retrieving public key from x and y

2021-09-17 Thread Jeffrey Walton
On Fri, Sep 17, 2021 at 4:32 AM Benjamin Schäfer  wrote:
>
> Could you provide me your .exe to test it on my machine? I still don't get it 
> and will try it on a fresh and clean machine also.

Sure. https://www.cryptopp.com/test_pem.exe.zip

I don't recall if that was built with VS2017 or VS2019. You may need a
specific version of the Visual C++ runtime. They are distributed by
Microsoft. I think you can get them here:
https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
.

Here are the two versions on my Windows machine:

VS2017:
**
** Visual Studio 2017 Developer Command Prompt v15.0
** Copyright (c) 2017 Microsoft Corporation
**
C:\Users\Jeff>cl.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27043 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

VS2019:
**
** Visual Studio 2019 Developer Command Prompt v16.9.5
** Copyright (c) 2021 Microsoft Corporation
**
C:\Users\Jeff>cl.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29915 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8kQzaskPXmsVF70eHPEYmthmSbd2L-Tc1wT%3DUhMVtbVsg%40mail.gmail.com.


Re: [cryptopp-users] Re: Retrieving public key from x and y

2021-09-17 Thread Benjamin Schäfer
Your exe works perfectly on my machine. I only have VS2019 on my machine 
here, it says:

**
** Visual Studio 2019 Developer Command Prompt v16.10.1
** Copyright (c) 2021 Microsoft Corporation
**

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional>cl
Microsoft (R) C/C++-Optimierungscompiler Version 19.29.30037 für x86
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

The only thing, I can see here, is that your cl.exe on VS2017 says, it's 64 
bit. I will investigate that too.

Jeffrey Walton schrieb am Freitag, 17. September 2021 um 10:58:29 UTC+2:

> On Fri, Sep 17, 2021 at 4:32 AM Benjamin Schäfer  
> wrote:
> >
> > Could you provide me your .exe to test it on my machine? I still don't 
> get it and will try it on a fresh and clean machine also.
>
> Sure. https://www.cryptopp.com/test_pem.exe.zip
>
> I don't recall if that was built with VS2017 or VS2019. You may need a
> specific version of the Visual C++ runtime. They are distributed by
> Microsoft. I think you can get them here:
>
> https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
> .
>
> Here are the two versions on my Windows machine:
>
> VS2017:
> **
> ** Visual Studio 2017 Developer Command Prompt v15.0
> ** Copyright (c) 2017 Microsoft Corporation
> **
> C:\Users\Jeff>cl.exe
> Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27043 for x64
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> VS2019:
> **
> ** Visual Studio 2019 Developer Command Prompt v16.9.5
> ** Copyright (c) 2021 Microsoft Corporation
> **
> C:\Users\Jeff>cl.exe
> Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29915 for x86
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> Jeff
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/698dafdb-df8e-41c9-a20e-90c8428904d0n%40googlegroups.com.


Re: [cryptopp-users] Re: Retrieving public key from x and y

2021-09-17 Thread Jeffrey Walton
On Fri, Sep 17, 2021 at 6:06 AM Jeffrey Walton  wrote:
>
> ...
> I've got a Windows 10 VM somewhere. Let me see if I can get closer to 
> v16.10.1.

I just tried with my Windows 10 VM. It was OK there, too.

Do you know how to do something like SSH access on Windows? I'll give
you an account on my machine. You can look around and see what is
different about it.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8kwJvQL6NoFs8GihVLnNix4WNY3%2BgvBH8z3-P3r66-_GQ%40mail.gmail.com.


Re: [cryptopp-users] Re: Retrieving public key from x and y

2021-09-17 Thread Jeffrey Walton
On Fri, Sep 17, 2021 at 5:11 AM Benjamin Schäfer  wrote:
>
> Your exe works perfectly on my machine.

I don't know if that's good or bad...

> I only have VS2019 on my machine here, it says:
>
> **
> ** Visual Studio 2019 Developer Command Prompt v16.10.1
> ** Copyright (c) 2021 Microsoft Corporation
> **
>
> C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional>cl
> Microsoft (R) C/C++-Optimierungscompiler Version 19.29.30037 für x86
> Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
>
> The only thing, I can see here, is that your cl.exe on VS2017 says, it's 64 
> bit. I will investigate that too.

OK, so I run Windows 8.1 Professional.

Regarding v16.9.5 (mine) vs v16.10.1 (yours), I've installed the
Windows SDKs and update them periodically. So I have a few SDKs
available. I think the Developer Command Prompts use the latest. So it
looks like I am behind you a bit.

I've got a Windows 10 VM somewhere. Let me see if I can get closer to v16.10.1.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8%3DotFOd%2BZTiuLaH0Oa9C-noP5kZ9A02N9pzS8s0%2BURKbQ%40mail.gmail.com.


Re: [cryptopp-users] Flipped bit in chacha encrypted file, avx vs sse

2021-09-17 Thread Jeffrey Walton
On Thu, Sep 16, 2021 at 8:42 PM austin clifton  wrote:
>
> I have an issue which I believe may be a bug. I followed the instructions 
> from the "Bug Report" page on the cryptopp wiki and all tests in cryptest.exe 
> are passing, so figured I should post here first and make sure it isn't a 
> build related issue.
>
> I built cryptopp 8.5.0 as a static library, x64 multi-threaded debug (\MTd) 
> using Visual Studio 2019 v16.10.0, on Windows 10 Pro v10.0.19043, using the 
> .sln file provided with the cryptopp source code.
>
> I used two different machines for this test. One is the machine I built the 
> cryptopp library with. Both are running the same version of Windows 10. One 
> machine has a Ryzen 3700X, the other has an i7-990X. The Ryzen supports AVX, 
> the i7 does not.
>
> I am VERY rarely finding that files encrypted with the chacha cipher by these 
> two machines have differing sha256 hashes. If I do a hex diff against the 
> files, there is a single flipped bit at 0x1EBB4 (0xD8 vs 0xD9).
>
> I am able to reproduce this consistently with a specific key, nonce, and 
> input file, after test encrypting ~50GB of 1MB garbage files on each machine.
>
> If I disable AVX when building cryptlib by defining CRYPTOPP_DISABLE_AVX and 
> CRYPTOPP_DISABLE_AVX2, the machine with the Ryzen will encrypt the file the 
> same as the i7.
>
> Source code for a minimal reproducible example is here:
> https://github.com/austin-clifton/cryptopp-chacha-asm-test/blob/main/src/main.cpp#L208
>
> That repository includes a ready-to-build test case with Visual Studio, minus 
> a built cryptlib.lib which should be added to libs/debug/ before building.

Austin,

I fetched main.cpp and run_459_file_76.bin from your GitHub. I
compiled the library with:

 CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++17" make

I compiled/linked main.cpp with:

g++ -DNDEBUG -g2 -O3 -fPIC -pthread -std=c++17 -I. main.cxx
./libcryptopp.a -o main.exe

Running the program on a AMD Ryzen 3 3200U and AMD A6-9220e, this is the result.

$ ./main.exe
sha256: 0FC0FADCDF82770086C9DA8513A16FC785620D7B1C187CDD828E433EB0979847
encsha: 6FBEE484EE64A2AB02235DDF29CA0B61EE3B811D227C2729836D3BD6161C9B18

Is this correct?

I have one Windows machine for testing. It is a Core i5. Sorry I don't
have a good test environment.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8k5HNWTq7%2BOx6d27gNh5YwKyi0kxxwDAvMf6QczPcsqhQ%40mail.gmail.com.


Re: [cryptopp-users] Re: Retrieving public key from x and y

2021-09-17 Thread Benjamin Schäfer
Could you provide me your .exe to test it on my machine? I still don't get 
it and will try it on a fresh and clean machine also. 

Benjamin Schäfer schrieb am Donnerstag, 16. September 2021 um 17:50:42 
UTC+2:

> Well, I tested it on another machine at home, but the result remains the 
> same :(
>
> Benjamin Schäfer schrieb am Donnerstag, 16. September 2021 um 13:37:01 
> UTC+2:
>
>> I've put a 7z archive with all file I've used into the repository. On the 
>> CTL I switched the working directory to the extracted one. Then I ran the 
>> following commands:
>>
>> nmake /f cryptest.nmake 
>>
>> cl.exe /nologo /W4 /wd4231 /wd4511 /wd4156 /D_MBCS /Zi /TP /GR /EHsc 
>> /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /FI sdkddkver.h /FI winapifamily.h /c 
>> test_Pem.cpp /out:test_pem.obj 
>>
>> link.exe /nologo /SUBSYSTEM:CONSOLE /DEBUG /DEBUG /OPT:REF /MACHINE:X86 
>> test_pem.obj cryptlib.lib kernel32.lib /out:test_pem.exe 
>>
>> After executing test_pem.exe, a .pem file appears with the known result. 
>>
>> I will try the same again when I'm at home on a different machine, just 
>> to be sure, nothing is screwed up on my working machine.
>> Benjamin Schäfer schrieb am Donnerstag, 16. September 2021 um 12:02:37 
>> UTC+2:
>>
>>> I just don't get it. Somehow I can't force the platform toolkit to be 
>>> used. It remains at 140, when I compile with cl.exe. Going to the UI of 
>>> VS2019, building the library with toolset 142 and cryptolib with 142 
>>> produces those results. When I open the CTL of VS2019 and run the cl.exe 
>>> command, I get vc140.pdb as output. This drives me crazy - being one step 
>>> away from the goal and can't figure out what's wrong.
>>> Jeffrey Walton schrieb am Donnerstag, 16. September 2021 um 11:10:36 
>>> UTC+2:
>>>
 On Thu, Sep 16, 2021 at 4:37 AM Benjamin Schäfer  
 wrote: 
 > 
 > First of all: Thank you for your help and your patience! I really 
 appreciate that. 
 > 
 > I've made the same steps with nmake and built the library. Then I did 
 the same steps with my source file you mentioned, everything on the CTL 
 that came with VS2019 (should make no difference). 
 > 
 > I uploaded the files here: 
 > https://github.com/bredator/cryptopptest 
 > 
 > Everything took place in the same directory where the cryptopp .h and 
 .cpp files are located - so I didn't upload them again, because I took 
 them 
 out of the box. Also I added my .pem file, that came out as I reproduced 
 all the steps. 

 You said you are using Visual Studio 2019, but you have a PDB file 
 vc140.pdb. That is Visual Studio 2015. See 

 https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering.
  


 You cannot mix versions of Visual Studio. Everything needs to be built 
 using Visual Studio 2015 or Visual Studio 2019. 

 Jeff 

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/a7256eb1-0bae-48b3-9dc2-012a6ebda33bn%40googlegroups.com.


Re: [cryptopp-users] Re: Retrieving public key from x and y

2021-09-17 Thread Benjamin Schäfer
This is somehow ridiculus. I just set up a brand new VM with Win10, new 
version. Also installed VS2019 Community. Nothing else, ran the upper 
commands on the content of the 7zip archive and I still get the same 
result. This can't be something with Intel vs. AMD, could it? 

Your offer is fantastic, but I'm not that good in SSH access and besides an 
dxdiag-output, I won't even know what to look for :( 

At the moment I ran out of ideas. I will sleep about that till monday, 
maybe there comes a idea around the corner. Maybe I did not need the pem as 
a file. The final goal is to build a JWT and sign it with the public key, 
constructed out of x and y. If I can find a way to use the public key 
directly, that may be a workaround of that problem - in the end I don't 
want a temporary file output anyway. It only grinds my gears that it works 
when compiled on "not-my-machine"-devices. 

First I will try that sleep-thing, it helped me a lot in the past. Again, 
thank you very much for your help! That helped me that much, that my code 
itselt can't be that wrong, it stucks somewhere else. 

Jeffrey Walton schrieb am Freitag, 17. September 2021 um 13:30:34 UTC+2:

> On Fri, Sep 17, 2021 at 6:06 AM Jeffrey Walton  wrote:
> >
> > ...
> > I've got a Windows 10 VM somewhere. Let me see if I can get closer to 
> v16.10.1.
>
> I just tried with my Windows 10 VM. It was OK there, too.
>
> Do you know how to do something like SSH access on Windows? I'll give
> you an account on my machine. You can look around and see what is
> different about it.
>
> Jeff
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/a09e8145-d786-47d7-8be3-ea6c01517dcan%40googlegroups.com.


Re: [cryptopp-users] Flipped bit in chacha encrypted file, avx vs sse

2021-09-17 Thread austin clifton
Hey Jeff, thanks for the fast response!

Yes, the encrypted sha from your AMD CPUs matches what I get on my Ryzen 7 
3700X.

The encrypted sha from the i7 is 
8F16077454F8477594CAD4304126B0A6F30C8C4D2536E2441FFFD320656E1DF1. That's 
also the sha I get if I disable AVX on my Ryzen when compiling cryptopp.

I'm not sure which sha is "correct" but we are seeing the same behavior 
across the AMD CPUs. Would it make sense to disable assembly altogether to 
get a reference encrypted sha256?

We are seeing the same behavior from MSVC and GCC compilers. I can try 
master with GCC here too but sounds like that fix is unrelated?

I'll try to glean more useful data from logs I have here. We distribute 
encrypted assets to lots of machines (all running Windows) but I have to 
dig around some.

On Friday, September 17, 2021 at 12:23:55 AM UTC-7 Jeffrey Walton wrote:

> On Thu, Sep 16, 2021 at 8:42 PM austin clifton  
> wrote:
> >
> > I have an issue which I believe may be a bug. I followed the 
> instructions from the "Bug Report" page on the cryptopp wiki and all tests 
> in cryptest.exe are passing, so figured I should post here first and make 
> sure it isn't a build related issue.
> >
> > I built cryptopp 8.5.0 as a static library, x64 multi-threaded debug 
> (\MTd) using Visual Studio 2019 v16.10.0, on Windows 10 Pro v10.0.19043, 
> using the .sln file provided with the cryptopp source code.
> >
> > I used two different machines for this test. One is the machine I built 
> the cryptopp library with. Both are running the same version of Windows 10. 
> One machine has a Ryzen 3700X, the other has an i7-990X. The Ryzen supports 
> AVX, the i7 does not.
> >
> > I am VERY rarely finding that files encrypted with the chacha cipher by 
> these two machines have differing sha256 hashes. If I do a hex diff against 
> the files, there is a single flipped bit at 0x1EBB4 (0xD8 vs 0xD9).
> >
> > I am able to reproduce this consistently with a specific key, nonce, and 
> input file, after test encrypting ~50GB of 1MB garbage files on each 
> machine.
> >
> > If I disable AVX when building cryptlib by defining CRYPTOPP_DISABLE_AVX 
> and CRYPTOPP_DISABLE_AVX2, the machine with the Ryzen will encrypt the file 
> the same as the i7.
> >
> > Source code for a minimal reproducible example is here:
> > 
> https://github.com/austin-clifton/cryptopp-chacha-asm-test/blob/main/src/main.cpp#L208
> >
> > That repository includes a ready-to-build test case with Visual Studio, 
> minus a built cryptlib.lib which should be added to libs/debug/ before 
> building.
>
> Austin,
>
> I fetched main.cpp and run_459_file_76.bin from your GitHub. I
> compiled the library with:
>
> CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++17" make
>
> I compiled/linked main.cpp with:
>
> g++ -DNDEBUG -g2 -O3 -fPIC -pthread -std=c++17 -I. main.cxx
> ./libcryptopp.a -o main.exe
>
> Running the program on a AMD Ryzen 3 3200U and AMD A6-9220e, this is the 
> result.
>
> $ ./main.exe
> sha256: 0FC0FADCDF82770086C9DA8513A16FC785620D7B1C187CDD828E433EB0979847
> encsha: 6FBEE484EE64A2AB02235DDF29CA0B61EE3B811D227C2729836D3BD6161C9B18
>
> Is this correct?
>
> I have one Windows machine for testing. It is a Core i5. Sorry I don't
> have a good test environment.
>
> Jeff
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/50ee9fd1-c7be-414d-a8b4-84b8fa7bac2an%40googlegroups.com.


Re: [cryptopp-users] Flipped bit in chacha encrypted file, avx vs sse

2021-09-17 Thread austin clifton
FWIW, I have two more test results from Windows machines with Intel CPUs:

   - i7 8750h
   - i9 10980KK
   
Both are AVX-capable and produce the encrypted sha 
6FBEE484EE64A2AB02235DDF29CA0B61EE3B811D227C2729836D3BD6161C9B18.


On Friday, September 17, 2021 at 11:31:48 AM UTC-7 austin clifton wrote:

> Hey Jeff, thanks for the fast response!
>
> Yes, the encrypted sha from your AMD CPUs matches what I get on my Ryzen 7 
> 3700X.
>
> The encrypted sha from the i7 is 
> 8F16077454F8477594CAD4304126B0A6F30C8C4D2536E2441FFFD320656E1DF1. That's 
> also the sha I get if I disable AVX on my Ryzen when compiling cryptopp.
>
> I'm not sure which sha is "correct" but we are seeing the same behavior 
> across the AMD CPUs. Would it make sense to disable assembly altogether to 
> get a reference encrypted sha256?
>
> We are seeing the same behavior from MSVC and GCC compilers. I can try 
> master with GCC here too but sounds like that fix is unrelated?
>
> I'll try to glean more useful data from logs I have here. We distribute 
> encrypted assets to lots of machines (all running Windows) but I have to 
> dig around some.
>
> On Friday, September 17, 2021 at 12:23:55 AM UTC-7 Jeffrey Walton wrote:
>
>> On Thu, Sep 16, 2021 at 8:42 PM austin clifton  
>> wrote: 
>> > 
>> > I have an issue which I believe may be a bug. I followed the 
>> instructions from the "Bug Report" page on the cryptopp wiki and all tests 
>> in cryptest.exe are passing, so figured I should post here first and make 
>> sure it isn't a build related issue. 
>> > 
>> > I built cryptopp 8.5.0 as a static library, x64 multi-threaded debug 
>> (\MTd) using Visual Studio 2019 v16.10.0, on Windows 10 Pro v10.0.19043, 
>> using the .sln file provided with the cryptopp source code. 
>> > 
>> > I used two different machines for this test. One is the machine I built 
>> the cryptopp library with. Both are running the same version of Windows 10. 
>> One machine has a Ryzen 3700X, the other has an i7-990X. The Ryzen supports 
>> AVX, the i7 does not. 
>> > 
>> > I am VERY rarely finding that files encrypted with the chacha cipher by 
>> these two machines have differing sha256 hashes. If I do a hex diff against 
>> the files, there is a single flipped bit at 0x1EBB4 (0xD8 vs 0xD9). 
>> > 
>> > I am able to reproduce this consistently with a specific key, nonce, 
>> and input file, after test encrypting ~50GB of 1MB garbage files on each 
>> machine. 
>> > 
>> > If I disable AVX when building cryptlib by defining 
>> CRYPTOPP_DISABLE_AVX and CRYPTOPP_DISABLE_AVX2, the machine with the Ryzen 
>> will encrypt the file the same as the i7. 
>> > 
>> > Source code for a minimal reproducible example is here: 
>> > 
>> https://github.com/austin-clifton/cryptopp-chacha-asm-test/blob/main/src/main.cpp#L208
>>  
>> > 
>> > That repository includes a ready-to-build test case with Visual Studio, 
>> minus a built cryptlib.lib which should be added to libs/debug/ before 
>> building. 
>>
>> Austin, 
>>
>> I fetched main.cpp and run_459_file_76.bin from your GitHub. I 
>> compiled the library with: 
>>
>> CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++17" make 
>>
>> I compiled/linked main.cpp with: 
>>
>> g++ -DNDEBUG -g2 -O3 -fPIC -pthread -std=c++17 -I. main.cxx 
>> ./libcryptopp.a -o main.exe 
>>
>> Running the program on a AMD Ryzen 3 3200U and AMD A6-9220e, this is the 
>> result. 
>>
>> $ ./main.exe 
>> sha256: 0FC0FADCDF82770086C9DA8513A16FC785620D7B1C187CDD828E433EB0979847 
>> encsha: 6FBEE484EE64A2AB02235DDF29CA0B61EE3B811D227C2729836D3BD6161C9B18 
>>
>> Is this correct? 
>>
>> I have one Windows machine for testing. It is a Core i5. Sorry I don't 
>> have a good test environment. 
>>
>> Jeff 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/e542e5a0-a842-4cad-b30b-699805cd8a81n%40googlegroups.com.


Re: [cryptopp-users] Linking issue on MacOS Catalina (using XCode)

2021-09-17 Thread Samyukta Yagati
Ah I see -- I'm using make with a custom makefile to build the source files 
in my project, is there a way to translate this to flags in the makefile?

On Thursday, September 16, 2021 at 6:31:25 PM UTC-7 Mouse wrote:

> Say, you have a file that includes Crypto++ headers and needs linking with 
> Crypto++ library. And Crypto++ is installed into /usr/local.
>
> Then, the following would be sufficient:
>
> clang++ -o my_binary -I/usr/local/include my_source.cpp -L /usr/local/lib 
> -lcryptopp -lm
>
> (I'm not sure if "-lm" is still necessary)
>
>
> > On Sep 16, 2021, at 19:28, Samyukta Yagati  wrote:
> > 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/4df7487a-c2ea-4807-b73d-1099a13ae866n%40googlegroups.com.