Index: openpgpsdk/trunk/examples/packet-dump.c =================================================================== --- openpgpsdk/trunk/examples/packet-dump.c (revision 326) +++ openpgpsdk/trunk/examples/packet-dump.c (revision 327) @@ -907,5 +907,5 @@ if(armour) - ops_reader_push_dearmour(pinfo,ops_true,ops_true); + ops_reader_push_dearmour(pinfo,ops_true,ops_true,ops_true); ret=ops_parse(pinfo); Index: openpgpsdk/trunk/examples/verify2.c =================================================================== --- openpgpsdk/trunk/examples/verify2.c (revision 320) +++ openpgpsdk/trunk/examples/verify2.c (revision 327) @@ -187,5 +187,5 @@ if(armour) - ops_reader_push_dearmour(pinfo,ops_false,ops_false); + ops_reader_push_dearmour(pinfo,ops_false,ops_false,ops_false); ops_parse(pinfo); Index: openpgpsdk/trunk/include/openpgpsdk/armour.h =================================================================== --- openpgpsdk/trunk/include/openpgpsdk/armour.h (revision 320) +++ openpgpsdk/trunk/include/openpgpsdk/armour.h (revision 327) @@ -3,5 +3,7 @@ void ops_reader_push_dearmour(ops_parse_info_t *parse_info, - ops_boolean_t without_gap,ops_boolean_t no_gap); + ops_boolean_t without_gap, + ops_boolean_t no_gap, + ops_boolean_t trailing_whitespace); void ops_reader_pop_dearmour(ops_parse_info_t *parse_info); Index: openpgpsdk/trunk/src/armour.c =================================================================== --- openpgpsdk/trunk/src/armour.c (revision 320) +++ openpgpsdk/trunk/src/armour.c (revision 327) @@ -31,4 +31,9 @@ ops_boolean_t allow_no_gap:1; /*!< allow no blank line at the start of armoured data */ + ops_boolean_t allow_trailing_whitespace:1; /*!< allow armoured + stuff to have + trailing whitespace + where we wouldn't + strictly expect it */ // base64 stuff @@ -452,4 +457,7 @@ ERR(cbinfo,"Error in checksum"); c=read_char(arg,errors,rinfo,cbinfo,ops_true); + if(arg->allow_trailing_whitespace) + while(c == ' ' || c == '\t') + c=read_char(arg,errors,rinfo,cbinfo,ops_true); if(c != '\n') ERR(cbinfo,"Badly terminated checksum"); @@ -572,4 +580,9 @@ if((c=unarmoured_read_char(arg,errors,rinfo,cbinfo,ops_true)) < 0) return OPS_R_EOF; + if(arg->allow_trailing_whitespace) + while(c == ' ' || c == '\t') + if((c=unarmoured_read_char(arg,errors,rinfo,cbinfo, + ops_true)) < 0) + return OPS_R_EOF; if(c != '\n') /* wasn't a header line after all */ @@ -698,5 +711,7 @@ void ops_reader_push_dearmour(ops_parse_info_t *parse_info, - ops_boolean_t without_gap,ops_boolean_t no_gap) + ops_boolean_t without_gap, + ops_boolean_t no_gap, + ops_boolean_t trailing_whitespace) { dearmour_arg_t *arg; @@ -706,4 +721,5 @@ arg->allow_headers_without_gap=without_gap; arg->allow_no_gap=no_gap; + arg->allow_trailing_whitespace=trailing_whitespace; ops_reader_push(parse_info,armoured_data_reader,arg);