<key>Notifications</key>
<array/>
<key>OpenEditors</key>
- <array>
- <dict>
- <key>Content</key>
- <dict>
- <key>PBXProjectModuleGUID</key>
- <string>69868EAE1461A414004C5D9B</string>
- <key>PBXProjectModuleLabel</key>
- <string>packet.h</string>
- <key>PBXSplitModuleInNavigatorKey</key>
- <dict>
- <key>Split0</key>
- <dict>
- <key>PBXProjectModuleGUID</key>
- <string>69868EAF1461A414004C5D9B</string>
- <key>PBXProjectModuleLabel</key>
- <string>packet.h</string>
- <key>_historyCapacity</key>
- <integer>0</integer>
- <key>bookmark</key>
- <string>69269F1E14620C8900F69705</string>
- <key>history</key>
- <array>
- <string>69269DF31461F1ED00F69705</string>
- </array>
- </dict>
- <key>SplitCount</key>
- <string>1</string>
- </dict>
- <key>StatusBarVisibility</key>
- <true/>
- </dict>
- <key>Geometry</key>
- <dict>
- <key>Frame</key>
- <string>{{0, 20}, {1136, 649}}</string>
- <key>PBXModuleWindowStatusBarHidden2</key>
- <false/>
- <key>RubberWindowFrame</key>
- <string>38 162 1136 690 0 0 1440 878 </string>
- </dict>
- </dict>
- </array>
+ <array/>
<key>PerspectiveWidths</key>
<array>
<integer>-1</integer>
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>8</integer>
- <integer>2</integer>
+ <integer>4</integer>
+ <integer>1</integer>
<integer>0</integer>
</array>
</array>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>69269F1D14620C8900F69705</string>
+ <string>69269FAE1462141200F69705</string>
<key>history</key>
<array>
<string>69868BD11460F42D004C5D9B</string>
<string>69868BD91460F468004C5D9B</string>
<string>69868C931460F7C3004C5D9B</string>
- <string>69868D8314618DD7004C5D9B</string>
- <string>69269DC61461ED9F00F69705</string>
- <string>69269ED114620AFE00F69705</string>
- <string>69269EDB14620B2900F69705</string>
- <string>69269EDC14620B2900F69705</string>
+ <string>69269F5214620FC500F69705</string>
+ <string>69269F5314620FC500F69705</string>
+ <string>69269F8A1462131300F69705</string>
+ <string>69269F8B1462131300F69705</string>
</array>
</dict>
<key>SplitCount</key>
<integer>5</integer>
<key>WindowOrderList</key>
<array>
+ <string>1CD10A99069EF8BA00B06720</string>
+ <string>69269F5714620FC500F69705</string>
<string>69868B2D1460E71D004C5D9B</string>
- <string>69868EAE1461A414004C5D9B</string>
<string>/Users/trevor/Documents/Cocoa Projects/libsimplepgp/simplepgp.xcodeproj</string>
</array>
<key>WindowString</key>
<key>Dock</key>
<array>
<dict>
- <key>BecomeActive</key>
- <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>1CD0528F0623707200166675</string>
<key>PBXProjectModuleLabel</key>
- <string>packet_test.c</string>
+ <string><No Editor></string>
<key>StatusBarVisibility</key>
<true/>
</dict>
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {500, 136}}</string>
+ <string>{{0, 0}, {500, 0}}</string>
<key>RubberWindowFrame</key>
<string>57 313 500 500 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>136pt</string>
+ <string>0pt</string>
</dict>
<dict>
<key>ContentConfiguration</key>
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 141}, {500, 318}}</string>
+ <string>{{0, 5}, {500, 454}}</string>
<key>RubberWindowFrame</key>
<string>57 313 500 500 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
<key>Proportion</key>
- <string>318pt</string>
+ <string>454pt</string>
</dict>
</array>
<key>Proportion</key>
<string>yes</string>
<key>sizes</key>
<array>
- <string>{{0, 0}, {316, 185}}</string>
- <string>{{316, 0}, {378, 185}}</string>
+ <string>{{0, 0}, {316, 194}}</string>
+ <string>{{316, 0}, {378, 194}}</string>
</array>
</dict>
<key>VerticalSplitView</key>
<string>yes</string>
<key>sizes</key>
<array>
- <string>{{0, 0}, {694, 185}}</string>
- <string>{{0, 185}, {694, 196}}</string>
+ <string>{{0, 0}, {694, 194}}</string>
+ <string>{{0, 194}, {694, 187}}</string>
</array>
</dict>
</dict>
<real>148</real>
</array>
<key>Frame</key>
- <string>{{316, 0}, {378, 185}}</string>
+ <string>{{316, 0}, {378, 194}}</string>
<key>RubberWindowFrame</key>
<string>-1633 963 694 422 -1680 385 1680 1050 </string>
</dict>
<key>TableOfContents</key>
<array>
<string>1CD10A99069EF8BA00B06720</string>
- <string>69868F581461BBC2004C5D9B</string>
+ <string>69269F8D1462131300F69705</string>
<string>1C162984064C10D400B95A72</string>
- <string>69868F591461BBC2004C5D9B</string>
- <string>69868F5A1461BBC2004C5D9B</string>
- <string>69868F5B1461BBC2004C5D9B</string>
- <string>69868F5C1461BBC2004C5D9B</string>
- <string>69868F5D1461BBC2004C5D9B</string>
+ <string>69269F8E1462131300F69705</string>
+ <string>69269F8F1462131300F69705</string>
+ <string>69269F901462131300F69705</string>
+ <string>69269F911462131300F69705</string>
+ <string>69269F921462131300F69705</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.debugV3</string>
<integer>0</integer>
</dict>
<dict>
+ <key>FirstTimeWindowDisplayed</key>
+ <false/>
<key>Identifier</key>
<string>windowTool.refactoring</string>
<key>IncludeInToolsMenu</key>
<integer>0</integer>
+ <key>IsVertical</key>
+ <true/>
<key>Layout</key>
<array>
<dict>
<key>Dock</key>
<array>
<dict>
- <key>BecomeActive</key>
- <integer>1</integer>
+ <key>ContentConfiguration</key>
+ <dict>
+ <key>PBXProjectModuleGUID</key>
+ <string>69269F5614620FC500F69705</string>
+ </dict>
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{0, 0}, {500, 335}</string>
+ <string>{{0, 0}, {500, 315}}</string>
<key>RubberWindowFrame</key>
- <string>{0, 0}, {500, 335}</string>
+ <string>-1633 1029 500 356 -1680 385 1680 1050 </string>
</dict>
<key>Module</key>
<string>XCRefactoringModule</string>
<key>Proportion</key>
- <string>100%</string>
+ <string>315pt</string>
</dict>
</array>
<key>Proportion</key>
- <string>100%</string>
+ <string>315pt</string>
</dict>
</array>
<key>Name</key>
<array>
<string>XCRefactoringModule</string>
</array>
+ <key>StatusbarIsVisible</key>
+ <true/>
+ <key>TableOfContents</key>
+ <array>
+ <string>69269F5714620FC500F69705</string>
+ <string>69269F5814620FC500F69705</string>
+ <string>69269F5614620FC500F69705</string>
+ </array>
<key>WindowString</key>
- <string>200 200 500 356 0 0 1920 1200 </string>
+ <string>-1633 1029 500 356 -1680 385 1680 1050 </string>
+ <key>WindowToolGUID</key>
+ <string>69269F5714620FC500F69705</string>
+ <key>WindowToolIsVisible</key>
+ <false/>
</dict>
</array>
</dict>
breakpoints = (
69868C9D14618450004C5D9B /* packet.c:9 */,
69868EE41461AA6F004C5D9B /* packet.c:207 */,
+ 69269F4E14620FC200F69705 /* packet.c:167 */,
);
codeSenseManager = 69868AD51460E35F004C5D9B /* Code sense */;
perUserDictionary = {
69269F1814620C6800F69705 /* PBXTextBookmark */ = 69269F1814620C6800F69705 /* PBXTextBookmark */;
69269F1D14620C8900F69705 /* PBXTextBookmark */ = 69269F1D14620C8900F69705 /* PBXTextBookmark */;
69269F1E14620C8900F69705 /* PBXTextBookmark */ = 69269F1E14620C8900F69705 /* PBXTextBookmark */;
+ 69269F5214620FC500F69705 /* PBXTextBookmark */ = 69269F5214620FC500F69705 /* PBXTextBookmark */;
+ 69269F5314620FC500F69705 /* PBXTextBookmark */ = 69269F5314620FC500F69705 /* PBXTextBookmark */;
+ 69269F5414620FC500F69705 /* PBXTextBookmark */ = 69269F5414620FC500F69705 /* PBXTextBookmark */;
+ 69269F5514620FC500F69705 /* PBXTextBookmark */ = 69269F5514620FC500F69705 /* PBXTextBookmark */;
+ 69269F5F14620FFB00F69705 /* PBXTextBookmark */ = 69269F5F14620FFB00F69705 /* PBXTextBookmark */;
+ 69269F6A146210A800F69705 /* PBXTextBookmark */ = 69269F6A146210A800F69705 /* PBXTextBookmark */;
+ 69269F6B146210A800F69705 /* PBXTextBookmark */ = 69269F6B146210A800F69705 /* PBXTextBookmark */;
+ 69269F7B1462110A00F69705 /* PBXTextBookmark */ = 69269F7B1462110A00F69705 /* PBXTextBookmark */;
+ 69269F8A1462131300F69705 /* PBXTextBookmark */ = 69269F8A1462131300F69705 /* PBXTextBookmark */;
+ 69269F8B1462131300F69705 /* PBXTextBookmark */ = 69269F8B1462131300F69705 /* PBXTextBookmark */;
+ 69269F8C1462131300F69705 /* PBXTextBookmark */ = 69269F8C1462131300F69705 /* PBXTextBookmark */;
+ 69269F991462133E00F69705 /* PBXTextBookmark */ = 69269F991462133E00F69705 /* PBXTextBookmark */;
+ 69269FA01462137A00F69705 /* PBXTextBookmark */ = 69269FA01462137A00F69705 /* PBXTextBookmark */;
+ 69269FA71462140200F69705 /* PBXTextBookmark */ = 69269FA71462140200F69705 /* PBXTextBookmark */;
+ 69269FAE1462141200F69705 /* PBXTextBookmark */ = 69269FAE1462141200F69705 /* PBXTextBookmark */;
69868BD11460F42D004C5D9B = 69868BD11460F42D004C5D9B /* PBXTextBookmark */;
69868BD91460F468004C5D9B = 69868BD91460F468004C5D9B /* PBXTextBookmark */;
69868C931460F7C3004C5D9B = 69868C931460F7C3004C5D9B /* PBXTextBookmark */;
vrLen = 991;
vrLoc = 720;
};
+ 69269F2114620D0F00F69705 /* packet_test.c */ = {
+ uiCtxt = {
+ sepNavIntBoundsRect = "{{0, 0}, {1030, 780}}";
+ sepNavSelRange = "{0, 0}";
+ sepNavVisRange = "{0, 1356}";
+ };
+ };
+ 69269F2314620D0F00F69705 /* packet.c */ = {
+ uiCtxt = {
+ sepNavIntBoundsRect = "{{0, 0}, {1030, 8294}}";
+ sepNavSelRange = "{4835, 0}";
+ sepNavVisRange = "{4194, 1805}";
+ };
+ };
+ 69269F2414620D0F00F69705 /* packet.h */ = {
+ uiCtxt = {
+ sepNavIntBoundsRect = "{{0, 0}, {1030, 1729}}";
+ sepNavSelRange = "{1161, 7}";
+ sepNavVisRange = "{313, 1144}";
+ };
+ };
+ 69269F4E14620FC200F69705 /* packet.c:167 */ = {
+ isa = PBXFileBreakpoint;
+ actions = (
+ );
+ breakpointStyle = 0;
+ continueAfterActions = 0;
+ countType = 0;
+ delayBeforeContinue = 0;
+ fileReference = 69269F2314620D0F00F69705 /* packet.c */;
+ functionName = "spgp_decode_message()";
+ hitCount = 0;
+ ignoreCount = 0;
+ lineNumber = 167;
+ location = duckdog;
+ modificationTime = 341971971.281257;
+ originalNumberOfMultipleMatches = 1;
+ state = 2;
+ };
+ 69269F5214620FC500F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = AA747D9E0F9514B9006C5449 /* simplepgp_Prefix.pch */;
+ name = "simplepgp_Prefix.pch: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 188;
+ vrLoc = 0;
+ };
+ 69269F5314620FC500F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2114620D0F00F69705 /* packet_test.c */;
+ name = "packet_test.c: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 1356;
+ vrLoc = 0;
+ };
+ 69269F5414620FC500F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 168";
+ rLen = 0;
+ rLoc = 4835;
+ rType = 0;
+ vrLen = 1715;
+ vrLoc = 3704;
+ };
+ 69269F5514620FC500F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 168";
+ rLen = 0;
+ rLoc = 4835;
+ rType = 0;
+ vrLen = 1715;
+ vrLoc = 3704;
+ };
+ 69269F5F14620FFB00F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 168";
+ rLen = 0;
+ rLoc = 4835;
+ rType = 0;
+ vrLen = 1715;
+ vrLoc = 3704;
+ };
+ 69269F6A146210A800F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 171";
+ rLen = 0;
+ rLoc = 4921;
+ rType = 0;
+ vrLen = 1762;
+ vrLoc = 3553;
+ };
+ 69269F6B146210A800F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 171";
+ rLen = 0;
+ rLoc = 4921;
+ rType = 0;
+ vrLen = 1762;
+ vrLoc = 3553;
+ };
+ 69269F7B1462110A00F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 168";
+ rLen = 0;
+ rLoc = 4835;
+ rType = 0;
+ vrLen = 1766;
+ vrLoc = 3553;
+ };
+ 69269F8A1462131300F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2414620D0F00F69705 /* packet.h */;
+ name = "packet.h: 59";
+ rLen = 7;
+ rLoc = 1161;
+ rType = 0;
+ vrLen = 1144;
+ vrLoc = 313;
+ };
+ 69269F8B1462131300F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 209";
+ rLen = 0;
+ rLoc = 6071;
+ rType = 0;
+ vrLen = 1536;
+ vrLoc = 4539;
+ };
+ 69269F8C1462131300F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 197";
+ rLen = 0;
+ rLoc = 5617;
+ rType = 0;
+ vrLen = 1317;
+ vrLoc = 5272;
+ };
+ 69269F991462133E00F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 200";
+ rLen = 0;
+ rLoc = 5757;
+ rType = 0;
+ vrLen = 1337;
+ vrLoc = 5272;
+ };
+ 69269FA01462137A00F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 235";
+ rLen = 0;
+ rLoc = 6521;
+ rType = 0;
+ vrLen = 1333;
+ vrLoc = 5302;
+ };
+ 69269FA71462140200F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 211";
+ rLen = 0;
+ rLoc = 6031;
+ rType = 0;
+ vrLen = 1370;
+ vrLoc = 5279;
+ };
+ 69269FAE1462141200F69705 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 69269F2314620D0F00F69705 /* packet.c */;
+ name = "packet.c: 167";
+ rLen = 0;
+ rLoc = 4835;
+ rType = 0;
+ vrLen = 1805;
+ vrLoc = 4194;
+ };
69868AD41460E35F004C5D9B /* Source Control */ = {
isa = PBXSourceControlManager;
fallbackIsa = XCSourceControlManager;
ignoreCount = 0;
lineNumber = 9;
location = duckdog;
- modificationTime = 341970025.778636;
+ modificationTime = 341971971.279537;
originalNumberOfMultipleMatches = 1;
state = 2;
};
hitCount = 0;
ignoreCount = 0;
lineNumber = 207;
- modificationTime = 341970025.779882;
+ modificationTime = 341971971.280463;
originalNumberOfMultipleMatches = 0;
state = 2;
};
};
AA747D9E0F9514B9006C5449 /* simplepgp_Prefix.pch */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {845, 317}}";
+ sepNavIntBoundsRect = "{{0, 0}, {1030, 722}}";
sepNavSelRange = "{0, 0}";
sepNavVisRange = "{0, 188}";
};
#include <setjmp.h>
#include "gcrypt.h"
-#define DEBUG_LOG
+
+/**********************************************************************
+**
+** MACROS
+**
+***********************************************************************/
+#pragma mark Macros
#define RAISE(err) do { \
_spgp_err = (err); \
} } while(0)
+/**********************************************************************
+**
+** Static variables
+**
+***********************************************************************/
+
+
static uint32_t _spgp_err;
static jmp_buf exception;
#endif
-static uint8_t parse_header(uint8_t *msg, uint32_t *idx,
+/**********************************************************************
+**
+** Static function prototypes
+**
+***********************************************************************/
+
+static uint8_t spgp_parse_header(uint8_t *msg, uint32_t *idx,
uint32_t length, spgp_packet_t *pkt);
+
static uint8_t spgp_parse_secret_key(uint8_t *msg, uint32_t *idx,
uint32_t length, spgp_packet_t *pkt);
+
static spgp_mpi_t *spgp_read_mpi(uint8_t *msg, uint32_t *idx,
uint32_t length);
+
static uint8_t spgp_read_all_public_mpis(uint8_t *msg,
uint32_t *idx,
uint32_t length,
spgp_secret_pkt_t *secret);
+
static uint8_t spgp_read_all_secret_mpis(uint8_t *msg,
uint32_t *idx,
uint32_t length,
spgp_secret_pkt_t *secret);
+
static uint8_t spgp_read_salt(uint8_t *msg,
uint32_t *idx,
uint32_t length,
spgp_secret_pkt_t *secret);
+
static uint8_t spgp_read_iv(uint8_t *msg,
uint32_t *idx,
uint32_t length,
spgp_secret_pkt_t *secret);
+
static uint8_t spgp_iv_length_for_symmetric_algo(uint8_t algo);
+
static uint8_t spgp_salt_length_for_hash_algo(uint8_t algo);
+
+
+/**********************************************************************
+**
+** External function definitions
+**
+***********************************************************************/
+#pragma mark External Function Definitions
+
uint8_t spgp_debug_log_enabled(void) {
return debug_log_enabled;
}
spgp_packet_t *spgp_decode_message(uint8_t *message, uint32_t length) {
spgp_packet_t *head = NULL;
spgp_packet_t *pkt = NULL;
- uint32_t startIdx = 0;
uint32_t idx = 0;
LOG_PRINT("begin\n");
RAISE(INVALID_ARGS);
}
+ // There must be at least one packet, yeah?
head = malloc(sizeof(*head));
if (NULL == head) RAISE(OUT_OF_MEMORY);
memset(head, 0, sizeof(*head));
pkt = head;
+
+ // Loop to decode every packet in message
while (idx < length-1) {
- startIdx = idx;
- parse_header(message, &idx, length, pkt);
+ // Every packet starts with a header
+ spgp_parse_header(message, &idx, length, pkt);
if (!pkt->header) RAISE(FORMAT_UNSUPPORTED);
+ // Decode packet contents based on the type marked in its header
switch (pkt->header->type) {
case PKT_TYPE_SECRET_KEY:
case PKT_TYPE_SECRET_SUBKEY:
break;
}
- if (idx >= length-1) break; // we've done the last packet
-
- pkt->next = malloc(sizeof(*head));
+ // If we're at the end of the buffer, we're done
+ if (idx >= length-1) break;
+
+ // Allocate space for another packet
+ pkt->next = malloc(sizeof(*pkt->next));
if (NULL == pkt->next) RAISE(OUT_OF_MEMORY);
memset(pkt->next, 0, sizeof(*pkt->next));
pkt = pkt->next;
// Packet parser increments to it's own last byte. Need one more to get
- // to the next packet's beginning
+ // to the next packet's first byte.
SAFE_IDX_INCREMENT(idx, length);
}
}
void spgp_free_packet(spgp_packet_t **pkt) {
+ spgp_mpi_t *curMpi, *nextMpi;
+
if (pkt == NULL)
return;
if (*pkt == NULL)
return;
- // TODO: make this recursive, free it's next pointer first
+ LOG_PRINT("Freeing packet: %p\n", pkt);
+
+ // Recursively call on the next packet before freeing parent.
+ if ((*pkt)->next) spgp_free_packet(&((*pkt)->next));
+
+ // Release memory allocated for secret key fields
+ if (((*pkt)->header->type == PKT_TYPE_SECRET_KEY ||
+ (*pkt)->header->type == PKT_TYPE_SECRET_SUBKEY) &&
+ (*pkt)->c.secret != NULL) {
+ if ((*pkt)->c.secret->mpiCount > 0) {
+ curMpi = (*pkt)->c.secret->mpiHead;
+ while (curMpi->next) {
+ nextMpi = curMpi->next;
+ free(curMpi);
+ curMpi = nextMpi;
+ }
+ (*pkt)->c.secret->mpiHead = NULL;
+ (*pkt)->c.secret->mpiCount = 0;
+ }
+ if ((*pkt)->c.secret->s2kSalt) {
+ free((*pkt)->c.secret->s2kSalt);
+ (*pkt)->c.secret->s2kSalt = NULL;
+ }
+ if ((*pkt)->c.secret->key) {
+ free((*pkt)->c.secret->key);
+ (*pkt)->c.secret->key = NULL;
+ }
+ if ((*pkt)->c.secret->iv) {
+ free((*pkt)->c.secret->iv);
+ (*pkt)->c.secret->iv = NULL;
+ }
+ }
// release header
if ((*pkt)->header) {
(*pkt)->header = NULL;
}
- // TODO: should release MPIs here
-
// release packet
free(*pkt);
+
*pkt = NULL;
}
}
-static uint8_t parse_header(uint8_t *msg, uint32_t *idx,
+
+
+
+/**********************************************************************
+**
+** Static function definitions
+**
+***********************************************************************/
+#pragma mark Static Function Definitions
+
+
+static uint8_t spgp_parse_header(uint8_t *msg, uint32_t *idx,
uint32_t length, spgp_packet_t *pkt) {
uint8_t i;