*
* \return MIME_DEC_OK on success, otherwise < 0 on failure
*/
+
static int ProcessBodyComplete(MimeDecParseState *state)
{
int ret = MIME_DEC_OK;
int body_found = 0;
uint32_t tlen;
+#ifdef HAVE_NSS
+ if (state->body_begin == 1 && (state->md5_ctx == NULL)) {
+ state->md5_ctx = HASH_Create(HASH_AlgMD5);
+ if (state->md5_ctx != NULL) {
+ HASH_Begin(state->md5_ctx);
+ HASH_Update(state->md5_ctx, buf, len + 2); /* plus 2 to add CRLF */
+ }
+ }
+#endif
+
/* Ignore empty lines */
if (len == 0) {
return ret;
SCFree(state->hname);
FreeDataValue(state->hvalue);
FreeMimeDecStack(state->stack);
+#ifdef HAVE_NSS
+ if (state->md5_ctx)
+ HASH_Destroy(state->md5_ctx);
+#endif
SCFree(state);
}
return ret;
}
+#ifdef HAVE_NSS
+ if (state->md5_ctx) {
+ unsigned int len = 0;
+ HASH_End(state->md5_ctx, state->md5, &len, sizeof(state->md5));
+ }
+#endif
+
if (state->stack->top == NULL) {
state->msg->anomaly_flags |= ANOM_MALFORMED_MSG;
SCLogDebug("Error: Message is malformed");
SCLogDebug("SMTP LINE - EMPTY");
}
+#ifdef HAVE_NSS
+ if (state->md5_ctx) {
+ HASH_Update(state->md5_ctx, line, len + 2);
+ }
+#endif
/* Process the entity */
ret = ProcessMimeEntity(line, len, state);
if (ret != MIME_DEC_OK) {
uint8_t bvremain[B64_BLOCK]; /**< Remainder from base64-decoded line */
uint8_t bvr_len; /**< Length of remainder from base64-decoded line */
uint8_t data_chunk[DATA_CHUNK_SIZE]; /**< Buffer holding data chunk */
+#ifdef HAVE_NSS
+ HASHContext *md5_ctx;
+ uint8_t md5[MD5_LENGTH];
+#endif
uint8_t state_flag; /**< Flag representing current state of parser */
uint32_t data_chunk_len; /**< Length of data chunk */
int found_child; /**< Flag indicating a child entity was found */