crypto: implement crypto libary
OpenSSL API is quite complex and hard to follow, additionally it is very unstable. Encoding/decoding via OpenSSL methods usually consists of multiple calls of a lot of functions. This patch wraps OpenSSL API with one more easy to use and conforming Tarantool code style in scope of crypto library. The traditional OpenSSL API is wrapped as well in a form of crypto_stream object, so OpenSSL API is not cut off. Besides struct crypto_stream the library provides struct crypto_codec which encapsulates all the steps of encryption logic in two short functions: crypto_codec_encrypt/decrypt(iv, in, in_size, out, out_size) A caller can create a needed codec via crypto_codec_new, which now supports all the same algorithms as crypto.lua module. Needed for #3234
Showing
- src/lib/core/diag.h 2 additions, 0 deletionssrc/lib/core/diag.h
- src/lib/core/exception.cc 25 additions, 0 deletionssrc/lib/core/exception.cc
- src/lib/core/exception.h 7 additions, 0 deletionssrc/lib/core/exception.h
- src/lib/crypto/CMakeLists.txt 1 addition, 1 deletionsrc/lib/crypto/CMakeLists.txt
- src/lib/crypto/crypto.c 288 additions, 0 deletionssrc/lib/crypto/crypto.c
- src/lib/crypto/crypto.h 236 additions, 0 deletionssrc/lib/crypto/crypto.h
- test/unit/CMakeLists.txt 3 additions, 0 deletionstest/unit/CMakeLists.txt
- test/unit/crypto.c 302 additions, 0 deletionstest/unit/crypto.c
- test/unit/crypto.result 132 additions, 0 deletionstest/unit/crypto.result
Loading
Please register or sign in to comment