octets stored. Calling the function with a NULL buffer will not perform the conversion but will still return the required buffer length.
The function EC_POINT_point2hex will allocate sufficient memory to store the hexadecimal string. It is the caller's responsibility to free
-this memory with a subsequent call to OPENSSL_free().
+this memory with a subsequent call to free().
=head1 RETURN VALUES
if *B<flags>&B<ERR_TXT_STRING> is true.
An application B<MUST NOT> free the *B<data> pointer (or any other pointers
-returned by these functions) with OPENSSL_free() as freeing is handled
+returned by these functions) with free() as freeing is handled
automatically by the error library.
=head1 RETURN VALUES
if (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <= 0)
/* Error */
- out = OPENSSL_malloc(outlen);
+ out = malloc(outlen);
if (!out)
/* malloc failure */
if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0)
/* Error */
- skey = OPENSSL_malloc(skeylen);
+ skey = malloc(skeylen);
if (!skey)
/* malloc failure */
if (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <= 0)
/* Error */
- out = OPENSSL_malloc(outlen);
+ out = malloc(outlen);
if (!out)
/* malloc failure */
if (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <= 0)
/* Error */
- sig = OPENSSL_malloc(siglen);
+ sig = malloc(siglen);
if (!sig)
/* malloc failure */
if (EVP_PKEY_verify_recover(ctx, NULL, &routlen, sig, siglen) <= 0)
/* Error */
- rout = OPENSSL_malloc(routlen);
+ rout = malloc(routlen);
if (!rout)
/* malloc failure */
len = i2d_X509(x, NULL);
- buf = OPENSSL_malloc(len);
+ buf = malloc(len);
if (buf == NULL)
/* error */
len = i2d_X509(x, NULL);
- buf = OPENSSL_malloc(len);
+ buf = malloc(len);
if (buf == NULL)
/* error */
/* Other stuff ... */
- OPENSSL_free(buf);
+ free(buf);
This code will result in B<buf> apparently containing garbage because
it was incremented after the call to point after the data just written.
-Also B<buf> will no longer contain the pointer allocated by B<OPENSSL_malloc()>
-and the subsequent call to B<OPENSSL_free()> may well crash.
+Also B<buf> will no longer contain the pointer allocated by B<malloc()>
+and the subsequent call to B<free()> may well crash.
The auto allocation feature (setting buf to NULL) only works on OpenSSL
0.9.7 and later. Attempts to use it on earlier versions will typically
ASN1_STRING_to_UTF8() converts the string B<in> to UTF8 format, the
converted data is allocated in a buffer in B<*out>. The length of
B<out> is returned or a negative error code. The buffer B<*out>
-should be free using OPENSSL_free().
+should be free using free().
=head1 NOTES
BN_bn2hex() and BN_bn2dec() return printable strings containing the
hexadecimal and decimal encoding of B<a> respectively. For negative
numbers, the string is prefaced with a leading '-'. The string must be
-freed later using OPENSSL_free().
+freed later using free().
BN_hex2bn() converts the string B<str> containing a hexadecimal number
to a B<BIGNUM> and stores it in **B<bn>. If *B<bn> is NULL, a new
octets stored. Calling the function with a NULL buffer will not perform the conversion but will still return the required buffer length.
The function EC_POINT_point2hex will allocate sufficient memory to store the hexadecimal string. It is the caller's responsibility to free
-this memory with a subsequent call to OPENSSL_free().
+this memory with a subsequent call to free().
=head1 RETURN VALUES
if *B<flags>&B<ERR_TXT_STRING> is true.
An application B<MUST NOT> free the *B<data> pointer (or any other pointers
-returned by these functions) with OPENSSL_free() as freeing is handled
+returned by these functions) with free() as freeing is handled
automatically by the error library.
=head1 RETURN VALUES
if (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <= 0)
/* Error */
- out = OPENSSL_malloc(outlen);
+ out = malloc(outlen);
if (!out)
/* malloc failure */
if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0)
/* Error */
- skey = OPENSSL_malloc(skeylen);
+ skey = malloc(skeylen);
if (!skey)
/* malloc failure */
if (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <= 0)
/* Error */
- out = OPENSSL_malloc(outlen);
+ out = malloc(outlen);
if (!out)
/* malloc failure */
if (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <= 0)
/* Error */
- sig = OPENSSL_malloc(siglen);
+ sig = malloc(siglen);
if (!sig)
/* malloc failure */
if (EVP_PKEY_verify_recover(ctx, NULL, &routlen, sig, siglen) <= 0)
/* Error */
- rout = OPENSSL_malloc(routlen);
+ rout = malloc(routlen);
if (!rout)
/* malloc failure */
len = i2d_X509(x, NULL);
- buf = OPENSSL_malloc(len);
+ buf = malloc(len);
if (buf == NULL)
/* error */
len = i2d_X509(x, NULL);
- buf = OPENSSL_malloc(len);
+ buf = malloc(len);
if (buf == NULL)
/* error */
/* Other stuff ... */
- OPENSSL_free(buf);
+ free(buf);
This code will result in B<buf> apparently containing garbage because
it was incremented after the call to point after the data just written.
-Also B<buf> will no longer contain the pointer allocated by B<OPENSSL_malloc()>
-and the subsequent call to B<OPENSSL_free()> may well crash.
+Also B<buf> will no longer contain the pointer allocated by B<malloc()>
+and the subsequent call to B<free()> may well crash.
The auto allocation feature (setting buf to NULL) only works on OpenSSL
0.9.7 and later. Attempts to use it on earlier versions will typically
int buf_len;
buf_len = ECDSA_size(eckey);
- buffer = OPENSSL_malloc(buf_len);
+ buffer = malloc(buf_len);
pp = buffer;
if (!ECDSA_sign(0, dgst, dgstlen, pp, &buf_len, eckey) {
/* error */