Skip to content

Commit

Permalink
Fix return value when an key with invalid length is used
Browse files Browse the repository at this point in the history
  • Loading branch information
babelouest committed Sep 21, 2021
1 parent d7e93ba commit d20da49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jwe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ static json_t * r_jwe_aesgcm_key_wrap(jwe_t * jwe, jwa_alg alg, jwk_t * jwk, int
iv_g.size = iv_size;
if ((res = gnutls_cipher_init(&handle, r_jwe_get_alg_from_alg(alg), &key_g, &iv_g))) {
y_log_message(Y_LOG_LEVEL_ERROR, "r_jwe_aesgcm_key_wrap - Error gnutls_cipher_init: '%s'", gnutls_strerror(res));
*ret = RHN_ERROR;
*ret = RHN_ERROR_PARAM;
break;
}
if ((res = gnutls_cipher_encrypt2(handle, jwe->key, jwe->key_len, cipherkey, jwe->key_len))) {
Expand Down Expand Up @@ -1859,7 +1859,7 @@ static int r_jwe_aesgcm_key_unwrap(jwe_t * jwe, jwa_alg alg, jwk_t * jwk, int x5
iv_g.size = iv_len;
if ((res = gnutls_cipher_init(&handle, r_jwe_get_alg_from_alg(alg), &key_g, &iv_g))) {
y_log_message(Y_LOG_LEVEL_ERROR, "r_jwe_aesgcm_key_unwrap - Error gnutls_cipher_init: '%s'", gnutls_strerror(res));
ret = RHN_ERROR;
ret = RHN_ERROR_INVALID;
break;
}
if ((res = gnutls_cipher_decrypt(handle, cipherkey, cipherkey_len))) {
Expand Down

0 comments on commit d20da49

Please sign in to comment.