diff options
Diffstat (limited to 'xs_openssl.h')
| -rw-r--r-- | xs_openssl.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/xs_openssl.h b/xs_openssl.h index 4a86046..d1a52f0 100644 --- a/xs_openssl.h +++ b/xs_openssl.h | |||
| @@ -6,7 +6,15 @@ | |||
| 6 | 6 | ||
| 7 | xs_str *_xs_digest(const xs_val *input, int size, const char *digest, int as_hex); | 7 | xs_str *_xs_digest(const xs_val *input, int size, const char *digest, int as_hex); |
| 8 | 8 | ||
| 9 | #ifndef _XS_MD5_H | ||
| 9 | #define xs_md5_hex(input, size) _xs_digest(input, size, "md5", 1) | 10 | #define xs_md5_hex(input, size) _xs_digest(input, size, "md5", 1) |
| 11 | #endif /* XS_MD5_H */ | ||
| 12 | |||
| 13 | #ifndef _XS_BASE64_H | ||
| 14 | xs_str *xs_base64_enc(const xs_val *data, int sz); | ||
| 15 | xs_val *xs_base64_dec(const xs_str *data, int *size); | ||
| 16 | #endif /* XS_BASE64_H */ | ||
| 17 | |||
| 10 | #define xs_sha1_hex(input, size) _xs_digest(input, size, "sha1", 1) | 18 | #define xs_sha1_hex(input, size) _xs_digest(input, size, "sha1", 1) |
| 11 | #define xs_sha256_hex(input, size) _xs_digest(input, size, "sha256", 1) | 19 | #define xs_sha256_hex(input, size) _xs_digest(input, size, "sha256", 1) |
| 12 | #define xs_sha256_base64(input, size) _xs_digest(input, size, "sha256", 0) | 20 | #define xs_sha256_base64(input, size) _xs_digest(input, size, "sha256", 0) |
| @@ -22,7 +30,9 @@ int xs_evp_verify(const char *pubkey, const char *mem, int size, const char *b64 | |||
| 22 | #include "openssl/pem.h" | 30 | #include "openssl/pem.h" |
| 23 | #include "openssl/evp.h" | 31 | #include "openssl/evp.h" |
| 24 | 32 | ||
| 25 | #if 0 | 33 | |
| 34 | #ifndef _XS_BASE64_H | ||
| 35 | |||
| 26 | xs_str *xs_base64_enc(const xs_val *data, int sz) | 36 | xs_str *xs_base64_enc(const xs_val *data, int sz) |
| 27 | /* encodes data to base64 */ | 37 | /* encodes data to base64 */ |
| 28 | { | 38 | { |
| @@ -77,7 +87,8 @@ xs_val *xs_base64_dec(const xs_str *data, int *size) | |||
| 77 | 87 | ||
| 78 | return s; | 88 | return s; |
| 79 | } | 89 | } |
| 80 | #endif | 90 | |
| 91 | #endif /* _XS_BASE64_H */ | ||
| 81 | 92 | ||
| 82 | 93 | ||
| 83 | xs_str *_xs_digest(const xs_val *input, int size, const char *digest, int as_hex) | 94 | xs_str *_xs_digest(const xs_val *input, int size, const char *digest, int as_hex) |