Commit 43a0066f authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Allow Blake2s keys up to 32 bytes.

parent 375ea5ff
......@@ -332,7 +332,7 @@ The
.B value
is a hexadecimal string (up to 64 bytes for
.BR hmac-sha256 ,
exactly 16 bytes for
up to 32 bytes for
.BR blake2s ).
.SS Interface configuration
An interface is configured by a line with the following format:
......
......@@ -831,9 +831,9 @@ parse_key(int c, gnc_t gnc, void *closure, struct key **key_return)
break;
}
case AUTH_TYPE_BLAKE2S:
if(key->len != 16) {
fprintf(stderr, "Key length is %d, expected %d.\n",
key->len, 16);
if(key->len < 1 || key->len > 32) {
fprintf(stderr, "Key length is %d, expected 1 to 32.\n",
key->len);
goto error;
}
break;
......
......@@ -173,7 +173,7 @@ compute_hmac(const unsigned char *src, const unsigned char *dst,
}
case AUTH_TYPE_BLAKE2S: {
blake2s_state s;
if(key->len != 16)
if(key->len > 32)
return -1;
rc = blake2s_init_key(&s, 16, key->value, key->len);
if(rc < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment