Skip to content

Commit c535db1

Browse files
RaisinTenBethGriggs
authored andcommitted
src: delete AllocatedBuffer
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>
1 parent c92e291 commit c535db1

37 files changed

+63
-276
lines changed

node.gyp

-2
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,6 @@
589589
'src/aliased_buffer.h',
590590
'src/aliased_struct.h',
591591
'src/aliased_struct-inl.h',
592-
'src/allocated_buffer.h',
593-
'src/allocated_buffer-inl.h',
594592
'src/async_wrap.h',
595593
'src/async_wrap-inl.h',
596594
'src/base_object.h',

src/allocated_buffer-inl.h

-110
This file was deleted.

src/allocated_buffer.h

-73
This file was deleted.

src/crypto/README.md

-11
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,6 @@ their underlying data pointers. It is used extensively through `src/crypto`
112112
to make it easier to deal with inputs that allow any `ArrayBuffer`-backed
113113
object.
114114

115-
### `AllocatedBuffer`
116-
117-
The `AllocatedBuffer` utility is defined in `allocated_buffer.h` and is not
118-
specific to `src/crypto`. It is used extensively within `src/crypto` to hold
119-
allocated data that is intended to be output in response to various
120-
crypto functions (generated hash values, or ciphertext, for instance).
121-
122-
_Currently, we are working to transition away from using `AllocatedBuffer`
123-
to directly using the `v8::BackingStore` API. This will take some time.
124-
New uses of `AllocatedBuffer` should be avoided if possible._
125-
126115
### Key objects
127116

128117
Most crypto operations involve the use of keys -- cryptographic inputs

src/crypto/crypto_aes.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#include "crypto/crypto_aes.h"
2+
#include "async_wrap-inl.h"
3+
#include "base_object-inl.h"
24
#include "crypto/crypto_cipher.h"
35
#include "crypto/crypto_keys.h"
46
#include "crypto/crypto_util.h"
5-
#include "allocated_buffer-inl.h"
6-
#include "async_wrap-inl.h"
7-
#include "base_object-inl.h"
87
#include "env-inl.h"
98
#include "memory_tracker-inl.h"
109
#include "threadpoolwork-inl.h"
@@ -30,7 +29,7 @@ namespace crypto {
3029
namespace {
3130
// Implements general AES encryption and decryption for CBC
3231
// The key_data must be a secret key.
33-
// On success, this function sets out to a new AllocatedBuffer
32+
// On success, this function sets out to a new ByteSource
3433
// instance containing the results and returns WebCryptoCipherStatus::OK.
3534
WebCryptoCipherStatus AES_Cipher(
3635
Environment* env,

src/crypto/crypto_aes.h

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "crypto/crypto_cipher.h"
77
#include "crypto/crypto_keys.h"
88
#include "crypto/crypto_util.h"
9-
#include "allocated_buffer.h"
109
#include "env.h"
1110
#include "v8.h"
1211

src/crypto/crypto_bio.cc

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "crypto/crypto_bio.h"
2323
#include "base_object-inl.h"
2424
#include "memory_tracker-inl.h"
25-
#include "allocated_buffer-inl.h"
2625
#include "util-inl.h"
2726

2827
#include <openssl/bio.h>

src/crypto/crypto_cipher.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "crypto/crypto_cipher.h"
2-
#include "crypto/crypto_util.h"
3-
#include "allocated_buffer-inl.h"
42
#include "base_object-inl.h"
3+
#include "crypto/crypto_util.h"
54
#include "env-inl.h"
65
#include "memory_tracker-inl.h"
76
#include "node_buffer.h"

src/crypto/crypto_common.cc

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "allocated_buffer-inl.h"
21
#include "base_object-inl.h"
32
#include "env-inl.h"
43
#include "node_buffer.h"

src/crypto/crypto_dh.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#include "crypto/crypto_dh.h"
2-
#include "crypto/crypto_keys.h"
3-
#include "crypto/crypto_groups.h"
4-
#include "allocated_buffer-inl.h"
52
#include "async_wrap-inl.h"
63
#include "base_object-inl.h"
4+
#include "crypto/crypto_groups.h"
5+
#include "crypto/crypto_keys.h"
76
#include "env-inl.h"
87
#include "memory_tracker-inl.h"
98
#include "threadpoolwork-inl.h"

src/crypto/crypto_ec.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#include "crypto/crypto_ec.h"
2-
#include "crypto/crypto_common.h"
3-
#include "crypto/crypto_util.h"
4-
#include "allocated_buffer-inl.h"
52
#include "async_wrap-inl.h"
63
#include "base_object-inl.h"
4+
#include "crypto/crypto_common.h"
5+
#include "crypto/crypto_util.h"
76
#include "env-inl.h"
87
#include "memory_tracker-inl.h"
98
#include "node_buffer.h"

src/crypto/crypto_ec.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33

44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

6-
#include "crypto/crypto_keys.h"
7-
#include "crypto/crypto_keygen.h"
8-
#include "crypto/crypto_util.h"
9-
#include "allocated_buffer.h"
106
#include "async_wrap.h"
117
#include "base_object.h"
8+
#include "crypto/crypto_keygen.h"
9+
#include "crypto/crypto_keys.h"
10+
#include "crypto/crypto_util.h"
1211
#include "env.h"
1312
#include "memory_tracker.h"
1413
#include "node_internals.h"

src/crypto/crypto_hash.cc

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "crypto/crypto_hash.h"
2-
#include "allocated_buffer-inl.h"
32
#include "async_wrap-inl.h"
43
#include "base_object-inl.h"
54
#include "env-inl.h"

src/crypto/crypto_hash.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

6+
#include "base_object.h"
67
#include "crypto/crypto_keys.h"
78
#include "crypto/crypto_util.h"
8-
#include "allocated_buffer.h"
9-
#include "base_object.h"
109
#include "env.h"
1110
#include "memory_tracker.h"
1211
#include "v8.h"

src/crypto/crypto_hkdf.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#include "crypto/crypto_hkdf.h"
2-
#include "crypto/crypto_keys.h"
3-
#include "allocated_buffer-inl.h"
42
#include "async_wrap-inl.h"
53
#include "base_object-inl.h"
4+
#include "crypto/crypto_keys.h"
65
#include "env-inl.h"
76
#include "memory_tracker-inl.h"
87
#include "threadpoolwork-inl.h"

src/crypto/crypto_hkdf.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

6-
#include "crypto/crypto_keys.h"
7-
#include "crypto/crypto_util.h"
8-
#include "allocated_buffer.h"
96
#include "async_wrap.h"
107
#include "base_object.h"
8+
#include "crypto/crypto_keys.h"
9+
#include "crypto/crypto_util.h"
1110
#include "v8.h"
1211

1312
namespace node {

src/crypto/crypto_hmac.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#include "crypto/crypto_hmac.h"
2+
#include "async_wrap-inl.h"
3+
#include "base_object-inl.h"
24
#include "crypto/crypto_keys.h"
35
#include "crypto/crypto_sig.h"
46
#include "crypto/crypto_util.h"
5-
#include "allocated_buffer-inl.h"
6-
#include "async_wrap-inl.h"
7-
#include "base_object-inl.h"
87
#include "env-inl.h"
98
#include "memory_tracker-inl.h"
109
#include "node_buffer.h"

src/crypto/crypto_hmac.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

6+
#include "base_object.h"
67
#include "crypto/crypto_keys.h"
78
#include "crypto/crypto_sig.h"
89
#include "crypto/crypto_util.h"
9-
#include "allocated_buffer.h"
10-
#include "base_object.h"
1110
#include "env.h"
1211
#include "memory_tracker.h"
1312
#include "v8.h"

src/crypto/crypto_keygen.cc

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "crypto/crypto_keygen.h"
2-
#include "allocated_buffer-inl.h"
32
#include "async_wrap-inl.h"
43
#include "base_object-inl.h"
54
#include "debug_utils-inl.h"

src/crypto/crypto_keygen.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
55

6-
#include "crypto/crypto_keys.h"
7-
#include "crypto/crypto_util.h"
8-
#include "allocated_buffer.h"
96
#include "async_wrap.h"
107
#include "base_object.h"
8+
#include "crypto/crypto_keys.h"
9+
#include "crypto/crypto_util.h"
1110
#include "env.h"
1211
#include "memory_tracker.h"
1312
#include "v8.h"

0 commit comments

Comments
 (0)