Hello ML,
First of all, I'm not a crypto expert, that's why I ask this question
which may appear obvious for some of you.
I work on NSS and I've studied the CBC operation mode implementation for
Camellia and SEED ciphers.
I do understand how the CBC works but I don't understand why there is a
need to do a memcpy just before exiting the function.
_Examples :_
- For Camellia at the end of camellia_encryptCBC(CamelliaContext *cx, ...) :
lastblock = output;
memcpy(cx->iv, lastblock, CAMELLIA_BLOCK_SIZE);
return SECSuccess;
- For SEED at the end of the encryption part in
SEED_cbc_encrypt(unsigned char ivec[SEED_BLOCK_SIZE], ...) :
iv = out;
memcpy(ivec, iv, SEED_BLOCK_SIZE);
(no return here because this function returns void)
Do we use this last block somewhere else in NSS to justify this backup ?
Here I deal with encryption but it's the same thing with decryption, the
last block is always backed up.
I'm sorry if this matter has already been discussed but I would really
appreciate some pointers.
Regards,
Gregory.
(off-topic: About the SEED cipher : why do they encrypt and decrypt in
the same function called encrypt ???)
--
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto