added aes-gcm - #2165
Conversation
|
yea there still need work to be done |
Thanks! So where are we at with this? Does it build and work ok for those test scripts? |
|
the problem im running into is, the encrypted data being generated from mbedtls is not verifyable (it can decrypt it, but the gcm tag is invalid causing a failed decryption ).. but encrypted data from webcrypt/browser is verifyable in mbed tls |
|
SIDE note, so instead of hunting down the issue on that yesterday.. i coded up ECDH https://gist.github.com/bmatusiak/a1ac4b31cf5fd4c2c4ac2a9b0fd377ff |
|
ok i fixed gcm encrypt auth tag |
|
I changed IV to be a variable length, 16 = {0} is default(for all modes) added |
| jsvIterateCallbackToBytes(ivVar, iv, sizeof(iv)); | ||
| if (ivVar && !jsvIsUndefined(ivVar)) { | ||
| iv_size = (size_t)jsvGetLength(ivVar); | ||
| jsvIterateCallbackToBytes(ivVar, &iv_bytes, (unsigned int)iv_size); |
There was a problem hiding this comment.
Sorry it's taken so long to look into this - but this one in particular looks broken.
iv_bytes is never set, so at this point jsvIterateCallbackToBytes will write into a random area of memory! It's possible that by using &iv_bytes you're just writing onto the stack, but there's definitely an issue here...
this need testing,
but here in a test scripts for espruino and browser
https://gist.github.com/bmatusiak/c4517056a93f96ea904e85b7f5c0ddb5