Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some new features #29

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Some new features #29

wants to merge 13 commits into from

Conversation

moteus
Copy link
Contributor

@moteus moteus commented May 6, 2013

Tested on WinXP / OpenSSL 1.0.1c / Lua (5.1/5.2) / MSVC 2010 Express

  • update/final methods accept string/lightuserdata and range indexes (test/update.lua)
  • writers for encrypt/decrypt/seal/open
  • resetiv method for encrypt/decrypt (test/resetiv.lua)
  • clone for HMAC/encrypt/decrypt
  • key and IV for encrypt/decrypt can be arrays (test/resetiv.lua)
  • hmac:final() can be called multiple times (like in digest)

Reorganize code that works with EVP_CIPHER_CTX

moteus added 13 commits May 3, 2013 21:22
Add. resetiv method to encrypt/decrypt.
Fix. HMAC clone method.
Add. clone method to encrypt/decrypt.
Add. key and IV for encrypt/decrypt can be arrays.
Add. hmac:final() can be called multiple times.
Add. some tests.
Reorganize encrypt/decrypt code.
Update encrypt test
```lua
ctx:set_writer(fn)       -- call fn(chunk)
ctx:set_writer(fn, fctx) -- call fn(fctx, chunk)
ctx:set_writer(stream)   -- call stream:write(chunk)
-- if writer is setted then update/final methods return `self`
```
```
EVP_DecryptUpdate
...
if padding is enabled the decrypted data buffer `out` passed to EVP_DecryptUpdate()
should have sufficient room for (inl + cipher_block_size) bytes
unless the cipher block size is 1 in which case `inl` bytes is sufficient.
```
Add. LCRYPTO_MAX_BUFFER_SIZE macro defines maximum size of temporary buffer used by update methods.
All update methods (encrypt/decrypt/open/seal) use same implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant