1 This patch backports changes from ruby 1.8.7 which only includes the
2 openssl prototypes for functions that are not in the system openssl
5 diff -u ruby-1.8.5.orig/ext/openssl/extconf.rb ruby-1.8.5/ext/openssl/extconf.rb
6 --- ruby-1.8.5.orig/ext/openssl/openssl_missing.c 2007-02-13 00:01:19.000000000 +0100
7 +++ ruby-1.8.5/ext/openssl/openssl_missing.c 2008-05-19 05:00:52.000000000 +0200
9 #include "openssl_missing.h"
11 #if !defined(HAVE_HMAC_CTX_COPY)
14 HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in)
16 - if (!out || !in) return 0;
17 + if (!out || !in) return;
18 memcpy(out, in, sizeof(HMAC_CTX));
20 - if (!EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx)
21 - || !EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx)
22 - || !EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx))
25 + EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx);
26 + EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx);
27 + EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx);
29 #endif /* HAVE_HMAC_CTX_COPY */
31 diff -u ruby-1.8.5.orig/ext/openssl/openssl_missing.h ruby-1.8.5/ext/openssl/openssl_missing.h
32 --- ruby-1.8.5.orig/ext/openssl/openssl_missing.h 2008-08-04 06:43:34.000000000 +0200
33 +++ ruby-1.8.5/ext/openssl/openssl_missing.h 2008-08-04 06:44:17.000000000 +0200
35 (char *(*)())d2i_PKCS7_RECIP_INFO, (char *)ri)
38 +#if !defined(HAVE_EVP_MD_CTX_INIT)
39 void HMAC_CTX_init(HMAC_CTX *ctx);
40 -int HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
43 +#if !defined(HAVE_HMAC_CTX_COPY)
44 +void HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
47 +#if !defined(HAVE_HMAC_CTX_CLEANUP)
48 void HMAC_CTX_cleanup(HMAC_CTX *ctx);
51 +#if !defined(HAVE_EVP_MD_CTX_CREATE)
52 EVP_MD_CTX *EVP_MD_CTX_create(void);
55 +#if !defined(HAVE_EVP_MD_CTX_INIT)
56 void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
59 +#if !defined(HAVE_EVP_MD_CTX_CLEANUP)
60 int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
63 +#if !defined(HAVE_EVP_MD_CTX_DESTROY)
64 void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
67 #if !defined(HAVE_EVP_CIPHER_CTX_COPY)
68 int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in);
70 #define OPENSSL_cleanse(p, l) memset(p, 0, l)
73 +#if !defined(HAVE_X509_STORE_SET_EX_DATA)
74 void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
75 int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
78 +#if !defined(HAVE_X509_CRL_SET_VERSION)
79 int X509_CRL_set_version(X509_CRL *x, long version);
82 +#if !defined(HAVE_X509_CRL_SET_ISSUER_NAME)
83 int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
86 +#if !defined(HAVE_X509_CRL_SORT)
87 int X509_CRL_sort(X509_CRL *c);
90 +#if !defined(HAVE_X509_CRL_ADD0_REVOKED)
91 int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
94 +#if !defined(HAVE_BN_MOD_SQR)
95 int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
98 +#if !defined(HAVE_BN_MOD_ADD)
99 int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
102 +#if !defined(HAVE_BN_MOD_SUB)
103 int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
106 +#if !defined(HAVE_BN_RAND_RANGE)
107 int BN_rand_range(BIGNUM *r, BIGNUM *range);
110 +#if !defined(HAVE_BN_PSEUDO_RAND_RANGE)
111 int BN_pseudo_rand_range(BIGNUM *r, BIGNUM *range);
114 +#if !defined(HAVE_CONF_GET1_DEFAULT_CONFIG_FILE)
115 char *CONF_get1_default_config_file(void);
118 +#if !defined(HAVE_PEM_DEF_CALLBACK)
119 int PEM_def_callback(char *buf, int num, int w, void *key);
122 #if defined(__cplusplus)
124 diff -u ruby-1.8.5.orig/ext/openssl/ossl_hmac.c ruby-1.8.5/ext/openssl/ossl_hmac.c
125 --- ruby-1.8.5.orig/ext/openssl/ossl_hmac.c 2007-03-12 05:12:32.000000000 +0100
126 +++ ruby-1.8.5/ext/openssl/ossl_hmac.c 2008-05-19 05:00:52.000000000 +0200
129 SafeGetHMAC(other, ctx2);
131 - if (!HMAC_CTX_copy(ctx1, ctx2)) {
132 - ossl_raise(eHMACError, NULL);
134 + HMAC_CTX_copy(ctx1, ctx2);
140 + * hmac.update(string) -> self
144 ossl_hmac_update(VALUE self, VALUE data)
150 - if (!HMAC_CTX_copy(&final, ctx)) {
151 - ossl_raise(eHMACError, NULL);
153 + HMAC_CTX_copy(&final, ctx);
154 if (!(*buf = OPENSSL_malloc(HMAC_size(&final)))) {
155 HMAC_CTX_cleanup(&final);
156 OSSL_Debug("Allocating %d mem", HMAC_size(&final));