Lines Matching refs:algo

45 static int hash_init_sha1(struct hash_algo *algo, void **ctxp)  in hash_init_sha1()  argument
53 static int hash_update_sha1(struct hash_algo *algo, void *ctx, const void *buf, in hash_update_sha1() argument
60 static int hash_finish_sha1(struct hash_algo *algo, void *ctx, void *dest_buf, in hash_finish_sha1() argument
63 if (size < algo->digest_size) in hash_finish_sha1()
73 static int hash_init_sha256(struct hash_algo *algo, void **ctxp) in hash_init_sha256() argument
81 static int hash_update_sha256(struct hash_algo *algo, void *ctx, in hash_update_sha256() argument
88 static int hash_finish_sha256(struct hash_algo *algo, void *ctx, void in hash_finish_sha256() argument
91 if (size < algo->digest_size) in hash_finish_sha256()
101 static int hash_init_sha384(struct hash_algo *algo, void **ctxp) in hash_init_sha384() argument
109 static int hash_update_sha384(struct hash_algo *algo, void *ctx, in hash_update_sha384() argument
116 static int hash_finish_sha384(struct hash_algo *algo, void *ctx, void in hash_finish_sha384() argument
119 if (size < algo->digest_size) in hash_finish_sha384()
129 static int hash_init_sha512(struct hash_algo *algo, void **ctxp) in hash_init_sha512() argument
137 static int hash_update_sha512(struct hash_algo *algo, void *ctx, in hash_update_sha512() argument
144 static int hash_finish_sha512(struct hash_algo *algo, void *ctx, void in hash_finish_sha512() argument
147 if (size < algo->digest_size) in hash_finish_sha512()
157 static int hash_init_crc16_ccitt(struct hash_algo *algo, void **ctxp) in hash_init_crc16_ccitt() argument
165 static int hash_update_crc16_ccitt(struct hash_algo *algo, void *ctx, in hash_update_crc16_ccitt() argument
173 static int hash_finish_crc16_ccitt(struct hash_algo *algo, void *ctx, in hash_finish_crc16_ccitt() argument
176 if (size < algo->digest_size) in hash_finish_crc16_ccitt()
184 static int hash_init_crc32(struct hash_algo *algo, void **ctxp) in hash_init_crc32() argument
192 static int hash_update_crc32(struct hash_algo *algo, void *ctx, in hash_update_crc32() argument
199 static int hash_finish_crc32(struct hash_algo *algo, void *ctx, void *dest_buf, in hash_finish_crc32() argument
202 if (size < algo->digest_size) in hash_finish_crc32()
368 struct hash_algo *algo; in hash_parse_string() local
372 ret = hash_lookup_algo(algo_name, &algo); in hash_parse_string()
376 for (i = 0; i < algo->digest_size; i++) { in hash_parse_string()
389 struct hash_algo *algo; in hash_block() local
392 ret = hash_lookup_algo(algo_name, &algo); in hash_block()
396 if (output_size && *output_size < algo->digest_size) { in hash_block()
398 *output_size, algo->digest_size); in hash_block()
402 *output_size = algo->digest_size; in hash_block()
403 algo->hash_func_ws(data, len, output, algo->chunk_size); in hash_block()
420 static void store_result(struct hash_algo *algo, const uint8_t *sum, in store_result() argument
443 for (i = 0; i < algo->digest_size; i++) { in store_result()
454 buf = map_sysmem(addr, algo->digest_size); in store_result()
455 memcpy(buf, sum, algo->digest_size); in store_result()
476 static int parse_verify_sum(struct hash_algo *algo, char *verify_str, in parse_verify_sum() argument
494 buf = map_sysmem(addr, algo->digest_size); in parse_verify_sum()
495 memcpy(vsum, buf, algo->digest_size); in parse_verify_sum()
498 int digits = algo->digest_size * 2; in parse_verify_sum()
516 hash_parse_string(algo->name, vsum_str, vsum); in parse_verify_sum()
521 static void hash_show(struct hash_algo *algo, ulong addr, ulong len, uint8_t *output) in hash_show() argument
525 printf("%s for %08lx ... %08lx ==> ", algo->name, addr, addr + len - 1); in hash_show()
526 for (i = 0; i < algo->digest_size; i++) in hash_show()
542 struct hash_algo *algo; local
547 if (hash_lookup_algo(algo_name, &algo)) {
553 if (algo->digest_size > HASH_MAX_DIGEST_SIZE) {
562 algo->hash_func_ws(buf, len, output, algo->chunk_size);
572 if (parse_verify_sum(algo, *argv, vsum,
575 "%s sum\n", *argv, algo->name);
578 if (memcmp(output, vsum, algo->digest_size) != 0) {
581 hash_show(algo, addr, len, output);
583 for (i = 0; i < algo->digest_size; i++)
589 hash_show(algo, addr, len, output);
593 store_result(algo, output, *argv,