| 381 | } |
| 382 | |
| 383 | int partial_hash_sha3_256(uint8_t *data_in, uint8_t *data_out) |
| 384 | { |
| 385 | sha3_context *ctx; |
| 386 | int i; |
| 387 | |
| 388 | ctx = rte_zmalloc("sha3-ctx", sizeof(sha3_context), 0); |
| 389 | if (!ctx) { |
| 390 | CCP_LOG_ERR("sha3-ctx creation failed"); |
| 391 | return -ENOMEM; |
| 392 | } |
| 393 | sha3_Init256(ctx); |
| 394 | sha3_Update(ctx, data_in, SHA3_256_BLOCK_SIZE); |
| 395 | for (i = 0; i < CCP_SHA3_CTX_SIZE; i++, data_out++) |
| 396 | *data_out = ctx->sb[CCP_SHA3_CTX_SIZE - i - 1]; |
| 397 | rte_free(ctx); |
| 398 | |
| 399 | return 0; |
| 400 | } |
| 401 | |
| 402 | int partial_hash_sha3_384(uint8_t *data_in, uint8_t *data_out) |
| 403 | { |
no test coverage detected