Skip to content

Commit

Permalink
src: delete AllocatedBuffer
Browse files Browse the repository at this point in the history
Since all its uses are now gone, it's time to say goodbye to
AllocatedBuffer.

Refs: #39941
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: #43008
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
RaisinTen authored and BethGriggs committed May 16, 2022
1 parent c92e291 commit c535db1
Show file tree
Hide file tree
Showing 37 changed files with 63 additions and 276 deletions.
2 changes: 0 additions & 2 deletions node.gyp
Expand Up @@ -589,8 +589,6 @@
'src/aliased_buffer.h',
'src/aliased_struct.h',
'src/aliased_struct-inl.h',
'src/allocated_buffer.h',
'src/allocated_buffer-inl.h',
'src/async_wrap.h',
'src/async_wrap-inl.h',
'src/base_object.h',
Expand Down
110 changes: 0 additions & 110 deletions src/allocated_buffer-inl.h

This file was deleted.

73 changes: 0 additions & 73 deletions src/allocated_buffer.h

This file was deleted.

11 changes: 0 additions & 11 deletions src/crypto/README.md
Expand Up @@ -112,17 +112,6 @@ their underlying data pointers. It is used extensively through `src/crypto`
to make it easier to deal with inputs that allow any `ArrayBuffer`-backed
object.

### `AllocatedBuffer`

The `AllocatedBuffer` utility is defined in `allocated_buffer.h` and is not
specific to `src/crypto`. It is used extensively within `src/crypto` to hold
allocated data that is intended to be output in response to various
crypto functions (generated hash values, or ciphertext, for instance).

_Currently, we are working to transition away from using `AllocatedBuffer`
to directly using the `v8::BackingStore` API. This will take some time.
New uses of `AllocatedBuffer` should be avoided if possible._

### Key objects

Most crypto operations involve the use of keys -- cryptographic inputs
Expand Down
7 changes: 3 additions & 4 deletions src/crypto/crypto_aes.cc
@@ -1,10 +1,9 @@
#include "crypto/crypto_aes.h"
#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "crypto/crypto_cipher.h"
#include "crypto/crypto_keys.h"
#include "crypto/crypto_util.h"
#include "allocated_buffer-inl.h"
#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "threadpoolwork-inl.h"
Expand All @@ -30,7 +29,7 @@ namespace crypto {
namespace {
// Implements general AES encryption and decryption for CBC
// The key_data must be a secret key.
// On success, this function sets out to a new AllocatedBuffer
// On success, this function sets out to a new ByteSource
// instance containing the results and returns WebCryptoCipherStatus::OK.
WebCryptoCipherStatus AES_Cipher(
Environment* env,
Expand Down
1 change: 0 additions & 1 deletion src/crypto/crypto_aes.h
Expand Up @@ -6,7 +6,6 @@
#include "crypto/crypto_cipher.h"
#include "crypto/crypto_keys.h"
#include "crypto/crypto_util.h"
#include "allocated_buffer.h"
#include "env.h"
#include "v8.h"

Expand Down
1 change: 0 additions & 1 deletion src/crypto/crypto_bio.cc
Expand Up @@ -22,7 +22,6 @@
#include "crypto/crypto_bio.h"
#include "base_object-inl.h"
#include "memory_tracker-inl.h"
#include "allocated_buffer-inl.h"
#include "util-inl.h"

#include <openssl/bio.h>
Expand Down
3 changes: 1 addition & 2 deletions src/crypto/crypto_cipher.cc
@@ -1,7 +1,6 @@
#include "crypto/crypto_cipher.h"
#include "crypto/crypto_util.h"
#include "allocated_buffer-inl.h"
#include "base_object-inl.h"
#include "crypto/crypto_util.h"
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "node_buffer.h"
Expand Down
1 change: 0 additions & 1 deletion src/crypto/crypto_common.cc
@@ -1,4 +1,3 @@
#include "allocated_buffer-inl.h"
#include "base_object-inl.h"
#include "env-inl.h"
#include "node_buffer.h"
Expand Down
5 changes: 2 additions & 3 deletions src/crypto/crypto_dh.cc
@@ -1,9 +1,8 @@
#include "crypto/crypto_dh.h"
#include "crypto/crypto_keys.h"
#include "crypto/crypto_groups.h"
#include "allocated_buffer-inl.h"
#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "crypto/crypto_groups.h"
#include "crypto/crypto_keys.h"
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "threadpoolwork-inl.h"
Expand Down
5 changes: 2 additions & 3 deletions src/crypto/crypto_ec.cc
@@ -1,9 +1,8 @@
#include "crypto/crypto_ec.h"
#include "crypto/crypto_common.h"
#include "crypto/crypto_util.h"
#include "allocated_buffer-inl.h"
#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "crypto/crypto_common.h"
#include "crypto/crypto_util.h"
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "node_buffer.h"
Expand Down
7 changes: 3 additions & 4 deletions src/crypto/crypto_ec.h
Expand Up @@ -3,12 +3,11 @@

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "crypto/crypto_keys.h"
#include "crypto/crypto_keygen.h"
#include "crypto/crypto_util.h"
#include "allocated_buffer.h"
#include "async_wrap.h"
#include "base_object.h"
#include "crypto/crypto_keygen.h"
#include "crypto/crypto_keys.h"
#include "crypto/crypto_util.h"
#include "env.h"
#include "memory_tracker.h"
#include "node_internals.h"
Expand Down
1 change: 0 additions & 1 deletion src/crypto/crypto_hash.cc
@@ -1,5 +1,4 @@
#include "crypto/crypto_hash.h"
#include "allocated_buffer-inl.h"
#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "env-inl.h"
Expand Down
3 changes: 1 addition & 2 deletions src/crypto/crypto_hash.h
Expand Up @@ -3,10 +3,9 @@

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "base_object.h"
#include "crypto/crypto_keys.h"
#include "crypto/crypto_util.h"
#include "allocated_buffer.h"
#include "base_object.h"
#include "env.h"
#include "memory_tracker.h"
#include "v8.h"
Expand Down
3 changes: 1 addition & 2 deletions src/crypto/crypto_hkdf.cc
@@ -1,8 +1,7 @@
#include "crypto/crypto_hkdf.h"
#include "crypto/crypto_keys.h"
#include "allocated_buffer-inl.h"
#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "crypto/crypto_keys.h"
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "threadpoolwork-inl.h"
Expand Down
5 changes: 2 additions & 3 deletions src/crypto/crypto_hkdf.h
Expand Up @@ -3,11 +3,10 @@

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "crypto/crypto_keys.h"
#include "crypto/crypto_util.h"
#include "allocated_buffer.h"
#include "async_wrap.h"
#include "base_object.h"
#include "crypto/crypto_keys.h"
#include "crypto/crypto_util.h"
#include "v8.h"

namespace node {
Expand Down
5 changes: 2 additions & 3 deletions src/crypto/crypto_hmac.cc
@@ -1,10 +1,9 @@
#include "crypto/crypto_hmac.h"
#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "crypto/crypto_keys.h"
#include "crypto/crypto_sig.h"
#include "crypto/crypto_util.h"
#include "allocated_buffer-inl.h"
#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "node_buffer.h"
Expand Down
3 changes: 1 addition & 2 deletions src/crypto/crypto_hmac.h
Expand Up @@ -3,11 +3,10 @@

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "base_object.h"
#include "crypto/crypto_keys.h"
#include "crypto/crypto_sig.h"
#include "crypto/crypto_util.h"
#include "allocated_buffer.h"
#include "base_object.h"
#include "env.h"
#include "memory_tracker.h"
#include "v8.h"
Expand Down
1 change: 0 additions & 1 deletion src/crypto/crypto_keygen.cc
@@ -1,5 +1,4 @@
#include "crypto/crypto_keygen.h"
#include "allocated_buffer-inl.h"
#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "debug_utils-inl.h"
Expand Down
5 changes: 2 additions & 3 deletions src/crypto/crypto_keygen.h
Expand Up @@ -3,11 +3,10 @@

#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "crypto/crypto_keys.h"
#include "crypto/crypto_util.h"
#include "allocated_buffer.h"
#include "async_wrap.h"
#include "base_object.h"
#include "crypto/crypto_keys.h"
#include "crypto/crypto_util.h"
#include "env.h"
#include "memory_tracker.h"
#include "v8.h"
Expand Down

0 comments on commit c535db1

Please sign in to comment.