Skip to content

Commit c17863b

Browse files
committed
FEAT: added support for GCM ciphers in the TLS protocol
1 parent 5a29c15 commit c17863b

File tree

2 files changed

+161
-121
lines changed

2 files changed

+161
-121
lines changed

src/core/p-crypt.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,10 @@ static void free_crypt_cipher_context(CRYPT_CTX *ctx);
616616
if (err) return err;
617617
input += ctx->aad_len;
618618
len -= ctx->aad_len;
619+
if (len == 0) {
620+
ctx->state = CRYPT_PORT_HAS_DATA;
621+
break;
622+
}
619623
}
620624
err = mbedtls_gcm_update((mbedtls_gcm_context *)ctx->cipher_ctx, input, len, BIN_TAIL(bin), len, &out_bytes);
621625
if (err) return err;
@@ -924,7 +928,7 @@ static void free_crypt_cipher_context(CRYPT_CTX *ctx);
924928
Extend_Series(bin, ctx->tag_len);
925929
ret = mbedtls_gcm_finish((mbedtls_gcm_context*)ctx->cipher_ctx, NULL, 0, &olen, BIN_TAIL(bin), ctx->tag_len);
926930
if (ret) return ret;
927-
SERIES_TAIL(bin) += ctx->tag_len;
931+
SERIES_TAIL(bin) += ctx->tag_len; // don't use olen, because it is not set!!!
928932
ctx->state = CRYPT_PORT_FINISHED;
929933
}
930934
#endif

0 commit comments

Comments
 (0)