asherah 0.2.0-arm64-darwin → 0.3.0-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/asherah/native/libasherah-arm64.dylib +0 -0
- data/lib/asherah/version.rb +1 -1
- data/lib/asherah.rb +20 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a43b4d34ccce682cf20e8e0154704be1e88f43fd83243143b1eb29cb184e5e1
|
4
|
+
data.tar.gz: 4e1f4ba3d4f67096204bc126eea95e2dcc50666ecf1dc4d3e4f2dac2108b19e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ff13c55e0d1eee27ed301a854e353fe0edc7acdbe99f9da41a1e215ee64f7311353bc45f89f1ad652508545e74e9f1949e92e50e9dd6d41ebe8c2bea47ef1c6
|
7
|
+
data.tar.gz: 63dab48dfb85fe4e794dc5a5431cf1a7e5abc2f27ff62a90d9e7cec7939e85e24e04ccdd14107274a341f9f7b1020867bcae41b93ef0ce8d4064d48bf544bc3e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.3.0] - 2022-03-22
|
4
|
+
|
5
|
+
- Free up cobhan buffers after encrypt/decrypt to prevent growing heap memory
|
6
|
+
- Use local `estimate_buffer` calculation instead of FFI call
|
7
|
+
- Upgrade to use asherah-cobhan v0.4.3
|
8
|
+
|
3
9
|
## [0.2.0] - 2022-03-21
|
4
10
|
|
5
11
|
- Implement versioning for asherah-cobhan binaries
|
Binary file
|
data/lib/asherah/version.rb
CHANGED
data/lib/asherah.rb
CHANGED
@@ -14,10 +14,13 @@ module Asherah
|
|
14
14
|
[:SetupJson, [:pointer], :int32],
|
15
15
|
[:EncryptToJson, [:pointer, :pointer, :pointer], :int32],
|
16
16
|
[:DecryptFromJson, [:pointer, :pointer, :pointer], :int32],
|
17
|
-
[:EstimateBuffer, [:int32, :int32], :int32],
|
18
17
|
[:Shutdown, [], :void]
|
19
18
|
].freeze)
|
20
19
|
|
20
|
+
ESTIMATED_ENCRYPTION_OVERHEAD = 48
|
21
|
+
ESTIMATED_ENVELOPE_OVERHEAD = 185
|
22
|
+
BASE64_OVERHEAD = 1.34
|
23
|
+
|
21
24
|
class << self
|
22
25
|
# Configures Asherah
|
23
26
|
#
|
@@ -27,6 +30,7 @@ module Asherah
|
|
27
30
|
config = Config.new
|
28
31
|
yield config
|
29
32
|
config.validate!
|
33
|
+
@intermediated_key_overhead_bytesize = config.product_id.bytesize + config.service_name.bytesize
|
30
34
|
|
31
35
|
config_buffer = string_to_cbuffer(config.to_json)
|
32
36
|
|
@@ -52,13 +56,15 @@ module Asherah
|
|
52
56
|
def encrypt(partition_id, data)
|
53
57
|
partition_id_buffer = string_to_cbuffer(partition_id)
|
54
58
|
data_buffer = string_to_cbuffer(data)
|
55
|
-
|
56
|
-
output_buffer = allocate_cbuffer(
|
59
|
+
estimated_buffer_bytesize = estimate_buffer(data.bytesize, partition_id.bytesize)
|
60
|
+
output_buffer = allocate_cbuffer(estimated_buffer_bytesize)
|
57
61
|
|
58
62
|
result = EncryptToJson(partition_id_buffer, data_buffer, output_buffer)
|
59
63
|
Error.check_result!(result, 'EncryptToJson failed')
|
60
64
|
|
61
65
|
cbuffer_to_string(output_buffer)
|
66
|
+
ensure
|
67
|
+
[partition_id_buffer, data_buffer, output_buffer].map(&:free)
|
62
68
|
end
|
63
69
|
|
64
70
|
# Decrypts a DataRowRecord in JSON format for a partition_id and returns decrypted data.
|
@@ -75,11 +81,22 @@ module Asherah
|
|
75
81
|
Error.check_result!(result, 'DecryptFromJson failed')
|
76
82
|
|
77
83
|
cbuffer_to_string(output_buffer)
|
84
|
+
ensure
|
85
|
+
[partition_id_buffer, data_buffer, output_buffer].map(&:free)
|
78
86
|
end
|
79
87
|
|
80
88
|
# Stop the Asherah instance
|
81
89
|
def shutdown
|
82
90
|
Shutdown()
|
83
91
|
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
95
|
+
def estimate_buffer(data_bytesize, partition_bytesize)
|
96
|
+
ESTIMATED_ENVELOPE_OVERHEAD +
|
97
|
+
@intermediated_key_overhead_bytesize +
|
98
|
+
partition_bytesize +
|
99
|
+
((data_bytesize + ESTIMATED_ENCRYPTION_OVERHEAD) * BASE64_OVERHEAD)
|
100
|
+
end
|
84
101
|
end
|
85
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asherah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- GoDaddy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cobhan
|