1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2021 ASPEED Technology Inc.
19 HASH_ALGO_INVALID = 0xffffffff,
22 /* general APIs for hash algo information */
23 enum HASH_ALGO hash_algo_lookup_by_name(const char *name);
24 ssize_t hash_algo_digest_size(enum HASH_ALGO algo);
25 const char *hash_algo_name(enum HASH_ALGO algo);
27 /* device-dependent APIs */
28 int hash_digest(struct udevice *dev, enum HASH_ALGO algo,
29 const void *ibuf, const uint32_t ilen,
31 int hash_digest_wd(struct udevice *dev, enum HASH_ALGO algo,
32 const void *ibuf, const uint32_t ilen,
33 void *obuf, uint32_t chunk_sz);
34 int hash_init(struct udevice *dev, enum HASH_ALGO algo, void **ctxp);
35 int hash_update(struct udevice *dev, void *ctx, const void *ibuf, const uint32_t ilen);
36 int hash_finish(struct udevice *dev, void *ctx, void *obuf);
39 * struct hash_ops - Driver model for Hash operations
41 * The uclass interface is implemented by all hash devices
42 * which use driver model.
45 /* progressive operations */
46 int (*hash_init)(struct udevice *dev, enum HASH_ALGO algo, void **ctxp);
47 int (*hash_update)(struct udevice *dev, void *ctx, const void *ibuf, const uint32_t ilen);
48 int (*hash_finish)(struct udevice *dev, void *ctx, void *obuf);
50 /* all-in-one operation */
51 int (*hash_digest)(struct udevice *dev, enum HASH_ALGO algo,
52 const void *ibuf, const uint32_t ilen,
55 /* all-in-one operation with watchdog triggering every chunk_sz */
56 int (*hash_digest_wd)(struct udevice *dev, enum HASH_ALGO algo,
57 const void *ibuf, const uint32_t ilen,
58 void *obuf, uint32_t chunk_sz);