projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add EC_KEY_priv2buf()
[oweals/openssl.git]
/
crypto
/
ec
/
ec_print.c
diff --git
a/crypto/ec/ec_print.c
b/crypto/ec/ec_print.c
index 96b294d8774e4694151e34be3b1b85ae4756c329..b80ce384fcb5e0901d67309b774f4442a1992ad6 100644
(file)
--- 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.
*
/* ====================================================================
* 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;
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;
return NULL;
- }
ret = BN_bin2bn(buf, buf_len, ret);
ret = BN_bin2bn(buf, buf_len, ret);
@@
-110,7
+102,7
@@
EC_POINT *EC_POINT_bn2point(const EC_GROUP *group,
ret = point;
if (!EC_POINT_oct2point(group, ret, buf, buf_len, ctx)) {
ret = point;
if (!EC_POINT_oct2point(group, ret, buf, buf_len, ctx)) {
- if (
point == NULL
)
+ if (
ret != point
)
EC_POINT_clear_free(ret);
OPENSSL_free(buf);
return NULL;
EC_POINT_clear_free(ret);
OPENSSL_free(buf);
return NULL;
@@
-129,21
+121,14
@@
char *EC_POINT_point2hex(const EC_GROUP *group,
{
char *ret, *p;
size_t buf_len = 0, i;
{
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;
return NULL;
- }
- ret =
(char *)
OPENSSL_malloc(buf_len * 2 + 2);
+ ret = OPENSSL_malloc(buf_len * 2 + 2);
if (ret == NULL) {
OPENSSL_free(buf);
return NULL;
if (ret == NULL) {
OPENSSL_free(buf);
return NULL;