| @@ -31,26 +31,29 @@ | | | @@ -31,26 +31,29 @@ |
31 | #include <inttypes.h> | | 31 | #include <inttypes.h> |
32 | #include <stdio.h> | | 32 | #include <stdio.h> |
33 | #include <stdlib.h> | | 33 | #include <stdlib.h> |
34 | #include <string.h> | | 34 | #include <string.h> |
35 | #include <unistd.h> | | 35 | #include <unistd.h> |
36 | | | 36 | |
37 | #include "digest.h" | | 37 | #include "digest.h" |
38 | #include "pgpsum.h" | | 38 | #include "pgpsum.h" |
39 | | | 39 | |
40 | #ifndef USE_ARG | | 40 | #ifndef USE_ARG |
41 | #define USE_ARG(x) /*LINTED*/(void)&(x) | | 41 | #define USE_ARG(x) /*LINTED*/(void)&(x) |
42 | #endif | | 42 | #endif |
43 | | | 43 | |
| | | 44 | #undef swap16 |
| | | 45 | #undef swap32 |
| | | 46 | |
44 | /* add the ascii armor line endings (except for last line) */ | | 47 | /* add the ascii armor line endings (except for last line) */ |
45 | static size_t | | 48 | static size_t |
46 | don_armor(digest_t *hash, uint8_t *in, size_t insize, int doarmor) | | 49 | don_armor(digest_t *hash, uint8_t *in, size_t insize, int doarmor) |
47 | { | | 50 | { |
48 | uint8_t *from; | | 51 | uint8_t *from; |
49 | uint8_t *newp; | | 52 | uint8_t *newp; |
50 | uint8_t *p; | | 53 | uint8_t *p; |
51 | uint8_t dos_line_end[2]; | | 54 | uint8_t dos_line_end[2]; |
52 | | | 55 | |
53 | dos_line_end[0] = '\r'; | | 56 | dos_line_end[0] = '\r'; |
54 | dos_line_end[1] = '\n'; | | 57 | dos_line_end[1] = '\n'; |
55 | for (from = in ; (p = memchr(from, '\n', insize - (size_t)(from - in))) != NULL ; from = p + 1) { | | 58 | for (from = in ; (p = memchr(from, '\n', insize - (size_t)(from - in))) != NULL ; from = p + 1) { |
56 | for (newp = p ; doarmor == 'w' && newp > from ; --newp) { | | 59 | for (newp = p ; doarmor == 'w' && newp > from ; --newp) { |