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 <[email protected]>

PR-URL: #43008
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Zeyu "Alex" Yang <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
RaisinTen authored May 13, 2022
1 parent 78c8d2a commit f91dcc2
Show file tree
Hide file tree
Showing 37 changed files with 63 additions and 276 deletions.
2 changes: 0 additions & 2 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Loading

0 comments on commit f91dcc2

Please sign in to comment.