Commits (12)
This diff is collapsed.
......@@ -41,7 +41,7 @@ PKGCFG_L=$(GLIB_LDFLAGS) \
CFLAGS += -std=c11 -Wall -Wextra -Wpedantic -Wstrict-overflow \
-fno-strict-aliasing -funsigned-char \
-fno-builtin-memset $(PKGCFG_C)
CPPFLAGS += -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
CPPFLAGS += -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE
CFLAGS_CONVERSATIONS=$(CFLAGS) -DOMEMO_XMLNS='"eu.siacs.conversations.axolotl"' -DOMEMO_NS_SEPARATOR='"."' -DOMEMO_NS_NOVERSION
COVFLAGS = --coverage -O0 -g $(CFLAGS)
LDFLAGS += -pthread -ldl -lm $(PKGCFG_L)
......
# libomemo 0.6.0
# libomemo 0.6.2
Implements [OMEMO](https://conversations.im/omemo/) ([XEP-0384](https://xmpp.org/extensions/xep-0384.html)) in C.
Input and output are XML strings, so it does not force you to use a certain XML lib.
......
/**
* LIBOMEMO 0.6.0
* LIBOMEMO 0.6.2
*/
......
......@@ -49,6 +49,7 @@ int omemo_default_crypto_aes_gcm_encrypt( const uint8_t * plaintext_p, size_t pl
}
int ret_val = 0;
int hd_is_init = 0;
int algo = 0;
gcry_cipher_hd_t cipher_hd = NULL;
......@@ -75,6 +76,7 @@ int omemo_default_crypto_aes_gcm_encrypt( const uint8_t * plaintext_p, size_t pl
ret_val = -ret_val;
goto cleanup;
}
hd_is_init = 1;
ret_val = gcry_cipher_setkey(cipher_hd, key_p, key_len);
if (ret_val) {
......@@ -121,7 +123,9 @@ cleanup:
free(out_p);
free(tag_p);
}
gcry_cipher_close(cipher_hd);
if (hd_is_init) {
gcry_cipher_close(cipher_hd);
}
return ret_val;
}
......@@ -139,6 +143,7 @@ int omemo_default_crypto_aes_gcm_decrypt( const uint8_t * ciphertext_p, size_t c
}
int ret_val = 0;
int hd_is_init = 0;
int algo = 0;
gcry_cipher_hd_t cipher_hd = NULL;
......@@ -164,6 +169,7 @@ int omemo_default_crypto_aes_gcm_decrypt( const uint8_t * ciphertext_p, size_t c
ret_val = -ret_val;
goto cleanup;
}
hd_is_init = 1;
ret_val = gcry_cipher_setkey(cipher_hd, key_p, key_len);
if (ret_val) {
......@@ -203,7 +209,9 @@ cleanup:
free(out_p);
}
gcry_cipher_close(cipher_hd);
if (hd_is_init) {
gcry_cipher_close(cipher_hd);
}
return ret_val;
}
......