aboutsummaryrefslogtreecommitdiff
path: root/include/libbb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libbb.h')
-rw-r--r--include/libbb.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 7357d2907..1e345a3ee 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -2294,6 +2294,36 @@ char *decode_base64(char *dst, const char **pp_src) FAST_FUNC;
2294char *decode_base32(char *dst, const char **pp_src) FAST_FUNC; 2294char *decode_base32(char *dst, const char **pp_src) FAST_FUNC;
2295void read_base64(FILE *src_stream, FILE *dst_stream, int flags) FAST_FUNC; 2295void read_base64(FILE *src_stream, FILE *dst_stream, int flags) FAST_FUNC;
2296 2296
2297#if defined CONFIG_FEATURE_USE_CNG_API
2298struct bcrypt_hash_ctx_t {
2299 void *handle;
2300 void *hash_obj;
2301 unsigned int output_size;
2302};
2303typedef struct bcrypt_hash_ctx_t md5_ctx_t;
2304typedef struct bcrypt_hash_ctx_t sha1_ctx_t;
2305typedef struct bcrypt_hash_ctx_t sha256_ctx_t;
2306typedef struct bcrypt_hash_ctx_t sha512_ctx_t;
2307typedef struct sha3_ctx_t {
2308 uint64_t state[25];
2309 unsigned bytes_queued;
2310 unsigned input_block_bytes;
2311} sha3_ctx_t;
2312void md5_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC;
2313void sha1_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC;
2314void sha256_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC;
2315void sha512_begin(struct bcrypt_hash_ctx_t *ctx) FAST_FUNC;
2316void generic_hash(struct bcrypt_hash_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC;
2317unsigned generic_end(struct bcrypt_hash_ctx_t *ctx, void *resbuf) FAST_FUNC;
2318#define md5_hash generic_hash
2319#define sha1_hash generic_hash
2320#define sha256_hash generic_hash
2321#define sha512_hash generic_hash
2322#define md5_end generic_end
2323#define sha1_end generic_end
2324#define sha256_end generic_end
2325#define sha512_end generic_end
2326#else
2297typedef struct md5_ctx_t { 2327typedef struct md5_ctx_t {
2298 uint8_t wbuffer[64]; /* always correctly aligned for uint64_t */ 2328 uint8_t wbuffer[64]; /* always correctly aligned for uint64_t */
2299 void (*process_block)(struct md5_ctx_t*) FAST_FUNC; 2329 void (*process_block)(struct md5_ctx_t*) FAST_FUNC;
@@ -2324,13 +2354,20 @@ void sha256_begin(sha256_ctx_t *ctx) FAST_FUNC;
2324void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC; 2354void sha512_begin(sha512_ctx_t *ctx) FAST_FUNC;
2325void sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; 2355void sha512_hash(sha512_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC;
2326unsigned sha512_end(sha512_ctx_t *ctx, void *resbuf) FAST_FUNC; 2356unsigned sha512_end(sha512_ctx_t *ctx, void *resbuf) FAST_FUNC;
2357#endif
2327void sha3_begin(sha3_ctx_t *ctx) FAST_FUNC; 2358void sha3_begin(sha3_ctx_t *ctx) FAST_FUNC;
2328void sha3_hash(sha3_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC; 2359void sha3_hash(sha3_ctx_t *ctx, const void *buffer, size_t len) FAST_FUNC;
2329unsigned sha3_end(sha3_ctx_t *ctx, void *resbuf) FAST_FUNC; 2360unsigned sha3_end(sha3_ctx_t *ctx, void *resbuf) FAST_FUNC;
2330/* TLS benefits from knowing that sha1 and sha256 share these. Give them "agnostic" names too */ 2361/* TLS benefits from knowing that sha1 and sha256 share these. Give them "agnostic" names too */
2362#if defined CONFIG_FEATURE_USE_CNG_API
2363typedef struct bcrypt_hash_ctx_t md5sha_ctx_t;
2364#define md5sha_hash generic_hash
2365#define sha_end generic_end
2366#else
2331typedef struct md5_ctx_t md5sha_ctx_t; 2367typedef struct md5_ctx_t md5sha_ctx_t;
2332#define md5sha_hash md5_hash 2368#define md5sha_hash md5_hash
2333#define sha_end sha1_end 2369#define sha_end sha1_end
2370#endif
2334enum { 2371enum {
2335 MD5_OUTSIZE = 16, 2372 MD5_OUTSIZE = 16,
2336 SHA1_OUTSIZE = 20, 2373 SHA1_OUTSIZE = 20,