Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-05-23 Thread Niels Möller
Nicolas Mora writes: > I've added test cases to verify that unwrap fail if the input values > are incorrect [1]. I reuse all the unwrap test cases, changed one > ciphertext byte and expect the unwrap function to return 0. I've merged the latest version of

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-04-07 Thread Nicolas Mora
Hello, Le 2021-04-07 à 08 h 09, Aapo Talvensaari a écrit : It says: "*ciphertext length must be cleartext_length-8" but shouldn't that be: "*ciphertext length must be cleartext_length+8"? Indeed, the typo is similar in the other paragraph. For void aesXXX_keywrap, it should say: "*cleartext

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-04-07 Thread Aapo Talvensaari
On Mon, Apr 5, 2021 at 4:17 PM Nicolas Mora wrote: > Until we come to a solution on where to put the documentation, I've > started a first draft for the documentation. Can you give me feedback on > it? > It says: "*ciphertext length must be cleartext_length-8" but shouldn't that be:

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-04-05 Thread Nicolas Mora
Hello, I've added test cases to verify that unwrap fail if the input values are incorrect [1]. I reuse all the unwrap test cases, changed one ciphertext byte and expect the unwrap function to return 0. Le 2021-03-29 à 13 h 32, Niels Möller a écrit : That's one possibility, but I think it

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-29 Thread Simo Sorce
On Mon, 2021-03-29 at 19:32 +0200, Niels Möller wrote: > Nicolas Mora writes: > > > > The new feature also needs documentation, will you look into that once > > > code, and in particular the interfaces, are solid? > > > > > Definitely! > > What do you think the documentation should look like?

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-29 Thread Niels Möller
Nicolas Mora writes: >> The new feature also needs documentation, will you look into that once >> code, and in particular the interfaces, are solid? >> > Definitely! > What do you think the documentation should look like? Should it be > near paragraph 7.2.1? Like > > 7.2.1.1 AES Key Wrap That's

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-28 Thread Nicolas Mora
Hello, Le 2021-03-28 à 11 h 10, Niels Möller a écrit : Hi, I haven't been paying attention to this for a few weeks, but I've had a nother look now. I've left a few comments on the MR. Thanks, I've made the requested changes in the MR. For testing, it's important to test both in-place

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-07 Thread Nicolas Mora
Hello, Le 2021-03-07 à 10 h 26, Niels Möller a écrit : Hmm. Maybe better to define an optional swap operation. Like Thanks a lot for that, I wouldn't be able to come up with it by myself... > The reason it doesn't work is the type of R. R is now an unaligned > uint8_t *. *(R + (i * 8)) (the

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-07 Thread Niels Möller
Nicolas Mora writes: > I've added 2 macros definitions: MSB_XOR_T_WRAP and MSB_XOR_T_UNWRAP, > I couldn't find how to make just one macro for both cases because of > the direction of the xor. Hmm. Maybe better to define an optional swap operation. Like #if WORDS_BIGENDIAN #define

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-07 Thread Niels Möller
Nicolas Mora writes: > memcpy (I.b + 8, R + (i * 8), 8); // This one works > I.u64[1] = *(R + (i * 8)); // This one doesn't work > > Is there something I'm missing? The reason it doesn't work is the type of R. R is now an unaligned uint8_t *. *(R + (i * 8)) (the same as R[i*8]) is an uint8_t,

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-06 Thread Nicolas Mora
Hello again, Le 2021-03-06 à 11 h 27, Niels Möller a écrit : I've updated the MR to reuse ciphertext or cleartext as R. The original test cases still pass, I'll have to complete the tests. Hmm. I think you should leave the input buffer untouched, with type const uint8_t*, and only use the

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-06 Thread Nicolas Mora
Hello Current status update Le 2021-03-06 à 11 h 27, Niels Möller a écrit : // A = MSB(64, B) ^ t where t = (n*j)+i A64 = READ_UINT64(B.b); A64 ^= (n*j)+(i+1); WRITE_UINT64(A.b, A64); I've added 2 macros definitions: MSB_XOR_T_WRAP and MSB_XOR_T_UNWRAP, I

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-06 Thread Jeffrey Walton
On Tue, Feb 2, 2021 at 5:44 PM Nicolas Mora wrote: > > Hello, > > I've added a merge request to implement AES key wrap and unwrap in > Nettle [1]. > > The MR is not complete, because the tests haven't been pushed yet and > the documentation is missing, but if the new functionality is welcome to >

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-06 Thread Nicolas Mora
Hello, I haven't made all the changes you requested but here's my situation. Le 2021-03-06 à 04 h 45, Niels Möller a écrit : Nicolas Mora writes: * About the byteswapping comment, the code // A = MSB(64, B) ^ t where t = (n*j)+i A64 = READ_UINT64(B.b); A64 ^= (n*j)+(i+1);

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-06 Thread Niels Möller
Nicolas Mora writes: > I still have one uresolved comment about byte swapping but the rest > are resolved. Thanks. I'll do this round of comments on email, since it might be of interest to other contributors. * About the byteswapping comment, the code // A = MSB(64, B) ^ t where t =

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-04 Thread Nicolas Mora
Hello, Le 2021-03-04 à 04 h 14, Niels Möller a écrit : I've added a couple of comments on the mr. Thanks a lot! I still have one uresolved comment about byte swapping but the rest are resolved. One question: Do you intentionally limit message size to 64 bytes? Is that according to spec?

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-03-04 Thread Niels Möller
Nicolas Mora writes: > I've updated the MR with the new functions definitions and added test > cases based on the test vectors from the RFC. > > https://git.lysator.liu.se/nettle/nettle/-/merge_requests/19 I've added a couple of comments on the mr. One question: Do you intentionally limit

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-02-05 Thread Nicolas Mora
Hello, I've updated the MR with the new functions definitions and added test cases based on the test vectors from the RFC. https://git.lysator.liu.se/nettle/nettle/-/merge_requests/19 Le 2021-02-04 à 01 h 48, Niels Möller a écrit : It was designed to wrap key data, but not necessarily AES

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-02-03 Thread Niels Möller
Nicolas Mora writes: > It was designed to wrap key data, but not necessarily AES only. The > kek must be an AES key though. The key data to wrap can be any data, > as long as it's a set of 64 bits blocks. If it doesn't add a lot of complexity, I think it would be nice to be able to substitute

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-02-03 Thread Nicolas Mora
Hello Niels, Thanks for your feedback! Le 2021-02-03 à 03 h 47, Niels Möller a écrit : Thanks. Can you give a bit more details on the usecase? I've understood that it's part of web-related specs, but do you know any examples of protocols or applicatinos using it, and how? The AES Key Wrap is

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-02-03 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes: > So to be concrete on the interface comments, I'd suggest something like > > void > nist_keywrap16(const void *ctx, nettle_cipher_func *encrypt, >const uint8_t *iv, size_t ciphertext_length, >uint8_t *ciphertext, cosnt

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-02-03 Thread Niels Möller
Nicolas Mora writes: > I've added a merge request to implement AES key wrap and unwrap in > Nettle [1]. Thanks. Can you give a bit more details on the usecase? I've understood that it's part of web-related specs, but do you know any examples of protocols or applicatinos using it, and how? I've

Re: Add AES Key Wrap (RFC 3394) in Nettle

2021-02-02 Thread Nicolas Mora
Le 2021-02-02 à 17 h 44, Nicolas Mora a écrit : Hello, I've added a merge request to implement AES key wrap and unwrap in Nettle [1]. Of course I forgot the link to the MR... https://git.lysator.liu.se/nettle/nettle/-/merge_requests/19 /Nicolas OpenPGP_signature Description: OpenPGP

Add AES Key Wrap (RFC 3394) in Nettle

2021-02-02 Thread Nicolas Mora
Hello, I've added a merge request to implement AES key wrap and unwrap in Nettle [1]. The MR is not complete, because the tests haven't been pushed yet and the documentation is missing, but if the new functionality is welcome to Nettle, I'd rather have some feedback on the code first, to