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

Allow Blake2s keys up to 32 bytes.

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