Added function to return literal data
};
69269F2314620D0F00F69705 /* packet.c */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {905, 21840}}";
- sepNavSelRange = "{7998, 0}";
- sepNavVisRange = "{6413, 1690}";
+ sepNavIntBoundsRect = "{{0, 0}, {905, 22152}}";
+ sepNavSelRange = "{8104, 120}";
+ sepNavVisRange = "{8101, 1269}";
sepNavWindowFrame = "{{139, 11}, {1136, 746}}";
};
};
};
6926AD2B146DDA1900F69705 /* simplepgp.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {1077, 1222}}";
- sepNavSelRange = "{1265, 0}";
- sepNavVisRange = "{753, 1477}";
+ sepNavIntBoundsRect = "{{0, 0}, {905, 1742}}";
+ sepNavSelRange = "{3330, 67}";
+ sepNavVisRange = "{2500, 1469}";
sepNavWindowFrame = "{{107, 43}, {1136, 746}}";
};
};
return head;
}
+char *spgp_get_literal_data(spgp_packet_t *msg, uint32_t *datalen,
+ char **filename, uint32_t *filenamelen) {
+ spgp_packet_t *cur = msg;
+
+ if (setjmp(exception)) {
+ LOG_PRINT("Exception (0x%x)\n",_spgp_err);
+ goto end;
+ }
+
+ if (NULL == msg || NULL == datalen ||
+ NULL == filename || NULL == filenamelen)
+ RAISE(INVALID_ARGS);
+
+ while (cur) {
+ if (cur->header->type == PKT_TYPE_LITERAL_DATA) {
+ *datalen = cur->c.literal->dataLen;
+ *filenamelen = cur->c.literal->filenameLen;
+ *filename = cur->c.literal->filename;
+ return cur->c.literal->data;
+ }
+ cur = cur->next;
+ }
+
+ end:
+ return NULL;
+}
+
uint8_t spgp_decrypt_all_secret_keys(spgp_packet_t *msg,
uint8_t *passphrase, uint32_t length) {
spgp_packet_t *cur = msg;
*/
uint8_t spgp_decrypt_all_secret_keys(spgp_packet_t *msg,
uint8_t *passphrase, uint32_t length);
+
+/**
+ * Gets the literal data buffer from a decrypted message
+ *
+ * @param Linked-list of packets to search for data
+ * @param datalen Set to size of returned data (in bytes)
+ * @param filename Set to buffer containing filename
+ * @param filenamelen Set to size of filename (in bytes)
+ * @return Buffer with literal data, or NULL if none available
+ */
+char *spgp_get_literal_data(spgp_packet_t *msg, uint32_t *datalen,
+ char **filename, uint32_t *filenamelen);
/**
* Frees all dynamic resources associated with |pkt|.