Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.4.2-wip

- Update BoringSSL to e98a6564.
- Update BoringSSL to 3fed4f20.

## 0.4.1

Expand Down
176 changes: 173 additions & 3 deletions lib/src/bindings/boringssl.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7338,6 +7338,106 @@ external void CONF_modules_unload(
int all,
);

/// CPACE_CTX_free frees `ctx` and all the resources that it has allocated.
@meta.RecordUse()
@ffi.Native<ffi.Void Function(ffi.Pointer<CPACE_CTX>)>(
symbol: 'bssl_dart_CPACE_CTX_free',
)
external void CPACE_CTX_free(
ffi.Pointer<CPACE_CTX> ctx,
);

/// CPACE_CTX_new returns a newly-allocated `CPACE_CTX` object that implements
/// one side of the CPace protocol, or nullptr on error. This function implements
/// CPACE-X25519-SHA512 in initiator-responder mode, acting as `role` and with
/// `password` as the password-related string (PRS).
///
/// `channel_id` and `session_id` are the channel identifier (CI) and session
/// identifier (sid) values, respectively. Both values must match for the
/// exchange to proceed. `assoc_data` is the cleartext associated data (ADa or
/// ADb) to be sent to the peer. These values may be empty if not used. See
/// Section 4.1 of draft-irtf-cfrg-cpace-21 for details.
///
/// The application-level identities of each party in the protocol should be
/// incorporated into either `channel_id` or each party's respective `assoc_data`
/// values. See Section 10.1 of draft-irtf-cfrg-cpace-21.
///
/// Once a `CPACE_CTX` is successfully created, the caller should call
/// `CPACE_generate_msg` to generate the message to send to the peer.
@meta.RecordUse()
@ffi.Native<
ffi.Pointer<CPACE_CTX> Function(
ffi.UnsignedInt,
ffi.Pointer<ffi.Uint8>,
ffi.Size,
ffi.Pointer<ffi.Uint8>,
ffi.Size,
ffi.Pointer<ffi.Uint8>,
ffi.Size,
ffi.Pointer<ffi.Uint8>,
ffi.Size,
)
>(symbol: 'bssl_dart_CPACE_CTX_new')
external ffi.Pointer<CPACE_CTX> CPACE_CTX_new(
int role,
ffi.Pointer<ffi.Uint8> password,
int password_len,
ffi.Pointer<ffi.Uint8> channel_id,
int channel_id_len,
ffi.Pointer<ffi.Uint8> assoc_data,
int assoc_data_len,
ffi.Pointer<ffi.Uint8> session_id,
int session_id_len,
);

/// CPACE_generate_msg generates the message to be sent to the peer. On success,
/// it writes the message to `out_msg` and returns one. Otherwise, it returns
/// zero. `ctx` must have been allocated by `CPACE_CTX_new`, with no subsequent
/// functions called on it.
///
/// `out_msg` only contains the Ya or Yb value. It does not include ADa or ADb.
/// On success, the caller should separately send `out_msg` and their
/// `assoc_data` value to the peer. It is the caller's responsibility to send
/// `assoc_data` together with `out_msg`. After receiving the peer's reply, the
/// caller should call `CPACE_process_msg` to complete the protocol.
@meta.RecordUse()
@ffi.Native<ffi.Int Function(ffi.Pointer<CPACE_CTX>, ffi.Pointer<ffi.Uint8>)>(
symbol: 'bssl_dart_CPACE_generate_msg',
)
external int CPACE_generate_msg(
ffi.Pointer<CPACE_CTX> ctx,
ffi.Pointer<ffi.Uint8> out_msg,
);

/// CPACE_process_msg processes `msg` and `peer_assoc_data` from the peer and
/// computes the shared secret, or intermediate session key (ISK). On success, it
/// writes the secret to `out_shared_secret` and returns one; it also writes a
/// derived session ID if `out_sid` is not NULL. Otherwise, it returns zero.
/// `ctx` must have successfully been passed to `CPACE_generate_msg`, with no
/// subsequent functions called on it.
///
/// `msg` should contain the peer's Ya or Yb value, and `peer_assoc_data` the
/// peer's ADa or ADb value.
@meta.RecordUse()
@ffi.Native<
ffi.Int Function(
ffi.Pointer<CPACE_CTX>,
ffi.Pointer<ffi.Uint8>,
ffi.Pointer<ffi.Uint8>,
ffi.Size,
ffi.Pointer<ffi.Uint8>,
ffi.Pointer<ffi.Uint8>,
)
>(symbol: 'bssl_dart_CPACE_process_msg')
external int CPACE_process_msg(
ffi.Pointer<CPACE_CTX> ctx,
ffi.Pointer<ffi.Uint8> in_msg,
ffi.Pointer<ffi.Uint8> peer_assoc_data,
int peer_assoc_data_len,
ffi.Pointer<ffi.Uint8> shared_secret,
ffi.Pointer<ffi.Uint8> sid_out,
);

/// CRL_DIST_POINTS_free releases memory associated with `crldp`.
@meta.RecordUse()
@ffi.Native<ffi.Void Function(ffi.Pointer<CRL_DIST_POINTS>)>(
Expand All @@ -7355,6 +7455,17 @@ external void CRL_DIST_POINTS_free(
)
external ffi.Pointer<CRL_DIST_POINTS> CRL_DIST_POINTS_new();

/// CRYPTO_BUFFER_POOL_dup_ref increments the reference count of `pool` and
/// returns the same handle. It does not mutate `pool` for thread-safety purposes
/// and may be used concurrently.
@meta.RecordUse()
@ffi.Native<
ffi.Pointer<CRYPTO_BUFFER_POOL> Function(ffi.Pointer<CRYPTO_BUFFER_POOL>)
>(symbol: 'bssl_dart_CRYPTO_BUFFER_POOL_dup_ref')
external ffi.Pointer<CRYPTO_BUFFER_POOL> CRYPTO_BUFFER_POOL_dup_ref(
ffi.Pointer<CRYPTO_BUFFER_POOL> pool,
);

/// CRYPTO_BUFFER_POOL_free decrements the reference count of `pool` and frees it
/// if the reference count drops to zero.
@meta.RecordUse()
Expand Down Expand Up @@ -8569,6 +8680,17 @@ external ffi.Pointer<DH> DSA_dup_DH(
ffi.Pointer<DSA> dsa,
);

/// DSA_dup_ref increments the reference count of `dsa` and returns the same
/// handle. It does not mutate `dsa` for thread-safety purposes and may be used
/// concurrently.
@meta.RecordUse()
@ffi.Native<ffi.Pointer<DSA> Function(ffi.Pointer<DSA>)>(
symbol: 'bssl_dart_DSA_dup_ref',
)
external ffi.Pointer<DSA> DSA_dup_ref(
ffi.Pointer<DSA> dsa,
);

/// DSA_free decrements the reference count of `dsa` and frees it if the
/// reference count drops to zero.
@meta.RecordUse()
Expand Down Expand Up @@ -9664,6 +9786,17 @@ external ffi.Pointer<EC_KEY> EC_KEY_dup(
ffi.Pointer<EC_KEY> src,
);

/// EC_KEY_dup_ref increases the reference count of `key` and returns the same
/// handle. It does not mutate `key` for thread-safety purposes and may be used
/// concurrently.
@meta.RecordUse()
@ffi.Native<ffi.Pointer<EC_KEY> Function(ffi.Pointer<EC_KEY>)>(
symbol: 'bssl_dart_EC_KEY_dup_ref',
)
external ffi.Pointer<EC_KEY> EC_KEY_dup_ref(
ffi.Pointer<EC_KEY> key,
);

/// EC_KEY_free frees all the data owned by `key` and `key` itself.
@meta.RecordUse()
@ffi.Native<ffi.Void Function(ffi.Pointer<EC_KEY>)>(
Expand Down Expand Up @@ -20533,6 +20666,17 @@ external int RSA_decrypt(
int padding,
);

/// RSA_dup_ref increments the reference count of `rsa` and returns the same
/// handle. It does not mutate `rsa` for thread-safety purposes and may be used
/// concurrently.
@meta.RecordUse()
@ffi.Native<ffi.Pointer<RSA> Function(ffi.Pointer<RSA>)>(
symbol: 'bssl_dart_RSA_dup_ref',
)
external ffi.Pointer<RSA> RSA_dup_ref(
ffi.Pointer<RSA> rsa,
);

/// RSA_encrypt encrypts `in_len` bytes from `in` to the public key from `rsa`
/// and writes, at most, `max_out` bytes of encrypted data to `out`. The
/// `max_out` argument must be, at least, `RSA_size` in order to ensure success.
Expand Down Expand Up @@ -25986,6 +26130,16 @@ external ffi.Pointer<X509_LOOKUP> X509_STORE_add_lookup(
ffi.Pointer<X509_LOOKUP_METHOD> method,
);

/// X509_STORE_dup_ref adds one to the reference count of `store` and returns
/// the same handle.
@meta.RecordUse()
@ffi.Native<ffi.Pointer<X509_STORE> Function(ffi.Pointer<X509_STORE>)>(
symbol: 'bssl_dart_X509_STORE_dup_ref',
)
external ffi.Pointer<X509_STORE> X509_STORE_dup_ref(
ffi.Pointer<X509_STORE> store,
);

/// X509_STORE_free releases memory associated with `store`.
@meta.RecordUse()
@ffi.Native<ffi.Void Function(ffi.Pointer<X509_STORE>)>(
Expand Down Expand Up @@ -31827,6 +31981,9 @@ extension SymbolAddresses on _SymbolAddresses {
ffi.Pointer<ffi.NativeFunction<ffi.Void Function()>> get CONF_modules_free =>
ffi.Native.addressOf(self.CONF_modules_free);
@meta.RecordUse()
ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<CPACE_CTX>)>>
get CPACE_CTX_free => ffi.Native.addressOf(self.CPACE_CTX_free);
@meta.RecordUse()
ffi.Pointer<
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<CRL_DIST_POINTS>)>
>
Expand Down Expand Up @@ -32309,6 +32466,8 @@ const int CBS_ASN1_PRINTABLESTRING = 19;

const int CBS_ASN1_PRIVATE = 3221225472;

const int CBS_ASN1_RELATIVE_OID = 13;

const int CBS_ASN1_SEQUENCE = 536870928;

const int CBS_ASN1_SET = 536870929;
Expand Down Expand Up @@ -32348,6 +32507,7 @@ final class CMS_SignerInfo_st extends ffi.Opaque {}

typedef CONF = conf_st;
typedef CONF_VALUE = conf_value_st;
typedef CPACE_CTX = cpace_ctx_st;
typedef CRL_DIST_POINTS = stack_st_DIST_POINT;
typedef CRYPTO_BUFFER = crypto_buffer_st;
typedef CRYPTO_BUFFER_POOL = crypto_buffer_pool_st;
Expand Down Expand Up @@ -32447,9 +32607,6 @@ final class DIST_POINT_NAME_st extends ffi.Struct {
external int type;

external UnnamedUnion$4 name;

/// If relativename then this contains the full distribution point name
external ffi.Pointer<X509_NAME> dpname;
}

/// A DIST_POINT_st, aka `DIST_POINT`, represents a DistributionPoint structure
Expand Down Expand Up @@ -35725,6 +35882,8 @@ const int V_ASN1_PRIVATE = 192;

const int V_ASN1_REAL = 9;

const int V_ASN1_RELATIVE_OID = 13;

const int V_ASN1_SEQUENCE = 16;

const int V_ASN1_SET = 17;
Expand Down Expand Up @@ -37131,6 +37290,17 @@ typedef cookie_write_function_t =
)
>;

final class cpace_ctx_st extends ffi.Opaque {}

/// The role that a party plays in the CPACE key agreement protocol.
sealed class cpace_role_t {
/// This role corresponds to the party A in the specification.
static const cpace_role_initiator = 0;

/// This role corresponds to the party B in the specification.
static const cpace_role_responder = 1;
}

final class crypto_buffer_pool_st extends ffi.Opaque {}

final class crypto_buffer_st extends ffi.Opaque {}
Expand Down
9 changes: 9 additions & 0 deletions lib/src/bindings/record_use_mapping.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,13 @@ const recordUseMapping = {
'CONF_modules_free': 'bssl_dart_CONF_modules_free',
'CONF_modules_load_file': 'bssl_dart_CONF_modules_load_file',
'CONF_modules_unload': 'bssl_dart_CONF_modules_unload',
'CPACE_CTX_free': 'bssl_dart_CPACE_CTX_free',
'CPACE_CTX_new': 'bssl_dart_CPACE_CTX_new',
'CPACE_generate_msg': 'bssl_dart_CPACE_generate_msg',
'CPACE_process_msg': 'bssl_dart_CPACE_process_msg',
'CRL_DIST_POINTS_free': 'bssl_dart_CRL_DIST_POINTS_free',
'CRL_DIST_POINTS_new': 'bssl_dart_CRL_DIST_POINTS_new',
'CRYPTO_BUFFER_POOL_dup_ref': 'bssl_dart_CRYPTO_BUFFER_POOL_dup_ref',
'CRYPTO_BUFFER_POOL_free': 'bssl_dart_CRYPTO_BUFFER_POOL_free',
'CRYPTO_BUFFER_POOL_new': 'bssl_dart_CRYPTO_BUFFER_POOL_new',
'CRYPTO_BUFFER_POOL_up_ref': 'bssl_dart_CRYPTO_BUFFER_POOL_up_ref',
Expand Down Expand Up @@ -642,6 +647,7 @@ const recordUseMapping = {
'DSA_do_sign': 'bssl_dart_DSA_do_sign',
'DSA_do_verify': 'bssl_dart_DSA_do_verify',
'DSA_dup_DH': 'bssl_dart_DSA_dup_DH',
'DSA_dup_ref': 'bssl_dart_DSA_dup_ref',
'DSA_free': 'bssl_dart_DSA_free',
'DSA_generate_key': 'bssl_dart_DSA_generate_key',
'DSA_generate_parameters_ex': 'bssl_dart_DSA_generate_parameters_ex',
Expand Down Expand Up @@ -715,6 +721,7 @@ const recordUseMapping = {
'EC_KEY_check_key': 'bssl_dart_EC_KEY_check_key',
'EC_KEY_derive_from_secret': 'bssl_dart_EC_KEY_derive_from_secret',
'EC_KEY_dup': 'bssl_dart_EC_KEY_dup',
'EC_KEY_dup_ref': 'bssl_dart_EC_KEY_dup_ref',
'EC_KEY_free': 'bssl_dart_EC_KEY_free',
'EC_KEY_generate_key': 'bssl_dart_EC_KEY_generate_key',
'EC_KEY_generate_key_fips': 'bssl_dart_EC_KEY_generate_key_fips',
Expand Down Expand Up @@ -1545,6 +1552,7 @@ const recordUseMapping = {
'RSA_check_fips': 'bssl_dart_RSA_check_fips',
'RSA_check_key': 'bssl_dart_RSA_check_key',
'RSA_decrypt': 'bssl_dart_RSA_decrypt',
'RSA_dup_ref': 'bssl_dart_RSA_dup_ref',
'RSA_encrypt': 'bssl_dart_RSA_encrypt',
'RSA_flags': 'bssl_dart_RSA_flags',
'RSA_free': 'bssl_dart_RSA_free',
Expand Down Expand Up @@ -1900,6 +1908,7 @@ const recordUseMapping = {
'X509_STORE_add_cert': 'bssl_dart_X509_STORE_add_cert',
'X509_STORE_add_crl': 'bssl_dart_X509_STORE_add_crl',
'X509_STORE_add_lookup': 'bssl_dart_X509_STORE_add_lookup',
'X509_STORE_dup_ref': 'bssl_dart_X509_STORE_dup_ref',
'X509_STORE_free': 'bssl_dart_X509_STORE_free',
'X509_STORE_get0_objects': 'bssl_dart_X509_STORE_get0_objects',
'X509_STORE_get0_param': 'bssl_dart_X509_STORE_get0_param',
Expand Down
2 changes: 1 addition & 1 deletion third_party/boringssl/gen/bcm/aesni-gcm-x86_64-win.asm
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ $L$one_lsb:
DB 89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112
DB 114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
ALIGN 64
section .text
section .text code align=64

section .pdata rdata align=4
ALIGN 4
Expand Down
6 changes: 3 additions & 3 deletions third_party/boringssl/gen/bcm/aesni-x86_64-win.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2499,7 +2499,7 @@ $L$key_rcon1b:
DB 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115
DB 115,108,46,111,114,103,62,0
ALIGN 64
section .text
section .text code align=64

EXTERN __imp_RtlVirtualUnwind

Expand Down Expand Up @@ -2695,7 +2695,7 @@ $L$SEH_info_ctr32:
$L$SEH_info_cbc:
DB 9,0,0,0
DD cbc_se_handler wrt ..imagebase
section .pdata
section .pdata rdata align=4
ALIGN 4
DD $L$SEH_begin_aes_hw_set_encrypt_key_base_1 wrt ..imagebase
DD $L$SEH_end_aes_hw_set_encrypt_key_base_4 wrt ..imagebase
Expand All @@ -2706,7 +2706,7 @@ ALIGN 4
DD $L$SEH_info_aes_hw_set_encrypt_key_alt_0 wrt ..imagebase


section .xdata
section .xdata rdata align=8
ALIGN 4
$L$SEH_info_aes_hw_set_encrypt_key_base_0:
DB 1 ; version 1, no flags
Expand Down
2 changes: 1 addition & 1 deletion third_party/boringssl/gen/bcm/ghash-ssse3-x86_64-win.asm
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ $L$reverse_bytes:
; .Llow4_mask is an XMM mask which selects the low four bits of each byte.
$L$low4_mask:
DQ 0x0f0f0f0f0f0f0f0f,0x0f0f0f0f0f0f0f0f
section .text
section .text code align=64

section .pdata rdata align=4
ALIGN 4
Expand Down
2 changes: 1 addition & 1 deletion third_party/boringssl/gen/bcm/ghash-x86_64-win.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ ALIGN 64
DB 60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111
DB 114,103,62,0
ALIGN 64
section .text
section .text code align=64

section .pdata rdata align=4
ALIGN 4
Expand Down
2 changes: 1 addition & 1 deletion third_party/boringssl/gen/bcm/p256-x86_64-asm-win.asm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $L$ord:
DQ 0xf3b9cac2fc632551,0xbce6faada7179e84,0xffffffffffffffff,0xffffffff00000000
$L$ordK:
DQ 0xccd1c8aaee00bc4f
section .text
section .text code align=64


; ###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion third_party/boringssl/gen/bcm/rsaz-avx2-win.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@ $L$inc:
DD 2,2,2,2,3,3,3,3
DD 4,4,4,4,4,4,4,4
ALIGN 64
section .text
section .text code align=64

EXTERN __imp_RtlVirtualUnwind

Expand Down
2 changes: 1 addition & 1 deletion third_party/boringssl/gen/bcm/sha1-x86_64-win.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5560,7 +5560,7 @@ K_XX_XX:
DB 97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114
DB 103,62,0
ALIGN 64
section .text
section .text code align=64

EXTERN __imp_RtlVirtualUnwind

Expand Down
Loading