aboutsummaryrefslogtreecommitdiffstats
path: root/ossl_digest.c
diff options
context:
space:
mode:
authorMichal Rokos <m.rokos@sh.cvut.cz>2002-06-07 12:37:12 +0000
committerMichal Rokos <m.rokos@sh.cvut.cz>2002-06-07 12:37:12 +0000
commitd1cae3844bbbdbcd14a88ac38ec73f5d0ab34130 (patch)
tree3d55f4fdfa71a63053a88bae1efd1859418dea3e /ossl_digest.c
parentb3538dbaeb0eefca399b2668a8bfb035080875c6 (diff)
downloadruby-openssl-history-d1cae3844bbbdbcd14a88ac38ec73f5d0ab34130.tar.gz
X509Attr, X509Cert, X509CRL, X509Ext, X509Name, X509Req, X509Revoked, X509Store port to 1.8 and new class creation fixups
Diffstat (limited to 'ossl_digest.c')
-rw-r--r--ossl_digest.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/ossl_digest.c b/ossl_digest.c
index f90e589..1003a0a 100644
--- a/ossl_digest.c
+++ b/ossl_digest.c
@@ -10,12 +10,8 @@
*/
#include "ossl.h"
-#define WrapDigest(klass, obj, ctx) do { \
- if (!ctx) { \
- rb_raise(rb_eRuntimeError, "Digest CTX wasn't initialized!"); \
- } \
- obj = Data_Wrap_Struct(klass, 0, CRYPTO_free, ctx); \
-} while (0)
+#define MakeDigest(klass, obj, ctx) \
+ obj = Data_Make_Struct(klass, EVP_MD_CTX, 0, CRYPTO_free, ctx)
#define GetDigest(obj, ctx) do { \
Data_Get_Struct(obj, EVP_MD_CTX, ctx); \
if (!ctx) { \
@@ -56,10 +52,7 @@ ossl_digest_s_allocate(VALUE klass)
EVP_MD_CTX *ctx;
VALUE obj;
- if (!(ctx = OPENSSL_malloc(sizeof(EVP_MD_CTX)))) {
- OSSL_Raise(eDigestError, "Cannot allocate memory for a digest's CTX");
- }
- WrapDigest(klass, obj, ctx);
+ MakeDigest(klass, obj, ctx);
return obj;
}