att_db: call write callback for validated signed writes

This commit is contained in:
Matthias Ringwald 2019-05-01 23:14:36 +02:00
parent 715a43d1c0
commit 154069291b
2 changed files with 6 additions and 11 deletions

View File

@ -6,9 +6,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased] ## [Unreleased]
### Fixed
sm: store local CSRK
### Changed ### Changed
- le_device_db: add secure_connection argument to le_device_db_encryption_set and le_device_db_encryption_get - le_device_db: add secure_connection argument to le_device_db_encryption_set and le_device_db_encryption_get
- replaced stm - replaced stm
@ -17,6 +14,8 @@ sm: store local CSRK
### Fixed ### Fixed
- SM: Use provided authentication requirements in slave security request - SM: Use provided authentication requirements in slave security request
- ESP32: use micro-ecc from 3rd-party as esp-idf removed it in their 3.3 release - ESP32: use micro-ecc from 3rd-party as esp-idf removed it in their 3.3 release
- SM: store local CSRK
- ATT DB: call write callback for validated signed writes
### Added ### Added
- SM: Track if connection encryption is based on LE Secure Connection pairing - SM: Track if connection encryption is based on LE Secure Connection pairing

View File

@ -1090,11 +1090,7 @@ static uint16_t handle_execute_write_request(att_connection_t * att_connection,
// MARK: ATT_WRITE_COMMAND 0x52 // MARK: ATT_WRITE_COMMAND 0x52
// Core 4.0, vol 3, part F, 3.4.5.3 // Core 4.0, vol 3, part F, 3.4.5.3
// "No Error Response or Write Response shall be sent in response to this command" // "No Error Response or Write Response shall be sent in response to this command"
static void handle_write_command(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len, static void handle_write_command(att_connection_t * att_connection, uint8_t * request_buffer, uint16_t request_len, uint16_t required_flags){
uint8_t * response_buffer, uint16_t response_buffer_size){
UNUSED(response_buffer);
UNUSED(response_buffer_size);
uint16_t handle = little_endian_read_16(request_buffer, 1); uint16_t handle = little_endian_read_16(request_buffer, 1);
if (!att_write_callback) return; if (!att_write_callback) return;
@ -1103,7 +1099,7 @@ static void handle_write_command(att_connection_t * att_connection, uint8_t * re
int ok = att_find_handle(&it, handle); int ok = att_find_handle(&it, handle);
if (!ok) return; if (!ok) return;
if ((it.flags & ATT_PROPERTY_DYNAMIC) == 0) return; if ((it.flags & ATT_PROPERTY_DYNAMIC) == 0) return;
if ((it.flags & ATT_PROPERTY_WRITE_WITHOUT_RESPONSE) == 0) return; if ((it.flags & required_flags) == 0) return;
if (att_validate_security(att_connection, ATT_WRITE, &it)) return; if (att_validate_security(att_connection, ATT_WRITE, &it)) return;
att_persistent_ccc_cache(&it); att_persistent_ccc_cache(&it);
(*att_write_callback)(att_connection->con_handle, handle, ATT_TRANSACTION_MODE_NONE, 0, request_buffer + 3, request_len - 3); (*att_write_callback)(att_connection->con_handle, handle, ATT_TRANSACTION_MODE_NONE, 0, request_buffer + 3, request_len - 3);
@ -1188,11 +1184,11 @@ uint16_t att_handle_request(att_connection_t * att_connection,
response_len = handle_execute_write_request(att_connection, request_buffer, request_len, response_buffer, response_buffer_size); response_len = handle_execute_write_request(att_connection, request_buffer, request_len, response_buffer, response_buffer_size);
break; break;
case ATT_WRITE_COMMAND: case ATT_WRITE_COMMAND:
handle_write_command(att_connection, request_buffer, request_len, response_buffer, response_buffer_size); handle_write_command(att_connection, request_buffer, request_len, ATT_PROPERTY_WRITE_WITHOUT_RESPONSE);
break; break;
#ifdef ENABLE_LE_SIGNED_WRITE #ifdef ENABLE_LE_SIGNED_WRITE
case ATT_SIGNED_WRITE_COMMAND: case ATT_SIGNED_WRITE_COMMAND:
log_info("handle_signed_write_command preprocessed by att_server.c"); handle_write_command(att_connection, request_buffer, request_len, ATT_PROPERTY_AUTHENTICATED_SIGNED_WRITE);
break; break;
#endif #endif
default: default: