Skip to content

Commit f7f5ca8

Browse files
update lib and usage (#35)
1 parent 0e3a968 commit f7f5ca8

11 files changed

+308
-157
lines changed

examples/Azure_IoT_Adu_ESP32/Azure_IoT_Adu_ESP32.ino

+122-17
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,14 @@
6464
#define ADU_DEVICE_SHA_SIZE 32
6565
#define ADU_SHA_PARTITION_READ_BUFFER_SIZE 32
6666
#define HTTP_DOWNLOAD_CHUNK 4096
67-
#define ADU_PNP_ACCEPT_CODE 200
68-
#define ADU_PNP_REJECT_CODE 406
6967

7068
// ADU Feature Values
7169
static az_iot_adu_client adu_client;
7270
static az_iot_adu_client_update_request adu_update_request;
7371
static az_iot_adu_client_update_manifest adu_update_manifest;
7472
static char adu_new_version[16];
7573
static bool process_update_request = false;
74+
static bool send_init_state = true;
7675
static bool did_update = false;
7776
static char adu_scratch_buffer[10000];
7877
static char adu_manifest_unescape_buffer[2000];
@@ -83,12 +82,7 @@ static char partition_read_buffer[ADU_SHA_PARTITION_READ_BUFFER_SIZE];
8382
static int chunked_data_index;
8483

8584
static az_span pnp_components[] = { AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_PROPERTIES_COMPONENT_NAME) };
86-
az_iot_adu_client_device_properties adu_device_information
87-
= { .manufacturer = AZ_SPAN_LITERAL_FROM_STR(ADU_DEVICE_MANUFACTURER),
88-
.model = AZ_SPAN_LITERAL_FROM_STR(ADU_DEVICE_MODEL),
89-
.adu_version = AZ_SPAN_LITERAL_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_VERSION),
90-
.delivery_optimization_agent_version = AZ_SPAN_EMPTY,
91-
.update_id = AZ_SPAN_LITERAL_FROM_STR(ADU_UPDATE_ID) };
85+
static az_iot_adu_client_device_properties adu_device_information;
9286

9387
// Utility macros and defines
9488
#define sizeofarray(a) (sizeof(a) / sizeof(a[0]))
@@ -142,6 +136,90 @@ static AzIoTSasToken sasToken(
142136
AZ_SPAN_FROM_BUFFER(mqtt_password));
143137
#endif // IOT_CONFIG_USE_X509_CERT
144138

139+
/* Azure Device Update root keys used to verify the signed deployment */
140+
/* ADU.200702.R */
141+
static uint8_t ucAzureIoTADURootKeyId200702[ 13 ] = "ADU.200702.R";
142+
static uint8_t ucAzureIoTADURootKeyN200702[ 385 ]
143+
=
144+
{
145+
0x00, 0xd5, 0x42, 0x2e, 0xaf, 0x11, 0x54, 0xa3, 0x50, 0x65, 0x87, 0xa2, 0x4d, 0x5b, 0xba,
146+
0x1a, 0xfb, 0xa9, 0x32, 0xdf, 0xe9, 0x99, 0x5f, 0x05, 0x45, 0xc8, 0xaf, 0xbd, 0x35, 0x1d,
147+
0x89, 0xe8, 0x27, 0x27, 0x58, 0xa3, 0xa8, 0xee, 0xc5, 0xc5, 0x1e, 0x4f, 0xf7, 0x92, 0xa6,
148+
0x12, 0x06, 0x7d, 0x3d, 0x7d, 0xb0, 0x07, 0xf6, 0x2c, 0x7f, 0xde, 0x6d, 0x2a, 0xf5, 0xbc,
149+
0x49, 0xbc, 0x15, 0xef, 0xf0, 0x81, 0xcb, 0x3f, 0x88, 0x4f, 0x27, 0x1d, 0x88, 0x71, 0x28,
150+
0x60, 0x08, 0xb6, 0x19, 0xd2, 0xd2, 0x39, 0xd0, 0x05, 0x1f, 0x3c, 0x76, 0x86, 0x71, 0xbb,
151+
0x59, 0x58, 0xbc, 0xb1, 0x88, 0x7b, 0xab, 0x56, 0x28, 0xbf, 0x31, 0x73, 0x44, 0x32, 0x10,
152+
0xfd, 0x3d, 0xd3, 0x96, 0x5c, 0xff, 0x4e, 0x5c, 0xb3, 0x6b, 0xff, 0x8b, 0x84, 0x9b, 0x8b,
153+
0x80, 0xb8, 0x49, 0xd0, 0x7d, 0xfa, 0xd6, 0x40, 0x58, 0x76, 0x4d, 0xc0, 0x72, 0x27, 0x75,
154+
0xcb, 0x9a, 0x2f, 0x9b, 0xb4, 0x9f, 0x0f, 0x25, 0xf1, 0x1c, 0xc5, 0x1b, 0x0b, 0x5a, 0x30,
155+
0x7d, 0x2f, 0xb8, 0xef, 0xa7, 0x26, 0x58, 0x53, 0xaf, 0xd5, 0x1d, 0x55, 0x01, 0x51, 0x0d,
156+
0xe9, 0x1b, 0xa2, 0x0f, 0x3f, 0xd7, 0xe9, 0x1d, 0x20, 0x41, 0xa6, 0xe6, 0x14, 0x0a, 0xae,
157+
0xfe, 0xf2, 0x1c, 0x2a, 0xd6, 0xe4, 0x04, 0x7b, 0xf6, 0x14, 0x7e, 0xec, 0x0f, 0x97, 0x83,
158+
0xfa, 0x58, 0xfa, 0x81, 0x36, 0x21, 0xb9, 0xa3, 0x2b, 0xfa, 0xd9, 0x61, 0x0b, 0x1a, 0x94,
159+
0xf7, 0xc1, 0xbe, 0x7f, 0x40, 0x14, 0x4a, 0xc9, 0xfa, 0x35, 0x7f, 0xef, 0x66, 0x70, 0x00,
160+
0xb1, 0xfd, 0xdb, 0xd7, 0x61, 0x0d, 0x3b, 0x58, 0x74, 0x67, 0x94, 0x89, 0x75, 0x76, 0x96,
161+
0x7c, 0x91, 0x87, 0xd2, 0x8e, 0x11, 0x97, 0xee, 0x7b, 0x87, 0x6c, 0x9a, 0x2f, 0x45, 0xd8,
162+
0x65, 0x3f, 0x52, 0x70, 0x98, 0x2a, 0xcb, 0xc8, 0x04, 0x63, 0xf5, 0xc9, 0x47, 0xcf, 0x70,
163+
0xf4, 0xed, 0x64, 0xa7, 0x74, 0xa5, 0x23, 0x8f, 0xb6, 0xed, 0xf7, 0x1c, 0xd3, 0xb0, 0x1c,
164+
0x64, 0x57, 0x12, 0x5a, 0xa9, 0x81, 0x84, 0x1f, 0xa0, 0xe7, 0x50, 0x19, 0x96, 0xb4, 0x82,
165+
0xb1, 0xac, 0x48, 0xe3, 0xe1, 0x32, 0x82, 0xcb, 0x40, 0x1f, 0xac, 0xc4, 0x59, 0xbc, 0x10,
166+
0x34, 0x51, 0x82, 0xf9, 0x28, 0x8d, 0xa8, 0x1e, 0x9b, 0xf5, 0x79, 0x45, 0x75, 0xb2, 0xdc,
167+
0x9a, 0x11, 0x43, 0x08, 0xbe, 0x61, 0xcc, 0x9a, 0xc4, 0xcb, 0x77, 0x36, 0xff, 0x83, 0xdd,
168+
0xa8, 0x71, 0x4f, 0x51, 0x8e, 0x0e, 0x7b, 0x4d, 0xfa, 0x79, 0x98, 0x8d, 0xbe, 0xfc, 0x82,
169+
0x7e, 0x40, 0x48, 0xa9, 0x12, 0x01, 0xa8, 0xd9, 0x7e, 0xf3, 0xa5, 0x1b, 0xf1, 0xfb, 0x90,
170+
0x77, 0x3e, 0x40, 0x87, 0x18, 0xc9, 0xab, 0xd9, 0xf7, 0x79
171+
};
172+
static uint8_t ucAzureIoTADURootKeyE200702[ 3 ] = { 0x01, 0x00, 0x01 };
173+
174+
/* ADU.200703.R */
175+
static uint8_t ucAzureIoTADURootKeyId200703[ 13 ] = "ADU.200703.R";
176+
static uint8_t ucAzureIoTADURootKeyN200703[ 385 ] =
177+
{
178+
0x00, 0xb2, 0xa3, 0xb2, 0x74, 0x16, 0xfa, 0xbb, 0x20, 0xf9, 0x52, 0x76, 0xe6, 0x27, 0x3e,
179+
0x80, 0x41, 0xc6, 0xfe, 0xcf, 0x30, 0xf9, 0xc8, 0x96, 0xf5, 0x59, 0x0a, 0xaa, 0x81, 0xe7,
180+
0x51, 0x83, 0x8a, 0xc4, 0xf5, 0x17, 0x3a, 0x2f, 0x2a, 0xe6, 0x57, 0xd4, 0x71, 0xce, 0x8a,
181+
0x3d, 0xef, 0x9a, 0x55, 0x76, 0x3e, 0x99, 0xe2, 0xc2, 0xae, 0x4c, 0xee, 0x2d, 0xb8, 0x78,
182+
0xf5, 0xa2, 0x4e, 0x28, 0xf2, 0x9c, 0x4e, 0x39, 0x65, 0xbc, 0xec, 0xe4, 0x0d, 0xe5, 0xe3,
183+
0x38, 0xa8, 0x59, 0xab, 0x08, 0xa4, 0x1b, 0xb4, 0xf4, 0xa0, 0x52, 0xa3, 0x38, 0xb3, 0x46,
184+
0x21, 0x13, 0xcc, 0x3c, 0x68, 0x06, 0xde, 0xfe, 0x00, 0xa6, 0x92, 0x6e, 0xde, 0x4c, 0x47,
185+
0x10, 0xd6, 0x1c, 0x9c, 0x24, 0xf5, 0xcd, 0x70, 0xe1, 0xf5, 0x6a, 0x7c, 0x68, 0x13, 0x1d,
186+
0xe1, 0xc5, 0xf6, 0xa8, 0x4f, 0x21, 0x9f, 0x86, 0x7c, 0x44, 0xc5, 0x8a, 0x99, 0x1c, 0xc5,
187+
0xd3, 0x06, 0x9b, 0x5a, 0x71, 0x9d, 0x09, 0x1c, 0xc3, 0x64, 0x31, 0x6a, 0xc5, 0x17, 0x95,
188+
0x1d, 0x5d, 0x2a, 0xf1, 0x55, 0xc7, 0x66, 0xd4, 0xe8, 0xf5, 0xd9, 0xa9, 0x5b, 0x8c, 0xa2,
189+
0x6c, 0x62, 0x60, 0x05, 0x37, 0xd7, 0x32, 0xb0, 0x73, 0xcb, 0xf7, 0x4b, 0x36, 0x27, 0x24,
190+
0x21, 0x8c, 0x38, 0x0a, 0xb8, 0x18, 0xfe, 0xf5, 0x15, 0x60, 0x35, 0x8b, 0x35, 0xef, 0x1e,
191+
0x0f, 0x88, 0xa6, 0x13, 0x8d, 0x7b, 0x7d, 0xef, 0xb3, 0xe7, 0xb0, 0xc9, 0xa6, 0x1c, 0x70,
192+
0x7b, 0xcc, 0xf2, 0x29, 0x8b, 0x87, 0xf7, 0xbd, 0x9d, 0xb6, 0x88, 0x6f, 0xac, 0x73, 0xff,
193+
0x72, 0xf2, 0xef, 0x48, 0x27, 0x96, 0x72, 0x86, 0x06, 0xa2, 0x5c, 0xe3, 0x7d, 0xce, 0xb0,
194+
0x9e, 0xe5, 0xc2, 0xd9, 0x4e, 0xc4, 0xf3, 0x7f, 0x78, 0x07, 0x4b, 0x65, 0x88, 0x45, 0x0c,
195+
0x11, 0xe5, 0x96, 0x56, 0x34, 0x88, 0x2d, 0x16, 0x0e, 0x59, 0x42, 0xd2, 0xf7, 0xd9, 0xed,
196+
0x1d, 0xed, 0xc9, 0x37, 0x77, 0x44, 0x7e, 0xe3, 0x84, 0x36, 0x9f, 0x58, 0x13, 0xef, 0x6f,
197+
0xe4, 0xc3, 0x44, 0xd4, 0x77, 0x06, 0x8a, 0xcf, 0x5b, 0xc8, 0x80, 0x1c, 0xa2, 0x98, 0x65,
198+
0x0b, 0x35, 0xdc, 0x73, 0xc8, 0x69, 0xd0, 0x5e, 0xe8, 0x25, 0x43, 0x9e, 0xf6, 0xd8, 0xab,
199+
0x05, 0xaf, 0x51, 0x29, 0x23, 0x55, 0x40, 0x58, 0x10, 0xea, 0xb8, 0xe2, 0xcd, 0x5d, 0x79,
200+
0xcc, 0xec, 0xdf, 0xb4, 0x5b, 0x98, 0xc7, 0xfa, 0xe3, 0xd2, 0x6c, 0x26, 0xce, 0x2e, 0x2c,
201+
0x56, 0xe0, 0xcf, 0x8d, 0xee, 0xfd, 0x93, 0x12, 0x2f, 0x00, 0x49, 0x8d, 0x1c, 0x82, 0x38,
202+
0x56, 0xa6, 0x5d, 0x79, 0x44, 0x4a, 0x1a, 0xf3, 0xdc, 0x16, 0x10, 0xb3, 0xc1, 0x2d, 0x27,
203+
0x11, 0xfe, 0x1b, 0x98, 0x05, 0xe4, 0xa3, 0x60, 0x31, 0x99
204+
};
205+
static uint8_t ucAzureIoTADURootKeyE200703[ 3 ] = { 0x01, 0x00, 0x01 };
206+
207+
static SampleJWS::RootKey xADURootKeys[] =
208+
{
209+
{
210+
// Minus one on id to not count NULL
211+
.root_key_id = az_span_create(ucAzureIoTADURootKeyId200703, sizeof(ucAzureIoTADURootKeyId200703) - 1),
212+
.root_key_n = AZ_SPAN_FROM_BUFFER(ucAzureIoTADURootKeyN200703),
213+
.root_key_exponent = AZ_SPAN_FROM_BUFFER(ucAzureIoTADURootKeyE200703)
214+
},
215+
{
216+
// Minus one on id to not count NULL
217+
.root_key_id = az_span_create(ucAzureIoTADURootKeyId200702, sizeof(ucAzureIoTADURootKeyId200702) - 1),
218+
.root_key_n = AZ_SPAN_FROM_BUFFER(ucAzureIoTADURootKeyN200702),
219+
.root_key_exponent = AZ_SPAN_FROM_BUFFER(ucAzureIoTADURootKeyE200702)
220+
}
221+
};
222+
145223
static void connect_to_wifi()
146224
{
147225
Logger.Info("Connecting to WIFI SSID " + String(ssid));
@@ -360,7 +438,7 @@ static void request_all_properties(void)
360438

361439
// send_adu_device_reported_property writes a property payload reporting device
362440
// state and then sends it to Azure IoT Hub.
363-
static void send_adu_device_information_property(int32_t agent_state, az_iot_adu_client_workflow * workflow)
441+
static void send_adu_device_information_property(az_iot_adu_client_agent_state agent_state, az_iot_adu_client_workflow * workflow)
364442
{
365443
az_result rc;
366444

@@ -423,7 +501,7 @@ static void send_adu_device_information_property(int32_t agent_state, az_iot_adu
423501
}
424502

425503
static void send_adu_accept_manifest_property(int32_t version_number,
426-
int32_t response_code)
504+
az_iot_adu_client_request_decision response_code)
427505
{
428506
az_result rc;
429507

@@ -546,7 +624,7 @@ static void process_device_property_message(
546624
}
547625
else
548626
{
549-
if(adu_update_request.workflow.action != AZ_IOT_ADU_CLIENT_SERVICE_ACTION_CANCEL)
627+
if(adu_update_request.workflow.action == AZ_IOT_ADU_CLIENT_SERVICE_ACTION_APPLY_DEPLOYMENT)
550628
{
551629
rc = az_json_string_unescape(adu_update_request.update_manifest, (char*)adu_manifest_unescape_buffer, sizeof(adu_manifest_unescape_buffer), &out_manifest_size);
552630

@@ -580,6 +658,7 @@ static void process_device_property_message(
580658
rc = SampleJWS::ManifestAuthenticate(
581659
manifest_unescaped,
582660
adu_update_request.update_manifest_signature,
661+
&xADURootKeys[0], sizeof(xADURootKeys) / sizeof(xADURootKeys[0]),
583662
AZ_SPAN_FROM_BUFFER(adu_verification_buffer));
584663
if (az_result_failed(rc))
585664
{
@@ -593,20 +672,30 @@ static void process_device_property_message(
593672
if (is_update_already_applied())
594673
{
595674
Logger.Info("Update already applied");
596-
send_adu_accept_manifest_property(version_number, ADU_PNP_REJECT_CODE);
675+
send_adu_accept_manifest_property(version_number, AZ_IOT_ADU_CLIENT_REQUEST_DECISION_REJECT);
597676
process_update_request = false;
598677
}
599678
else
600679
{
601680
Logger.Info("Sending manifest property accept");
602-
send_adu_accept_manifest_property(version_number, ADU_PNP_ACCEPT_CODE);
681+
send_adu_accept_manifest_property(version_number, AZ_IOT_ADU_CLIENT_REQUEST_DECISION_ACCEPT);
603682

604683
process_update_request = true;
605684
}
606685
}
607-
else
686+
else if (adu_update_request.workflow.action == AZ_IOT_ADU_CLIENT_SERVICE_ACTION_CANCEL)
608687
{
609688
Logger.Info("ADU action received: cancelled deployment");
689+
send_adu_device_information_property(AZ_IOT_ADU_CLIENT_AGENT_STATE_IDLE, NULL);
690+
process_update_request = false;
691+
}
692+
else
693+
{
694+
Logger.Error("Unknown workflow action received: " + String(adu_update_request.workflow.action));
695+
696+
send_adu_device_information_property(AZ_IOT_ADU_CLIENT_AGENT_STATE_FAILED, &adu_update_request.workflow);
697+
698+
process_update_request = false;
610699
}
611700
}
612701
}
@@ -985,9 +1074,16 @@ static void send_telemetry()
9851074

9861075
// Arduino setup and loop main functions.
9871076

988-
void setup() { establish_connection(); }
1077+
void setup() {
1078+
adu_device_information = az_iot_adu_client_device_properties_default();
1079+
adu_device_information.manufacturer = AZ_SPAN_FROM_STR(ADU_DEVICE_MANUFACTURER);
1080+
adu_device_information.model = AZ_SPAN_FROM_STR(ADU_DEVICE_MODEL);
1081+
adu_device_information.adu_version = AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_VERSION);
1082+
adu_device_information.delivery_optimization_agent_version = AZ_SPAN_EMPTY;
1083+
adu_device_information.update_id = AZ_SPAN_FROM_STR(ADU_UPDATE_ID);
9891084

990-
bool send_init_state = true;
1085+
establish_connection();
1086+
}
9911087

9921088
void loop()
9931089
{
@@ -1034,9 +1130,10 @@ void loop()
10341130
{
10351131
Logger.Info("Cancellation request was received during download. "
10361132
"Aborting update.");
1133+
send_adu_device_information_property(AZ_IOT_ADU_CLIENT_AGENT_STATE_IDLE, NULL);
10371134
process_update_request = false;
10381135
}
1039-
else
1136+
else if (adu_update_request.workflow.action == AZ_IOT_ADU_CLIENT_SERVICE_ACTION_APPLY_DEPLOYMENT)
10401137
{
10411138
result = verify_image(
10421139
adu_update_manifest.files[0].hashes->hash_value,
@@ -1052,6 +1149,14 @@ void loop()
10521149
esp_restart();
10531150
}
10541151
}
1152+
else
1153+
{
1154+
Logger.Error("Unknown workflow action received: " + String(adu_update_request.workflow.action));
1155+
1156+
send_adu_device_information_property(AZ_IOT_ADU_CLIENT_AGENT_STATE_FAILED, &adu_update_request.workflow);
1157+
1158+
process_update_request = false;
1159+
}
10551160
}
10561161
}
10571162
}

examples/Azure_IoT_Adu_ESP32/SampleAduJWS.cpp

+22-11
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,10 @@ static az_result base64_decode_jws_header_and_payload(jws_validation_context* ma
637637
return AZ_OK;
638638
}
639639

640-
static az_result validate_root_key(jws_validation_context* manifest_context)
640+
static az_result validate_root_key(jws_validation_context* manifest_context,
641+
SampleJWS::RootKey * root_keys,
642+
uint32_t root_keys_length,
643+
int32_t * adu_root_key_index)
641644
{
642645
az_result result;
643646
az_json_reader json_reader;
@@ -656,16 +659,16 @@ static az_result validate_root_key(jws_validation_context* manifest_context)
656659
return AZ_ERROR_ITEM_NOT_FOUND;
657660
}
658661

659-
if (!az_span_is_content_equal(
660-
az_span_create(
661-
(uint8_t*)azure_iot_adu_root_key_id, sizeof(azure_iot_adu_root_key_id) - 1),
662-
manifest_context->kid_span))
662+
for( int i = 0; i < root_keys_length; i++ )
663663
{
664-
Logger.Error("[JWS] Using the wrong root key");
665-
return AZ_ERROR_NOT_SUPPORTED;
664+
if( az_span_is_content_equal( root_keys[ i ].root_key_id, manifest_context->kid_span ) )
665+
{
666+
*adu_root_key_index = i;
667+
return AZ_OK;
668+
}
666669
}
667670

668-
return AZ_OK;
671+
return AZ_ERROR_NOT_SUPPORTED;
669672
}
670673

671674
static az_result verify_sha_match(jws_validation_context* manifest_context, az_span manifest_span)
@@ -748,11 +751,14 @@ static az_result verify_sha_match(jws_validation_context* manifest_context, az_s
748751
az_result SampleJWS::ManifestAuthenticate(
749752
az_span manifest_span,
750753
az_span jws_span,
754+
SampleJWS::RootKey * root_keys,
755+
uint32_t root_keys_length,
751756
az_span scratch_buffer_span)
752757
{
753758
az_result result;
754759
az_json_reader json_reader;
755760
jws_validation_context manifest_context = { 0 };
761+
int32_t root_key_index;
756762

757763
/* Break up scratch buffer for reusable and persistent sections */
758764
uint8_t* persistent_scratch_space_head = az_span_ptr(scratch_buffer_span);
@@ -850,7 +856,12 @@ az_result SampleJWS::ManifestAuthenticate(
850856

851857
/*------------------- Parse root key id ------------------------*/
852858

853-
validate_root_key(&manifest_context);
859+
result = validate_root_key(&manifest_context, root_keys, root_keys_length, &root_key_index );
860+
if (az_result_failed(result))
861+
{
862+
Logger.Error("[JWS] validate_root_key failed: result " + String(result, HEX));
863+
return result;
864+
}
854865

855866
/*------------------- Parse necessary pieces for signing key
856867
* ------------------------*/
@@ -884,8 +895,8 @@ az_result SampleJWS::ManifestAuthenticate(
884895
az_span_size(manifest_context.jwk_base64_encoded_header)
885896
+ az_span_size(manifest_context.jwk_base64_encoded_payload) + 1),
886897
manifest_context.jwk_signature,
887-
az_span_create((uint8_t*)azure_iot_adu_root_key_n, sizeof(azure_iot_adu_root_key_n)),
888-
az_span_create((uint8_t*)azure_iot_adu_root_key_e, sizeof(azure_iot_adu_root_key_e)),
898+
root_keys[root_key_index].root_key_n,
899+
root_keys[root_key_index].root_key_exponent,
889900
manifest_context.scratch_calculation_buffer);
890901

891902
if (result != AZ_OK)

examples/Azure_IoT_Adu_ESP32/SampleAduJWS.h

+15
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,24 @@
3737

3838
namespace SampleJWS
3939
{
40+
41+
/**
42+
* @brief Holds the values of the root key used to verify the JWS signature.
43+
*/
44+
typedef struct RootKey
45+
{
46+
az_span root_key_id;
47+
az_span root_key_n;
48+
az_span root_key_exponent;
49+
} RootKey;
50+
4051
/**
4152
* @brief Authenticate the manifest from ADU.
4253
*
4354
* @param[in] manifest_span The escaped manifest from the ADU twin property.
4455
* @param[in] jws_span The JWS used to authenticate \p manifest_span.
56+
* @param[in] root_keys An array of root keys that may be used to verify the payload.
57+
* @param[in] root_keys_length The number of root keys in \p root_keys.
4558
* @param[in] scratch_buffer_span Scratch buffer space for calculations. It
4659
* should be `jwsSCRATCH_BUFFER_SIZE` in length.
4760
* @return az_result The return value of this function.
@@ -51,6 +64,8 @@ namespace SampleJWS
5164
az_result ManifestAuthenticate(
5265
az_span manifest_span,
5366
az_span jws_span,
67+
RootKey * root_keys,
68+
uint32_t root_keys_length,
5469
az_span scratch_buffer_span);
5570
}; // namespace SampleJWS
5671

library.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=Azure SDK for C
2-
version=1.1.0-beta.1
2+
version=1.1.0-beta.2
33
author=Microsoft Corporation
44
maintainer=Microsoft Corporation <[email protected]>
55
sentence=Azure SDK for C library for Arduino.
6-
paragraph=This is an Arduino port of the Azure SDK for C (1.4.0-beta.1). It allows you to use your Arduino device with Azure services like Azure IoT Hub and Azure Device Provisioning Service. See README.md for more details. Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
6+
paragraph=This is an Arduino port of the Azure SDK for C (1.4.0-beta.2). It allows you to use your Arduino device with Azure services like Azure IoT Hub and Azure Device Provisioning Service. See README.md for more details. Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
77
category=Communication
88
url=https://github.com/Azure/azure-sdk-for-c-arduino/releases
99
architectures=*

src/az_http_policy_logging.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static az_result _az_http_policy_logging_append_http_request_msg(
7070
}
7171
else
7272
{
73-
required_length = az_span_size(request->_internal.method) + request->_internal.url_length + 1;
73+
required_length += az_span_size(request->_internal.method) + request->_internal.url_length + 1;
7474
}
7575

7676
_az_RETURN_IF_NOT_ENOUGH_SIZE(*ref_log_msg, required_length);

0 commit comments

Comments
 (0)