From: miod Date: Sun, 13 Jul 2014 15:42:42 +0000 (+0000) Subject: OPENSSL_{malloc,free} -> {malloc,free} X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=477c699cb315427fec51f7ccdf28a2448cb0b388;p=openbsd OPENSSL_{malloc,free} -> {malloc,free} --- diff --git a/lib/libcrypto/doc/EC_POINT_new.pod b/lib/libcrypto/doc/EC_POINT_new.pod index 69eb0d1a09f..b41ca0ed0c8 100644 --- a/lib/libcrypto/doc/EC_POINT_new.pod +++ b/lib/libcrypto/doc/EC_POINT_new.pod @@ -91,7 +91,7 @@ The function EC_POINT_point2oct must be supplied with a buffer long enough to st 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 diff --git a/lib/libcrypto/doc/ERR_get_error.pod b/lib/libcrypto/doc/ERR_get_error.pod index 01e196c95fd..460a79f3f62 100644 --- a/lib/libcrypto/doc/ERR_get_error.pod +++ b/lib/libcrypto/doc/ERR_get_error.pod @@ -55,7 +55,7 @@ and *B, unless these are B. *B contains a string if *B&B is true. An application B free the *B 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 diff --git a/lib/libcrypto/doc/EVP_PKEY_decrypt.pod b/lib/libcrypto/doc/EVP_PKEY_decrypt.pod index 197878eff73..d22b900024e 100644 --- a/lib/libcrypto/doc/EVP_PKEY_decrypt.pod +++ b/lib/libcrypto/doc/EVP_PKEY_decrypt.pod @@ -67,7 +67,7 @@ Decrypt data using OAEP (for RSA keys): if (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <= 0) /* Error */ - out = OPENSSL_malloc(outlen); + out = malloc(outlen); if (!out) /* malloc failure */ diff --git a/lib/libcrypto/doc/EVP_PKEY_derive.pod b/lib/libcrypto/doc/EVP_PKEY_derive.pod index 2424ce0e54c..09654e1b81d 100644 --- a/lib/libcrypto/doc/EVP_PKEY_derive.pod +++ b/lib/libcrypto/doc/EVP_PKEY_derive.pod @@ -68,7 +68,7 @@ Derive shared secret (for example DH or EC keys): if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0) /* Error */ - skey = OPENSSL_malloc(skeylen); + skey = malloc(skeylen); if (!skey) /* malloc failure */ diff --git a/lib/libcrypto/doc/EVP_PKEY_encrypt.pod b/lib/libcrypto/doc/EVP_PKEY_encrypt.pod index f7969c296ff..b0bfe5d5dc4 100644 --- a/lib/libcrypto/doc/EVP_PKEY_encrypt.pod +++ b/lib/libcrypto/doc/EVP_PKEY_encrypt.pod @@ -67,7 +67,7 @@ Encrypt data using OAEP (for RSA keys): if (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <= 0) /* Error */ - out = OPENSSL_malloc(outlen); + out = malloc(outlen); if (!out) /* malloc failure */ diff --git a/lib/libcrypto/doc/EVP_PKEY_sign.pod b/lib/libcrypto/doc/EVP_PKEY_sign.pod index fb8e61cf299..1925706d96b 100644 --- a/lib/libcrypto/doc/EVP_PKEY_sign.pod +++ b/lib/libcrypto/doc/EVP_PKEY_sign.pod @@ -69,7 +69,7 @@ Sign data using RSA with PKCS#1 padding and SHA256 digest: if (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <= 0) /* Error */ - sig = OPENSSL_malloc(siglen); + sig = malloc(siglen); if (!sig) /* malloc failure */ diff --git a/lib/libcrypto/doc/EVP_PKEY_verify_recover.pod b/lib/libcrypto/doc/EVP_PKEY_verify_recover.pod index 4debf7bff04..095e53ea2f1 100644 --- a/lib/libcrypto/doc/EVP_PKEY_verify_recover.pod +++ b/lib/libcrypto/doc/EVP_PKEY_verify_recover.pod @@ -79,7 +79,7 @@ Recover digest originally signed using PKCS#1 and SHA256 digest: if (EVP_PKEY_verify_recover(ctx, NULL, &routlen, sig, siglen) <= 0) /* Error */ - rout = OPENSSL_malloc(routlen); + rout = malloc(routlen); if (!rout) /* malloc failure */ diff --git a/lib/libcrypto/doc/d2i_X509.pod b/lib/libcrypto/doc/d2i_X509.pod index e212014ac8e..fad4e8c35ba 100644 --- a/lib/libcrypto/doc/d2i_X509.pod +++ b/lib/libcrypto/doc/d2i_X509.pod @@ -91,7 +91,7 @@ Allocate and encode the DER encoding of an X509 structure: len = i2d_X509(x, NULL); - buf = OPENSSL_malloc(len); + buf = malloc(len); if (buf == NULL) /* error */ @@ -159,7 +159,7 @@ mistake is to attempt to use a buffer directly as follows: len = i2d_X509(x, NULL); - buf = OPENSSL_malloc(len); + buf = malloc(len); if (buf == NULL) /* error */ @@ -168,12 +168,12 @@ mistake is to attempt to use a buffer directly as follows: /* Other stuff ... */ - OPENSSL_free(buf); + free(buf); This code will result in B apparently containing garbage because it was incremented after the call to point after the data just written. -Also B will no longer contain the pointer allocated by B -and the subsequent call to B may well crash. +Also B will no longer contain the pointer allocated by B +and the subsequent call to B 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 diff --git a/lib/libssl/src/doc/crypto/ASN1_STRING_length.pod b/lib/libssl/src/doc/crypto/ASN1_STRING_length.pod index f651e4f2aee..f9a47a47dc0 100644 --- a/lib/libssl/src/doc/crypto/ASN1_STRING_length.pod +++ b/lib/libssl/src/doc/crypto/ASN1_STRING_length.pod @@ -48,7 +48,7 @@ such as B. ASN1_STRING_to_UTF8() converts the string B to UTF8 format, the converted data is allocated in a buffer in B<*out>. The length of B is returned or a negative error code. The buffer B<*out> -should be free using OPENSSL_free(). +should be free using free(). =head1 NOTES diff --git a/lib/libssl/src/doc/crypto/BN_bn2bin.pod b/lib/libssl/src/doc/crypto/BN_bn2bin.pod index a4b17ca60a8..03b439c7b94 100644 --- a/lib/libssl/src/doc/crypto/BN_bn2bin.pod +++ b/lib/libssl/src/doc/crypto/BN_bn2bin.pod @@ -36,7 +36,7 @@ NULL, a new B is created. BN_bn2hex() and BN_bn2dec() return printable strings containing the hexadecimal and decimal encoding of B 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 containing a hexadecimal number to a B and stores it in **B. If *B is NULL, a new diff --git a/lib/libssl/src/doc/crypto/EC_POINT_new.pod b/lib/libssl/src/doc/crypto/EC_POINT_new.pod index 69eb0d1a09f..b41ca0ed0c8 100644 --- a/lib/libssl/src/doc/crypto/EC_POINT_new.pod +++ b/lib/libssl/src/doc/crypto/EC_POINT_new.pod @@ -91,7 +91,7 @@ The function EC_POINT_point2oct must be supplied with a buffer long enough to st 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 diff --git a/lib/libssl/src/doc/crypto/ERR_get_error.pod b/lib/libssl/src/doc/crypto/ERR_get_error.pod index 01e196c95fd..460a79f3f62 100644 --- a/lib/libssl/src/doc/crypto/ERR_get_error.pod +++ b/lib/libssl/src/doc/crypto/ERR_get_error.pod @@ -55,7 +55,7 @@ and *B, unless these are B. *B contains a string if *B&B is true. An application B free the *B 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 diff --git a/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod b/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod index 197878eff73..d22b900024e 100644 --- a/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod +++ b/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod @@ -67,7 +67,7 @@ Decrypt data using OAEP (for RSA keys): if (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <= 0) /* Error */ - out = OPENSSL_malloc(outlen); + out = malloc(outlen); if (!out) /* malloc failure */ diff --git a/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod b/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod index 2424ce0e54c..09654e1b81d 100644 --- a/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod +++ b/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod @@ -68,7 +68,7 @@ Derive shared secret (for example DH or EC keys): if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0) /* Error */ - skey = OPENSSL_malloc(skeylen); + skey = malloc(skeylen); if (!skey) /* malloc failure */ diff --git a/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod b/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod index f7969c296ff..b0bfe5d5dc4 100644 --- a/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod +++ b/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod @@ -67,7 +67,7 @@ Encrypt data using OAEP (for RSA keys): if (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <= 0) /* Error */ - out = OPENSSL_malloc(outlen); + out = malloc(outlen); if (!out) /* malloc failure */ diff --git a/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod b/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod index fb8e61cf299..1925706d96b 100644 --- a/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod +++ b/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod @@ -69,7 +69,7 @@ Sign data using RSA with PKCS#1 padding and SHA256 digest: if (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <= 0) /* Error */ - sig = OPENSSL_malloc(siglen); + sig = malloc(siglen); if (!sig) /* malloc failure */ diff --git a/lib/libssl/src/doc/crypto/EVP_PKEY_verify_recover.pod b/lib/libssl/src/doc/crypto/EVP_PKEY_verify_recover.pod index 4debf7bff04..095e53ea2f1 100644 --- a/lib/libssl/src/doc/crypto/EVP_PKEY_verify_recover.pod +++ b/lib/libssl/src/doc/crypto/EVP_PKEY_verify_recover.pod @@ -79,7 +79,7 @@ Recover digest originally signed using PKCS#1 and SHA256 digest: if (EVP_PKEY_verify_recover(ctx, NULL, &routlen, sig, siglen) <= 0) /* Error */ - rout = OPENSSL_malloc(routlen); + rout = malloc(routlen); if (!rout) /* malloc failure */ diff --git a/lib/libssl/src/doc/crypto/d2i_X509.pod b/lib/libssl/src/doc/crypto/d2i_X509.pod index e212014ac8e..fad4e8c35ba 100644 --- a/lib/libssl/src/doc/crypto/d2i_X509.pod +++ b/lib/libssl/src/doc/crypto/d2i_X509.pod @@ -91,7 +91,7 @@ Allocate and encode the DER encoding of an X509 structure: len = i2d_X509(x, NULL); - buf = OPENSSL_malloc(len); + buf = malloc(len); if (buf == NULL) /* error */ @@ -159,7 +159,7 @@ mistake is to attempt to use a buffer directly as follows: len = i2d_X509(x, NULL); - buf = OPENSSL_malloc(len); + buf = malloc(len); if (buf == NULL) /* error */ @@ -168,12 +168,12 @@ mistake is to attempt to use a buffer directly as follows: /* Other stuff ... */ - OPENSSL_free(buf); + free(buf); This code will result in B apparently containing garbage because it was incremented after the call to point after the data just written. -Also B will no longer contain the pointer allocated by B -and the subsequent call to B may well crash. +Also B will no longer contain the pointer allocated by B +and the subsequent call to B 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 diff --git a/lib/libssl/src/doc/crypto/ecdsa.pod b/lib/libssl/src/doc/crypto/ecdsa.pod index b981d865e42..9c8d633fc9c 100644 --- a/lib/libssl/src/doc/crypto/ecdsa.pod +++ b/lib/libssl/src/doc/crypto/ecdsa.pod @@ -155,7 +155,7 @@ or using B 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 */