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

[BUG] is ENABLE_HAICRYPT_LOGGING really supported? #2276

Closed
maxlapshin opened this issue Apr 4, 2022 · 1 comment · Fixed by #2315
Closed

[BUG] is ENABLE_HAICRYPT_LOGGING really supported? #2276

maxlapshin opened this issue Apr 4, 2022 · 1 comment · Fixed by #2315
Labels
[build] Area: Changes in build files Type: Bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@maxlapshin
Copy link

Describe the bug
When I enable ENABLE_HAICRYPT_LOGGING compile option in cmake, it is impossible to build the code because HaiCrypt_DumpConfig (written in 2017) refers to HaiCrypt_Cfg.cipher field, but the structure HaiCrypt_Cfg (written in 2018) doesn't have this field

To Reproduce

$ git log | head -4
commit 277fa583c97c614785710980f3ad0c036a960c29
Author: Maxim Sharabayko <maxlovic@gmail.com>
Date:   Wed Mar 30 16:52:48 2022 +0200
$ cmake . -DENABLE_HEAVY_LOGGING=1 -DENABLE_HAICRYPT_LOGGING=2 -DENABLE_LOGGING=1
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
...
-- C++ STD: Forcing C++11 on applications
-- DETECTED SYSTEM: DARWIN
CMake Warning at CMakeLists.txt:665 (message):
   *** ENABLED INSECURE HAICRYPT LOGGING - USE FOR TESTING ONLY!!! ***
...
-- Generating done
-- Build files have been written to: /Users/max/srt
$ make
[  1%] Building CXX object CMakeFiles/srt_virtual.dir/srtcore/api.cpp.o
[  3%] Building CXX object CMakeFiles/srt_virtual.dir/srtcore/buffer.cpp.o
...
[ 65%] Building C object CMakeFiles/srt_virtual.dir/haicrypt/hcrypt_xpt_srt.c.o
[ 67%] Building CXX object CMakeFiles/srt_virtual.dir/haicrypt/haicrypt_log.cpp.o
/Users/max/Sites/srt/haicrypt/haicrypt_log.cpp:100:22: error: no member named 'cipher' in 'HaiCrypt_Cfg'
            << (cfg->cipher == HaiCryptCipher_OpenSSL_EVP_CTR() ? "OSSL-EVP-CTR":
                ~~~  ^
/Users/max/Sites/srt/haicrypt/../srtcore/logging.h:58:72: note: expanded from macro 'LOGC'
    const srt_logging::LogDispatcher::Proxy& log_prox SRT_ATR_UNUSED = args; \
                                                                       ^~~~
/Users/max/Sites/srt/haicrypt/haicrypt_log.cpp:100:32: error: use of undeclared identifier 'HaiCryptCipher_OpenSSL_EVP_CTR'
            << (cfg->cipher == HaiCryptCipher_OpenSSL_EVP_CTR() ? "OSSL-EVP-CTR":
                               ^
/Users/max/Sites/srt/haicrypt/haicrypt_log.cpp:101:22: error: no member named 'cipher' in 'HaiCrypt_Cfg'
                cfg->cipher == HaiCryptCipher_OpenSSL_AES() ? "OSSL-AES":
                ~~~  ^
/Users/max/Sites/srt/haicrypt/../srtcore/logging.h:58:72: note: expanded from macro 'LOGC'
    const srt_logging::LogDispatcher::Proxy& log_prox SRT_ATR_UNUSED = args; \
                                                                       ^~~~
/Users/max/Sites/srt/haicrypt/haicrypt_log.cpp:101:32: error: use of undeclared identifier 'HaiCryptCipher_OpenSSL_AES'
                cfg->cipher == HaiCryptCipher_OpenSSL_AES() ? "OSSL-AES":
                               ^
/Users/max/Sites/srt/haicrypt/haicrypt_log.cpp:104:22: error: no member named 'cipher' in 'HaiCrypt_Cfg'
                cfg->cipher == HaiCryptCipher_Get_Instance() ? "Nettle-AES":
                ~~~  ^
/Users/max/Sites/srt/haicrypt/../srtcore/logging.h:58:72: note: expanded from macro 'LOGC'
    const srt_logging::LogDispatcher::Proxy& log_prox SRT_ATR_UNUSED = args; \
                                                                       ^~~~
/Users/max/Sites/srt/haicrypt/haicrypt_log.cpp:104:32: error: use of undeclared identifier 'HaiCryptCipher_Get_Instance'; did you mean 'HaiCryptCryspr_Get_Instance'?
                cfg->cipher == HaiCryptCipher_Get_Instance() ? "Nettle-AES":
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                               HaiCryptCryspr_Get_Instance
/Users/max/Sites/srt/haicrypt/../srtcore/logging.h:58:72: note: expanded from macro 'LOGC'
    const srt_logging::LogDispatcher::Proxy& log_prox SRT_ATR_UNUSED = args; \
                                                                       ^
/Users/max/Sites/srt/haicrypt/haicrypt.h:32:17: note: 'HaiCryptCryspr_Get_Instance' declared here
HaiCrypt_Cryspr HaiCryptCryspr_Get_Instance (void);     /* Return a default cryspr instance */
                ^
6 errors generated.
make[2]: *** [CMakeFiles/srt_virtual.dir/haicrypt/haicrypt_log.cpp.o] Error 1
make[1]: *** [CMakeFiles/srt_virtual.dir/all] Error 2
make: *** [all] Error 2

Expected behavior

I expect that srt will compile and debug info about generated keys.

@maxlapshin maxlapshin added the Type: Bug Indicates an unexpected problem or unintended behavior label Apr 4, 2022
@maxsharabayko maxsharabayko added the [build] Area: Changes in build files label Apr 5, 2022
@maxsharabayko maxsharabayko added this to the v1.4.5 milestone Apr 5, 2022
@maxsharabayko
Copy link
Collaborator

Hi @maxlapshin
Thanks for reporting!
Indeed, the HAICRYPT LOGGING remained from the 2017 version and was forgotten to be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[build] Area: Changes in build files Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants