Normalized all #includes
Convention is that every *.cpp references, in this order: 1) Any required core librries 2) Its own *.h (i.e. Foo.cpp -> Foo.h) 3) All other *.h files needed by the cpp, UNLESS those *.h files are already in its own *.h file. Must include all *.h files that are not in its own *.h file even if it is others that are referenced.
This commit is contained in:
parent
606601f447
commit
ba66c6f01a
19
src/HAP.cpp
19
src/HAP.cpp
|
|
@ -3,6 +3,7 @@
|
|||
#include <sodium.h>
|
||||
|
||||
#include "HAP.h"
|
||||
#include "HomeSpan.h"
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
|
|
@ -192,7 +193,7 @@ void HAPClient::processRequest(){
|
|||
if(!strncmp(body,"POST /pair-setup ",17) && // POST PAIR-SETUP
|
||||
strstr(body,"Content-Type: application/pairing+tlv8") && // check that content is TLV8
|
||||
tlv8.unpack(content,cLen)){ // read TLV content
|
||||
tlv8.print(); // print TLV records in form "TAG(INT) LENGTH(INT) VALUES(HEX)"
|
||||
if(homeSpan.logLevel>1) tlv8.print(); // print TLV records in form "TAG(INT) LENGTH(INT) VALUES(HEX)"
|
||||
LOG2("------------ END TLVS! ------------\n");
|
||||
|
||||
postPairSetupURL(); // process URL
|
||||
|
|
@ -202,7 +203,7 @@ void HAPClient::processRequest(){
|
|||
if(!strncmp(body,"POST /pair-verify ",18) && // POST PAIR-VERIFY
|
||||
strstr(body,"Content-Type: application/pairing+tlv8") && // check that content is TLV8
|
||||
tlv8.unpack(content,cLen)){ // read TLV content
|
||||
tlv8.print(); // print TLV records in form "TAG(INT) LENGTH(INT) VALUES(HEX)"
|
||||
if(homeSpan.logLevel>1) tlv8.print(); // print TLV records in form "TAG(INT) LENGTH(INT) VALUES(HEX)"
|
||||
LOG2("------------ END TLVS! ------------\n");
|
||||
|
||||
postPairVerifyURL(); // process URL
|
||||
|
|
@ -212,7 +213,7 @@ void HAPClient::processRequest(){
|
|||
if(!strncmp(body,"POST /pairings ",15) && // POST PAIRINGS
|
||||
strstr(body,"Content-Type: application/pairing+tlv8") && // check that content is TLV8
|
||||
tlv8.unpack(content,cLen)){ // read TLV content
|
||||
tlv8.print(); // print TLV records in form "TAG(INT) LENGTH(INT) VALUES(HEX)"
|
||||
if(homeSpan.logLevel>1) tlv8.print(); // print TLV records in form "TAG(INT) LENGTH(INT) VALUES(HEX)"
|
||||
LOG2("------------ END TLVS! ------------\n");
|
||||
|
||||
postPairingsURL(); // process URL
|
||||
|
|
@ -222,7 +223,7 @@ void HAPClient::processRequest(){
|
|||
if(!strncmp(body,"POST /pairings ",15) && // POST PAIRINGS
|
||||
strstr(body,"Content-Type: application/pairing+tlv8") && // check that content is TLV8
|
||||
tlv8.unpack(content,cLen)){ // read TLV content
|
||||
tlv8.print(); // print TLV records in form "TAG(INT) LENGTH(INT) VALUES(HEX)"
|
||||
if(homeSpan.logLevel>1) tlv8.print(); // print TLV records in form "TAG(INT) LENGTH(INT) VALUES(HEX)"
|
||||
LOG2("------------ END TLVS! ------------\n");
|
||||
|
||||
postPairingsURL(); // process URL
|
||||
|
|
@ -496,7 +497,7 @@ int HAPClient::postPairSetupURL(){
|
|||
return(0);
|
||||
}
|
||||
|
||||
tlv8.print(); // print decrypted TLV data
|
||||
if(homeSpan.logLevel>1) tlv8.print(); // print decrypted TLV data
|
||||
LOG2("------- END DECRYPTED TLVS! -------\n");
|
||||
|
||||
if(!tlv8.buf(kTLVType_Identifier) || !tlv8.buf(kTLVType_PublicKey) || !tlv8.buf(kTLVType_Signature)){
|
||||
|
|
@ -576,7 +577,7 @@ int HAPClient::postPairSetupURL(){
|
|||
|
||||
LOG2("------- ENCRYPTING SUB-TLVS -------\n");
|
||||
|
||||
tlv8.print();
|
||||
if(homeSpan.logLevel>1) tlv8.print();
|
||||
|
||||
size_t subTLVLen=tlv8.pack(NULL); // get size of buffer needed to store sub-TLV
|
||||
uint8_t subTLV[subTLVLen];
|
||||
|
|
@ -682,7 +683,7 @@ int HAPClient::postPairVerifyURL(){
|
|||
|
||||
LOG2("------- ENCRYPTING SUB-TLVS -------\n");
|
||||
|
||||
tlv8.print();
|
||||
if(homeSpan.logLevel>1) tlv8.print();
|
||||
|
||||
size_t subTLVLen=tlv8.pack(NULL); // get size of buffer needed to store sub-TLV
|
||||
uint8_t subTLV[subTLVLen];
|
||||
|
|
@ -746,7 +747,7 @@ int HAPClient::postPairVerifyURL(){
|
|||
return(0);
|
||||
}
|
||||
|
||||
tlv8.print(); // print decrypted TLV data
|
||||
if(homeSpan.logLevel>1) tlv8.print(); // print decrypted TLV data
|
||||
LOG2("------- END DECRYPTED TLVS! -------\n");
|
||||
|
||||
if(!tlv8.buf(kTLVType_Identifier) || !tlv8.buf(kTLVType_Signature)){
|
||||
|
|
@ -1278,7 +1279,7 @@ void HAPClient::tlvRespond(){
|
|||
LOG2(client.remoteIP());
|
||||
LOG2(" >>>>>>>>>>\n");
|
||||
LOG2(body);
|
||||
tlv8.print();
|
||||
if(homeSpan.logLevel>1) tlv8.print();
|
||||
|
||||
if(!cPair){ // unverified, unencrypted session
|
||||
client.print(body);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
#include <WiFi.h>
|
||||
#include <nvs.h>
|
||||
|
||||
#include "HomeSpan.h"
|
||||
#include "TLV.h"
|
||||
#include "HAPConstants.h"
|
||||
#include "HKDF.h"
|
||||
#include "SRP.h"
|
||||
#include "HomeSpan.h"
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// NONCE Structure (HAP used last 64 of 96 bits)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
#include <ESPmDNS.h>
|
||||
#include <nvs_flash.h>
|
||||
#include <sodium.h>
|
||||
#include <WiFi.h>
|
||||
|
||||
#include "HomeSpan.h"
|
||||
#include "HAP.h"
|
||||
|
||||
using namespace Utils;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
|
||||
#include <DNSServer.h>
|
||||
|
||||
#include "Network.h"
|
||||
#include "HomeSpan.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#include <sodium.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "SRP.h"
|
||||
#include "HAP.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
#include <mbedtls/sha512.h>
|
||||
#include <mbedtls/bignum.h>
|
||||
|
||||
#include "HAPConstants.h"
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// SRP-6A Structure from RFC 5054 (Nov 2007)
|
||||
// ** HAP uses N=3072-bit Group specified in RFC 5054
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "HomeSpan.h"
|
||||
|
||||
template <class tagType, int maxTags>
|
||||
class TLV {
|
||||
|
||||
|
|
@ -168,9 +166,6 @@ uint8_t *TLV<tagType, maxTags>::buf(tagType tag, int len){
|
|||
template<class tagType, int maxTags>
|
||||
void TLV<tagType, maxTags>::print(){
|
||||
|
||||
if(homeSpan.logLevel<2)
|
||||
return;
|
||||
|
||||
char buf[3];
|
||||
|
||||
for(int i=0;i<numTags;i++){
|
||||
|
|
|
|||
Loading…
Reference in New Issue