diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-04-20 01:16:45 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-05 16:01:14 +0900 |
commit | 346f5f52206c478e9f5d444c8f1697fef7be58b2 (patch) | |
tree | 31f07bf6554e2c40299c0e8725a9b46aa9a258e0 /ext/openssl/openssl_missing.c | |
parent | c7b5f57601de93b9290f7b393595ddf70ded0757 (diff) | |
download | ruby-346f5f52206c478e9f5d444c8f1697fef7be58b2.tar.gz |
ext/openssl: always use our implementation of SSL_SESSION_cmp()
Implement CRYPTO_memcmp() in openssl_missing.c if it is not provided.
Rename our SSL_SESSION_cmp() to ossl_SSL_SESSION_cmp().
Diffstat (limited to 'ext/openssl/openssl_missing.c')
-rw-r--r-- | ext/openssl/openssl_missing.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/openssl/openssl_missing.c b/ext/openssl/openssl_missing.c index 31f2d0a5f9..5981f19443 100644 --- a/ext/openssl/openssl_missing.c +++ b/ext/openssl/openssl_missing.c @@ -338,3 +338,21 @@ ASN1_put_eoc(unsigned char **pp) return 2; } #endif + +#if !defined(HAVE_CRYPTO_MEMCMP) +int +CRYPTO_memcmp(const volatile void * volatile in_a, + const volatile void * volatile in_b, + size_t len) +{ + size_t i; + const volatile unsigned char *a = in_a; + const volatile unsigned char *b = in_b; + unsigned char x = 0; + + for (i = 0; i < len; i++) + x |= a[i] ^ b[i]; + + return x; +} +#endif |