diff options
author | defanor <defanor@uberspace.net> | 2023-09-15 21:54:12 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2023-09-15 21:54:12 +0300 |
commit | 27999bd847c95bc85b3e860684fed794867677b4 (patch) | |
tree | 1ee39dedca3658fc24e68fcf1caaa2a10182dd0c /src/rexmpp_openpgp.c | |
parent | 171dd160a5dab054af7096d52d5c970c4dea566f (diff) |
Abstract out random generation
Still depending on gcrypt for hashing, but this is a step towards
making that dependency optional.
Diffstat (limited to 'src/rexmpp_openpgp.c')
-rw-r--r-- | src/rexmpp_openpgp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rexmpp_openpgp.c b/src/rexmpp_openpgp.c index c11d031..4ef7335 100644 --- a/src/rexmpp_openpgp.c +++ b/src/rexmpp_openpgp.c @@ -55,6 +55,7 @@ Possible future improvements: #include "rexmpp_jid.h" #include "rexmpp_pubsub.h" #include "rexmpp_base64.h" +#include "rexmpp_random.h" #ifdef HAVE_GPGME @@ -739,9 +740,9 @@ char *rexmpp_openpgp_payload (rexmpp_t *s, /* A random-length random-content padding. */ char *rand_str, rand[256]; - gcry_create_nonce(rand, 1); + rexmpp_random_buf(rand, 1); size_t rand_str_len = 0, rand_len = (unsigned char)rand[0] % (255 - 16) + 16; - gcry_create_nonce(rand, rand_len); + rexmpp_random_buf(rand, rand_len); rexmpp_base64_to(rand, rand_len, &rand_str, &rand_str_len); rexmpp_xml_t *rpad = |