Re: AES CCM decryption/verification.

2017-11-07 Thread Daniel Karcz
Thank you Jeff, I've got it from here 

https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Algorithm-Validation-Program/documents/mac/ccmtestvectors.zip

but I cannot track it down from those files.
Is there any way that i can pass it to CCM in Crypto++ or although display 
it?

Daniel

On Tuesday, 7 November 2017 21:57:17 UTC+1, Jeffrey Walton wrote:
>
>
>
> On Tue, Nov 7, 2017 at 2:32 PM, Daniel Karcz  > wrote:
>
>> I will try to be more precisely:
>>
>> What is the initial value of counter(CTR stream generator) in AES CCM 
>> mode in Crypto++ and by what value is incremented??
>>
>
> Crypto++ uses the test vectors from NIST for validation. Also see 
> https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program
>
> Jeff
>

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
More information about Crypto++ and this group is available at 
http://www.cryptopp.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.
For more options, visit https://groups.google.com/d/optout.


Re: AES CCM decryption/verification.

2017-11-07 Thread Jeffrey Walton
On Tue, Nov 7, 2017 at 2:32 PM, Daniel Karcz  wrote:

> I will try to be more precisely:
>
> What is the initial value of counter(CTR stream generator) in AES CCM mode
> in Crypto++ and by what value is incremented??
>

Crypto++ uses the test vectors from NIST for validation. Also see
https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program

Jeff

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
More information about Crypto++ and this group is available at 
http://www.cryptopp.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.
For more options, visit https://groups.google.com/d/optout.


Re: AES CCM decryption/verification.

2017-11-07 Thread Daniel Karcz
I will try to be more precisely:

What is the initial value of counter(CTR stream generator) in AES CCM mode 
in Crypto++ and by what value is incremented??

  

On Sunday, 5 November 2017 19:06:51 UTC+1, Daniel Karcz wrote:
>
>
> 
> Hi,
>
> I have to understand decryption process of Crypto CCM implementation.
> I'm using the first example AE (authentication/encryption) from Crypto++ 
> Wiki. 
>
> https://www.cryptopp.com/wiki/CCM_Mode
>
> Here is my example output from this program:
>
> key: 6DFB2E83D016999B8F4CA9B564AB2B6A
>  iv: 37F1A6DD11DD2D14C3CABBAD
>
> plain text: Authenticated Encryption
> cipher text: 61CBA7195D8F9619C4190D61D0D953301FFE2169785BAC5501E768279E7B
> C5AA
> recovered text: Authenticated Encryption
>
> Now, here is my understanding of decryption process:
>
> Text "Authenticated Encryption" is 24 bytes long so the firs 24 bytes are 
> cipher:
>
> "61CBA7195D8F9619C4190D61D0D953301FFE2169785BAC55"
>
> we have remain 8 bytes and it is correct because  
>
> TAG_SIZE = 8, so the last 8 bytes are the tag "01E768279E7BC5AA".
>
>
> remain I have to write only encryption/veryfication function (because I'm 
> facing Linux program using Crypto++ with embedded system which Crypto++ is 
> not supporting). I have AES in CTR and CBC Crypto hardware support on that 
> chip.
>
> I have started from generating counter blocks:
>
> so I tooked the iv 37F1A6DD11DD2D14C3CABBAD and I have add 3 bytes 
> (counter) and tooked it as input data to AES ECB encryption with key  
> 6DFB2E83D016999B8F4CA9B564AB2B6A 
>
>  
>  Key: 6DFB2E83D016999B8F4CA9B564AB2B6A
>  Algorithm: AES-128
>  Mode: ECB
>  Crypto operation: Encryption
>  Data: 37F1A6DD11DD2D14C3CABBAD00
>
>  
>  Encrypted data: 77B133ED82AE801FCABAC8F51BCA4141
>
> Now I was suposing that I have a first counter block, so I've made a XOR 
> operation with first 16 bytes of cipher text
>
> Here is result  
> 
>
> 16 7A 94 F4 DF 21 16 06 0E A3 C5 94 CB 13 12 71
>
> and when I changed this into ASCII it is far away from first 16 bytes of 
> plain text: "Authenticated En".
>
> I'm getting crazy with this because it suppose to work that way, and I'm 
> out of ideas with it.
>
> Please help
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
More information about Crypto++ and this group is available at 
http://www.cryptopp.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.
For more options, visit https://groups.google.com/d/optout.


Re: error: 'mutex' in namespace 'std' does not name a type

2017-11-07 Thread Jeffrey Walton
On Tue, Nov 7, 2017 at 1:53 PM,   wrote:
> Here are three more experiments building three different CryptoPP versions
> with the latest 64-bit/64-bit MingW compiler.
>
> Since I already have a solution, this should have no sense of urgency.  Let
> me know if there is something specific I can do to help.

It looks like 3 different issues.

> I fixed my compiler version.  Now it is a 64-bit application and targeting
> 64-bit:
>
> C:\data\code\experimental\cryptopp562>g++ -v
> Using built-in specs.
> COLLECT_GCC=g++
> ...
>
> COMPILING CRYPTOPP562 has this error:
> g++ -DNDEBUG -g -O2 -march=native -DCRYPTOPP_DISABLE_ASM -pipe -c wake.cpp
> wake.cpp: In member function 'void
> CryptoPP::WAKE_Base::GenKey(CryptoPP::word32, CryptoPP::word32,
> CryptoPP::word32, CryptoPP::word32)':
> wake.cpp:34:15: error: narrowing conversion of '3868867420' from 'unsigned
> int' to 'int' inside { } [-Wnarrowing]
>0x9ee27cf3, } ;
>^
> wake.cpp:34:15: error: narrowing conversion of '3553042405' from 'unsigned
> int' to 'int' inside { } [-Wnarrowing]
> wake.cpp:34:15: error: narrowing conversion of '2872865746' from 'unsigned
> int' to 'int' inside { } [-Wnarrowing]
> wake.cpp:34:15: error: narrowing conversion of '2665643251' from 'unsigned
> int' to 'int' inside { } [-Wnarrowing]
> make: *** [wake.o] Error 1

This looks like our bug that surfaces under MinGW. In the past the
signed type was changed to an unsigned type, which squashed most
problems. I guess we need to do a little more.

https://github.com/weidai11/cryptopp/blob/master/wake.cpp

> COMPILING CRYPTOPP565 gives a weird error and pops up a crash dialog:
> g++ -o cryptest.exe -DNDEBUG -g2 -O2 --std=c++11 -march=native -pipe test.o
> bench1.o bench2.o validat1.o validat2.o validat3.o adhoc.o datatest.o regt
> est.o fipsalgt.o dlltest.o ./libcryptopp.a  -lws2_32
> CreateProcess(c:\mingw\bin\g++.exe,g++ -o cryptest.exe -DNDEBUG -g2 -O2
> --std=c++11 -march=native -pipe test.o bench1.o bench2.o validat1.o
> validat2.o
>  validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o
> ./libcryptopp.a -lws2_32,...)
> Putting child 0x005ba968 (cryptest.exe) PID 6254928 on the chain.
> Live child 0x005ba968 (cryptesCannot create temporary file in
> C:\data\code\experimental\cryptopp565\c;\tmnp\: No such file or directory
> t
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
> .exe) PID 6254928
> Reaping losing child 0x005ba968 PID 6254928
> make: *** [cryptest.exe] Error 3
> Removing child 0x005ba968 PID 6254928 from chain.

Hmm... Weird.

I'm not sure what to do with this one. It looks like MinGW is
providing malformed commands.

Has anyone come across it before?


> I did a git clone yesterday, and the 64-bit/64-bit compiler gives this
> error:
>   Must remake target `cryptlib.o'.
> g++ -DNDEBUG -g2 -O3 -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180
> -DCRYPTOPP_DISABLE_ASM -pthread -KPIC -template=no%extdef -c cryptlib.cpp
> CreateProcess(c:\mingw\bin\g++.exe,g++ -DNDEBUG -g2 -O3 -wd68 -wd186 -wd279
> -wd327 -wd161 -wd3180 -DCRYPTOPP_DISABLE_ASM -pthread -KPIC -template=no%e
> xtdef -c cryptlib.cpp,...)
> Putting child 0x0219fa00 (cryptlib.o) PID 35177856 on the chain.
> Live child 0x0219fa00 (crg++: error: unrecognized command line option
> '-wd68'
> ypg++: error: unrecognized command line option '-wd186'
> tlg++: error: unrecognized command line option '-wd279'
> ibg++: error: unrecognized command line option '-wd327'
> .og++: error: unrecognized command line option '-wd161'
> ) PIg++: error: unrecognized command line option '-wd3180'
> D 3g++: error: unrecognized command line option '-KPIC'; did you mean
> '-fPIC'?
> 5177856

Ugh... That looks like a mashup of Intel ICC compiler warning
suppression (-wd186) and Sun CC pic option (-KPIC).

I think we are misidentifying the compiler. Could you provide the output of:

g++.exe -dumpmachine

And:

   g++.exe --version

Jeff

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
More information about Crypto++ and this group is available at 
http://www.cryptopp.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.
For more options, visit https://groups.google.com/d/optout.


Re: error: 'mutex' in namespace 'std' does not name a type

2017-11-07 Thread usbguru
Here are three more experiments building three different CryptoPP versions 
with the latest 64-bit/64-bit MingW compiler.

Since I already have a solution, this should have no sense of urgency.  Let 
me know if there is something specific I can do to help.

*I fixed my compiler version.  Now it is a 64-bit application and targeting 
64-bit:*

C:\data\code\experimental\cryptopp562>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-7.2.0/configure --host=x86_64-w64-mingw32 
--build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 -
-with-sysroot=/c/mingw720/x86_64-720-posix-seh-rt_v5-rev0/mingw64 
--enable-shared --enable-static --disable-multilib 
--enable-languages=c,c++,fortran,
lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp 
--enable-libatomic --enable-lto --enable-graphite --enable-checking=release 
--
enable-fully-dynamic-string --enable-version-specific-runtime-libs 
--enable-libstdcxx-filesystem-ts=yes --disable-libstdcxx-pch 
--disable-libstdcxx-de
bug --enable-bootstrap --disable-rpath --disable-win32-registry 
--disable-nls --disable-werror --disable-symvers --with-gnu-as 
--with-gnu-ld --with-ar
ch=nocona --with-tune=core2 --with-libiconv --with-system-zlib 
--with-gmp=/c/mingw720/prerequisites/x86_64-w64-mingw32-static 
--with-mpfr=/c/mingw720/
prerequisites/x86_64-w64-mingw32-static 
--with-mpc=/c/mingw720/prerequisites/x86_64-w64-mingw32-static 
--with-isl=/c/mingw720/prerequisites/x86_64-w64
-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by 
MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 
CFLAGS=
'-O2 -pipe -fno-ident 
-I/c/mingw720/x86_64-720-posix-seh-rt_v5-rev0/mingw64/opt/include 
-I/c/mingw720/prerequisites/x86_64-zlib-static/include -I/c/mi
ngw720/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe 
-fno-ident -I/c/mingw720/x86_64-720-posix-seh-rt_v5-rev0/mingw64/opt/inclu
de -I/c/mingw720/prerequisites/x86_64-zlib-static/include 
-I/c/mingw720/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' 
-I/c/mingw720/x86_
64-720-posix-seh-rt_v5-rev0/mingw64/opt/include 
-I/c/mingw720/prerequisites/x86_64-zlib-static/include 
-I/c/mingw720/prerequisites/x86_64-w64-mingw32-
static/include' LDFLAGS='-pipe -fno-ident 
-L/c/mingw720/x86_64-720-posix-seh-rt_v5-rev0/mingw64/opt/lib 
-L/c/mingw720/prerequisites/x86_64-zlib-static
/lib -L/c/mingw720/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 7.2.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)

*COMPILING CRYPTOPP562 has this error:*
g++ -DNDEBUG -g -O2 -march=native -DCRYPTOPP_DISABLE_ASM -pipe -c wake.cpp
wake.cpp: In member function 'void 
CryptoPP::WAKE_Base::GenKey(CryptoPP::word32, CryptoPP::word32, 
CryptoPP::word32, CryptoPP::word32)':
wake.cpp:34:15: error: narrowing conversion of '3868867420' from 'unsigned 
int' to 'int' inside { } [-Wnarrowing]
   0x9ee27cf3, } ;
   ^
wake.cpp:34:15: error: narrowing conversion of '3553042405' from 'unsigned 
int' to 'int' inside { } [-Wnarrowing]
wake.cpp:34:15: error: narrowing conversion of '2872865746' from 'unsigned 
int' to 'int' inside { } [-Wnarrowing]
wake.cpp:34:15: error: narrowing conversion of '2665643251' from 'unsigned 
int' to 'int' inside { } [-Wnarrowing]
make: *** [wake.o] Error 1


*COMPILING CRYPTOPP565 gives a weird error and pops up a crash dialog:*
g++ -o cryptest.exe -DNDEBUG -g2 -O2 --std=c++11 -march=native -pipe test.o 
bench1.o bench2.o validat1.o validat2.o validat3.o adhoc.o datatest.o regt
est.o fipsalgt.o dlltest.o ./libcryptopp.a  -lws2_32
CreateProcess(c:\mingw\bin\g++.exe,g++ -o cryptest.exe -DNDEBUG -g2 -O2 
--std=c++11 -march=native -pipe test.o bench1.o bench2.o validat1.o 
validat2.o
 validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o 
./libcryptopp.a -lws2_32,...)
Putting child 0x005ba968 (cryptest.exe) PID 6254928 on the chain.
Live child 0x005ba968 (cryptesCannot create temporary file in 
C:\data\code\experimental\cryptopp565\c;\tmnp\: No such file or directory
t
This application has requested the Runtime to terminate it in an unusual 
way.
Please contact the application's support team for more information.
.exe) PID 6254928
Reaping losing child 0x005ba968 PID 6254928
make: *** [cryptest.exe] Error 3
Removing child 0x005ba968 PID 6254928 from chain.

*I did a git clone yesterday, and the 64-bit/64-bit compiler gives this 
error:*
  Must remake target `cryptlib.o'.
g++ -DNDEBUG -g2 -O3 -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180 
-DCRYPTOPP_DISABLE_ASM -pthread -KPIC -template=no%extdef -c cryptlib.cpp
CreateProcess(c:\mingw\bin\g++.exe,g++ -DNDEBUG -g2 -O3 -wd68 -wd186 -wd279 
-wd327 -wd161 -wd3180 -DCRYPTOPP_DISABLE_ASM -pthread -KPIC -template=no%e
xtdef -c cryptlib.cpp,...)
Putting child 0x0219fa00 (cryptlib.o) PID 35177856 on the chain.
Live 

Re: Skipping last few bytes of file when FileSource

2017-11-07 Thread Richard Závodný
Thanks much! The last example works well.. :) 

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
More information about Crypto++ and this group is available at 
http://www.cryptopp.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.
For more options, visit https://groups.google.com/d/optout.