Skip to content

Commit 558bbab

Browse files
authored
Regenerated ffi bindings (#47)
* Regenerated ffi bindings * Fix lints
1 parent ae7fb13 commit 558bbab

36 files changed

+421
-840
lines changed

lib/src/boringssl/bindings/ffigen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: WebCrypto
22
description: 'Bindings to src/webcrypto.h.'
3-
output: 'lib/src/boringssl/bindings/generated_bindings.dart'
3+
output: generated_bindings.dart
44
headers:
55
entry-points:
6-
- src/webcrypto.h
6+
- ../../../../src/webcrypto.h
77
comments:
88
style: any
99
length: full

lib/src/boringssl/lookup/symbols.generated.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// ignore_for_file: constant_identifier_names
16+
1517
/// **GENERATED FILE DO NOT MODIFY**
1618
///
1719
/// This file is generated from `src/symbols.yaml` using:

lib/src/impl_ffi/impl_ffi.aes_common.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Uint8List _aesImportRawKey(List<int> keyData) {
2222
throw UnsupportedError('192-bit AES keys are not supported');
2323
}
2424
if (keyData.length != 16 && keyData.length != 32) {
25-
throw FormatException('keyData for AES must be 128 or 256 bits');
25+
throw const FormatException('keyData for AES must be 128 or 256 bits');
2626
}
2727
return Uint8List.fromList(keyData);
2828
}
@@ -86,7 +86,7 @@ Uint8List _aesGenerateKey(int length) {
8686
throw UnsupportedError('192-bit AES keys are not supported');
8787
}
8888
if (length != 128 && length != 256) {
89-
throw FormatException('keyData for AES must be 128 or 256 bits');
89+
throw const FormatException('keyData for AES must be 128 or 256 bits');
9090
}
9191
final keyData = Uint8List(length ~/ 8);
9292
fillRandomBytes(keyData);

lib/src/impl_ffi/impl_ffi.aescbc.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// ignore_for_file: non_constant_identifier_names
16+
1517
part of impl_ffi;
1618

1719
Future<AesCbcSecretKey> aesCbc_importRawKey(List<int> keyData) async =>

lib/src/impl_ffi/impl_ffi.aesctr.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// ignore_for_file: non_constant_identifier_names
16+
1517
part of impl_ffi;
1618

1719
Future<AesCtrSecretKey> aesCtr_importRawKey(List<int> keyData) async =>
@@ -66,7 +68,7 @@ Stream<Uint8List> _aesCtrEncryptOrDecrypt(
6668
assert(key.length == 16 || key.length == 32);
6769
final cipher =
6870
key.length == 16 ? ssl.EVP_aes_128_ctr() : ssl.EVP_aes_256_ctr();
69-
final blockSize = AES_BLOCK_SIZE;
71+
const blockSize = AES_BLOCK_SIZE;
7072

7173
// Find the number of possible counter values, as the counter may not be
7274
// reused this will limit how much data we can process. If we get more data
@@ -129,7 +131,9 @@ Stream<Uint8List> _aesCtrEncryptOrDecrypt(
129131
M = data.length - offset;
130132
// Do not consume more bytes than allowed after wrap-around
131133
if (bytes_after_wraparound.toInt() < M) {
132-
throw FormatException('input is too large for the counter length');
134+
throw const FormatException(
135+
'input is too large for the counter length',
136+
);
133137
}
134138
bytes_after_wraparound -= BigInt.from(M);
135139
}

lib/src/impl_ffi/impl_ffi.aesgcm.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// ignore_for_file: non_constant_identifier_names
16+
1517
part of impl_ffi;
1618

1719
Future<AesGcmSecretKey> aesGcm_importRawKey(List<int> keyData) async =>

lib/src/impl_ffi/impl_ffi.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
// ignore_for_file: non_constant_identifier_names
16+
1617
library impl_ffi;
1718

1819
import 'dart:async';

lib/src/impl_ffi/impl_ffi.digest.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class _Hash implements Hash {
3434
ffi.Pointer<EVP_MD> Function() get _algorithm;
3535

3636
/// Get an instantiated [EVP_MD] for this hash algorithm.
37-
ffi.Pointer<EVP_MD> get MD {
37+
ffi.Pointer<EVP_MD> get _md {
3838
final md = _algorithm();
3939
_checkOp(md.address != 0, fallback: 'failed to instantiate hash algorithm');
4040
return md;
@@ -52,7 +52,7 @@ abstract class _Hash implements Hash {
5252
ArgumentError.checkNotNull(data, 'data');
5353

5454
return await _withEVP_MD_CTX((ctx) async {
55-
_checkOp(ssl.EVP_DigestInit(ctx, MD) == 1);
55+
_checkOp(ssl.EVP_DigestInit(ctx, _md) == 1);
5656
await _streamToUpdate(data, ctx, ssl.EVP_DigestUpdate);
5757
final size = ssl.EVP_MD_CTX_size(ctx);
5858
_checkOp(size > 0);

lib/src/impl_ffi/impl_ffi.ecdh.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// ignore_for_file: non_constant_identifier_names
16+
1517
part of impl_ffi;
1618

1719
Future<EcdhPrivateKey> ecdhPrivateKey_importPkcs8Key(

lib/src/impl_ffi/impl_ffi.ecdsa.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// ignore_for_file: non_constant_identifier_names
16+
1517
part of impl_ffi;
1618

1719
/// Get valid value for `jwk.alg` property given an [EllipticCurve] for ECDSA.
@@ -208,13 +210,13 @@ class _EcdsaPrivateKey implements EcdsaPrivateKey {
208210
Future<Uint8List> signStream(Stream<List<int>> data, Hash hash) async {
209211
ArgumentError.checkNotNull(data, 'data');
210212
ArgumentError.checkNotNull(hash, 'hash');
211-
final _hash = _Hash.fromHash(hash).MD;
213+
final md = _Hash.fromHash(hash)._md;
212214

213215
final sig = await _withEVP_MD_CTX((ctx) async {
214216
_checkOpIsOne(ssl.EVP_DigestSignInit.invoke(
215217
ctx,
216218
ffi.nullptr,
217-
_hash,
219+
md,
218220
ffi.nullptr,
219221
_key,
220222
));
@@ -266,7 +268,7 @@ class _EcdsaPublicKey implements EcdsaPublicKey {
266268
ArgumentError.checkNotNull(signature, 'signature');
267269
ArgumentError.checkNotNull(data, 'data');
268270
ArgumentError.checkNotNull(hash, 'hash');
269-
final _hash = _Hash.fromHash(hash).MD;
271+
final md = _Hash.fromHash(hash)._md;
270272

271273
// Convert to DER signature
272274
final sig = _convertEcdsaWebCryptoSignatureToDerSignature(_key, signature);
@@ -280,7 +282,7 @@ class _EcdsaPublicKey implements EcdsaPublicKey {
280282
_checkOpIsOne(ssl.EVP_DigestVerifyInit.invoke(
281283
ctx,
282284
pctx,
283-
_hash,
285+
md,
284286
ffi.nullptr,
285287
_key,
286288
));

0 commit comments

Comments
 (0)