X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fec%2Fec_print.c;h=b80ce384fcb5e0901d67309b774f4442a1992ad6;hb=7fc7d1a7bdeda7e448c13e6fecce96a53b7a62d2;hp=5ae85ccdb0d96ba15caa7db23fdb79ad5a8f1554;hpb=b196e7d936fb377d9c5b305748ac25ff0e53ef6d;p=oweals%2Fopenssl.git diff --git a/crypto/ec/ec_print.c b/crypto/ec/ec_print.c index 5ae85ccdb0..b80ce384fc 100644 --- a/crypto/ec/ec_print.c +++ b/crypto/ec/ec_print.c @@ -1,4 +1,3 @@ -/* crypto/ec/ec_print.c */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * @@ -64,17 +63,10 @@ BIGNUM *EC_POINT_point2bn(const EC_GROUP *group, size_t buf_len = 0; unsigned char *buf; - buf_len = EC_POINT_point2oct(group, point, form, NULL, 0, ctx); - if (buf_len == 0) - return NULL; - - if ((buf = OPENSSL_malloc(buf_len)) == NULL) - return NULL; + buf_len = EC_POINT_point2buf(group, point, form, &buf, ctx); - if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) { - OPENSSL_free(buf); + if (buf_len == 0) return NULL; - } ret = BN_bin2bn(buf, buf_len, ret); @@ -129,19 +121,12 @@ char *EC_POINT_point2hex(const EC_GROUP *group, { char *ret, *p; size_t buf_len = 0, i; - unsigned char *buf, *pbuf; + unsigned char *buf = NULL, *pbuf; - buf_len = EC_POINT_point2oct(group, point, form, NULL, 0, ctx); - if (buf_len == 0) - return NULL; - - if ((buf = OPENSSL_malloc(buf_len)) == NULL) - return NULL; + buf_len = EC_POINT_point2buf(group, point, form, &buf, ctx); - if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) { - OPENSSL_free(buf); + if (buf_len == 0) return NULL; - } ret = OPENSSL_malloc(buf_len * 2 + 2); if (ret == NULL) {