summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a81a736)
raw | patch | inline | side by side (parent: a81a736)
author | Florian Forster <octo@collectd.org> | |
Tue, 2 May 2017 09:22:23 +0000 (11:22 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Tue, 2 May 2017 09:22:23 +0000 (11:22 +0200) |
src/libcollectdclient/network_parse.c | patch | blob | history |
index 3a428892e9b5e5edeba10f6cc7d3940a89249203..7a9c32ad6eeab59ed2253d37f703802cb03c0e46 100644 (file)
gcry_error_t err = gcry_md_open(&hd, GCRY_MD_SHA256, GCRY_MD_FLAG_HMAC);
if (err != 0) {
- /* TODO(octo): use gcry_strerror(err) to create an error string. */
- return -1;
+ return (int)err;
}
err = gcry_md_setkey(hd, password, strlen(password));
if (err != 0) {
gcry_md_close(hd);
- return -1;
+ return (int)err;
}
gcry_md_write(hd, username, strlen(username));
void *payload, size_t payload_size,
lcc_network_parse_options_t const *opts) {
if (opts->password_lookup == NULL) {
- /* TODO(octo): print warning */
+ /* The sender signed the packet but we can't verify it. Handle it as if it
+ * were unsigned, i.e. security level NONE. */
return network_parse(payload, payload_size, NONE, opts);
}
static int parse_encrypt_aes256(void *data, size_t data_size,
lcc_network_parse_options_t const *opts) {
if (opts->password_lookup == NULL) {
- /* TODO(octo): print warning */
+ /* Without a password source it's (hopefully) impossible to decrypt the
+ * network packet. */
return ENOENT;
}