Skip to content

Add blake2 init with key #274

Open
Open
@coderofstuff

Description

@coderofstuff

Description

Blake2 has been added back with this PR #230 by @tjoly-ledger.

There are only 2 init available: one with no parameters and one with parameters {salt, perso}

Please implement the third possible initialization which is with using a key. Something like:

static cx_err_t cx_blake2b_init3_no_throw(cx_blake2b_t* hash,
                                          size_t size,
                                          uint8_t* key,
                                          size_t key_len) {
    if (key == NULL && key_len != 0) {
        goto err;
    }

    if (size % 8 != 0 || size < 8 || size > 512) {
        goto err;
    }
    memset(hash, 0, sizeof(cx_blake2b_t));

    size = size / 8;
    hash->output_size = size;
    hash->header.info = &cx_blake2b_info;

    if (blake2b_init_key(&hash->ctx, size, key, key_len) < 0) {
        goto err;
    }
    return CX_OK;

err:
    return CX_INVALID_PARAMETER;
}

Your environment

  • Linux
  • branch that causes this issue
  • Device (All devices)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions