Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blake2 init with key #274

Open
coderofstuff opened this issue Apr 19, 2023 · 1 comment
Open

Add blake2 init with key #274

coderofstuff opened this issue Apr 19, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@coderofstuff
Copy link

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)
@coderofstuff coderofstuff added the enhancement New feature or request label Apr 19, 2023
@coderofstuff
Copy link
Author

@tjoly-ledger have you had the chance to take a look at this? It seems like a logical thing to add to complete support for blake2b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant