diff options
author | default <nobody@localhost> | 2022-09-26 18:40:46 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2022-09-26 18:40:46 +0200 |
commit | 725508640117c24150fb18811e477fae4e2e9c85 (patch) | |
tree | 1755c8c07c5688eedf73ea7d15c4f8a1668e6412 /xs_openssl.h | |
parent | acb4bcd80fadc02f5c090d5050ee15a0733a2c55 (diff) |
Backported from xs.
Diffstat (limited to 'xs_openssl.h')
-rw-r--r-- | xs_openssl.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/xs_openssl.h b/xs_openssl.h index d31442a..d172444 100644 --- a/xs_openssl.h +++ b/xs_openssl.h @@ -185,7 +185,6 @@ d_char *xs_evp_sign(char *secret, char *mem, int size) unsigned char *sig; unsigned int sig_len; EVP_PKEY *pkey; - EVP_MD_CTX *mdctx; const EVP_MD *md; @@ -193,6 +192,10 @@ d_char *xs_evp_sign(char *secret, char *mem, int size) b = BIO_new_mem_buf(secret, strlen(secret)); pkey = PEM_read_bio_PrivateKey(b, NULL, NULL, NULL); + /* I've learnt all these magical incantations by watching + the Python module code and the OpenSSL manual pages */ + /* Well, "learnt" may be an exaggeration */ + md = EVP_get_digestbyname("sha256"); mdctx = EVP_MD_CTX_new(); @@ -207,7 +210,6 @@ d_char *xs_evp_sign(char *secret, char *mem, int size) signature = xs_base64_enc((char *)sig, sig_len); EVP_MD_CTX_free(mdctx); - BIO_free(b); free(sig); |