diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2023-04-21 12:24:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-21 12:24:43 +0300 |
commit | 0d2c327ae58af5de35c9cb35a20cce9f59e92b9c (patch) | |
tree | 3f186f7a01ab574d0e2ba3ac46b85ea57aef56a8 /libnetdata | |
parent | 8d953cf206cdaac35aaa493cfcf419955db811da (diff) |
Add a checkpoint message to alerts stream (#14847)
* pull aclk schemas
* resolve capas
* handle checkpoints and removed from health
* build with disable-cloud
* codacy 1
* misc changes
* one more char in hash
* free buffer
* change topic
* misc fixes
* skip removed alert variables
* change hash functions
* use create and destroy for compatibility with older openssl
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/libnetdata.c | 25 | ||||
-rw-r--r-- | libnetdata/libnetdata.h | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/libnetdata/libnetdata.c b/libnetdata/libnetdata.c index 3029b08d1c..a8f26c33b8 100644 --- a/libnetdata/libnetdata.c +++ b/libnetdata/libnetdata.c @@ -2009,3 +2009,28 @@ void timing_action(TIMING_ACTION action, TIMING_STEP step) { } } } + +int hash256_string(const unsigned char *string, size_t size, char *hash) { + EVP_MD_CTX *ctx; + ctx = EVP_MD_CTX_create(); + + if (!ctx) + return 0; + + if (!EVP_DigestInit(ctx, EVP_sha256())) { + EVP_MD_CTX_destroy(ctx); + return 0; + } + + if (!EVP_DigestUpdate(ctx, string, size)) { + EVP_MD_CTX_destroy(ctx); + return 0; + } + + if (!EVP_DigestFinal(ctx, (unsigned char *)hash, NULL)) { + EVP_MD_CTX_destroy(ctx); + return 0; + } + + return 1; +} diff --git a/libnetdata/libnetdata.h b/libnetdata/libnetdata.h index 1f164e3a07..c244949308 100644 --- a/libnetdata/libnetdata.h +++ b/libnetdata/libnetdata.h @@ -782,6 +782,7 @@ typedef enum { #endif void timing_action(TIMING_ACTION action, TIMING_STEP step); +int hash256_string(const unsigned char *string, size_t size, char *hash); # ifdef __cplusplus } # endif |