fix: add missing deprecation guards

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
diff --git a/library/x509write_crt.c b/library/x509write_crt.c
index 618c51e..04226b8 100644
--- a/library/x509write_crt.c
+++ b/library/x509write_crt.c
@@ -100,7 +100,7 @@
     return mbedtls_x509_string_to_names( &ctx->issuer, issuer_name );
 }
 
-#if defined(MBEDTLS_BIGNUM_C)
+#if defined(MBEDTLS_BIGNUM_C) && !defined(MBEDTLS_DEPRECATED_REMOVED)
 int mbedtls_x509write_crt_set_serial( mbedtls_x509write_cert *ctx,
                                       const mbedtls_mpi *serial )
 {
@@ -126,7 +126,7 @@
 
     return( 0 );
 }
-#endif
+#endif // MBEDTLS_BIGNUM_C && !MBEDTLS_DEPRECATED_REMOVED
 
 int mbedtls_x509write_crt_set_serial_new( mbedtls_x509write_cert *ctx,
                                 char* serial_buff, size_t serial_buff_len)