aboutsummaryrefslogtreecommitdiff
path: root/include/libbb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libbb.h')
-rw-r--r--include/libbb.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 221837b64..9ece2f9ec 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1522,37 +1522,42 @@ unsigned get_cpu_count(void) FAST_FUNC;
1522extern const char bb_uuenc_tbl_base64[]; 1522extern const char bb_uuenc_tbl_base64[];
1523extern const char bb_uuenc_tbl_std[]; 1523extern const char bb_uuenc_tbl_std[];
1524void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC; 1524void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC;
1525enum {
1526 BASE64_FLAG_UU_STOP = 0x100,
1527 /* Sign-extends to a value which never matches fgetc result: */
1528 BASE64_FLAG_NO_STOP_CHAR = 0x80,
1529};
1530void FAST_FUNC read_base64(FILE *src_stream, FILE *dst_stream, int flags);
1525 1531
1526typedef struct sha1_ctx_t { 1532typedef struct sha1_ctx_t {
1527 uint32_t hash[8]; /* 5, +3 elements for sha256 */ 1533 uint32_t hash[8]; /* 5, +3 elements for sha256 */
1528 uint64_t total64; 1534 uint64_t total64; /* must be directly after hash[] */
1529 uint8_t wbuffer[64]; /* NB: always correctly aligned for uint64_t */ 1535 uint8_t wbuffer[64]; /* NB: always correctly aligned for uint64_t */
1530 void (*process_block)(struct sha1_ctx_t*) FAST_FUNC; 1536 void (*process_block)(struct sha1_ctx_t*) FAST_FUNC;
1531} sha1_ctx_t; 1537} sha1_ctx_t;
1532void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC; 1538void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC;
1533void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx) FAST_FUNC; 1539void sha1_hash(sha1_ctx_t *ctx, const void *data, size_t length) FAST_FUNC;
1534void sha1_end(void *resbuf, sha1_ctx_t *ctx) FAST_FUNC; 1540void sha1_end(sha1_ctx_t *ctx, void *resbuf) FAST_FUNC;
1535typedef struct sha1_ctx_t sha256_ctx_t; 1541typedef struct sha1_ctx_t sha256_ctx_t;
1536void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC; 1542void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC;
1537#define sha256_hash sha1_hash 1543#define sha256_hash sha1_hash
1538#define sha256_end sha1_end 1544#define sha256_end sha1_end
1539typedef struct sha512_ctx_t { 1545typedef struct sha512_ctx_t {
1540 uint64_t hash[8]; 1546 uint64_t hash[8];
1541 uint64_t total64[2]; 1547 uint64_t total64[2]; /* must be directly after hash[] */
1542 uint8_t wbuffer[128]; /* NB: always correctly aligned for uint64_t */ 1548 uint8_t wbuffer[128]; /* NB: always correctly aligned for uint64_t */
1543} sha512_ctx_t; 1549} sha512_ctx_t;
1544void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; 1550void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC;
1545void sha512_hash(const void *buffer, size_t len, sha512_ctx_t *ctx) FAST_FUNC; 1551void sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC;
1546void sha512_end(void *resbuf, sha512_ctx_t *ctx) FAST_FUNC; 1552void sha512_end(sha512_ctx_t *ctx, void *resbuf) FAST_FUNC;
1547#if 1 1553#if 1
1548typedef struct md5_ctx_t { 1554typedef struct md5_ctx_t {
1549 uint32_t A; 1555 uint32_t A;
1550 uint32_t B; 1556 uint32_t B;
1551 uint32_t C; 1557 uint32_t C;
1552 uint32_t D; 1558 uint32_t D;
1553 uint64_t total; 1559 uint64_t total64;
1554 uint32_t buflen; 1560 char wbuffer[64];
1555 char buffer[128];
1556} md5_ctx_t; 1561} md5_ctx_t;
1557#else 1562#else
1558/* libbb/md5prime.c uses a bit different one: */ 1563/* libbb/md5prime.c uses a bit different one: */
@@ -1563,8 +1568,8 @@ typedef struct md5_ctx_t {
1563} md5_ctx_t; 1568} md5_ctx_t;
1564#endif 1569#endif
1565void md5_begin(md5_ctx_t *ctx) FAST_FUNC; 1570void md5_begin(md5_ctx_t *ctx) FAST_FUNC;
1566void md5_hash(const void *data, size_t length, md5_ctx_t *ctx) FAST_FUNC; 1571void md5_hash(md5_ctx_t *ctx, const void *data, size_t length) FAST_FUNC;
1567void md5_end(void *resbuf, md5_ctx_t *ctx) FAST_FUNC; 1572void md5_end(md5_ctx_t *ctx, void *resbuf) FAST_FUNC;
1568 1573
1569 1574
1570uint32_t *crc32_filltable(uint32_t *tbl256, int endian) FAST_FUNC; 1575uint32_t *crc32_filltable(uint32_t *tbl256, int endian) FAST_FUNC;