<div dir="ltr">Hello,<br><br>On Windows, passphrase files may have CRLF (\r\n) line endings.<br>This patch removes the trailing '\r' if present, avoiding potential passphrase mismatches during decryption or signing operations.<br>I have requested this patch after personally facing the issue with a passphrase file generated on windows as it was silently including \r in the password and the decryption attempt was failing.<br>Please find the below attached patch details.<br><br>Thanks,<br>Vaibhav Sharma<br><br>---<br><div style="color:rgb(59,59,59);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"><div>From e0e6acca96405c2a291a11074f510e66774925d6 Mon Sep 17 00:00:00 2001</div><div>From: VAIBHAV SHARMA <<a href="mailto:85764094%2BVAIBHAV675@users.noreply.github.com">85764094+VAIBHAV675@users.noreply.github.com</a>></div><div>Date: Sun, 15 Jun 2025 17:29:29 +0000</div><div>Subject: [PATCH] g10: Handle CRLF endings in passphrase file input *</div><div> g10/passphrase.c (read_passphrase_from_fd): Trim trailing \r character in</div><div> passphrase input to correctly handle CRLF endings.</div><br><div>Signed-off-by: VAIBHAV SHARMA <<a href="mailto:85764094%2BVAIBHAV675@users.noreply.github.com">85764094+VAIBHAV675@users.noreply.github.com</a>></div><div>---</div><div> g10/passphrase.c | 6 ++++++</div><div> 1 file changed, 6 insertions(+)</div><br><div><span style="color:rgb(0,0,128)">diff --git a/g10/passphrase.c b/g10/passphrase.c</span></div><div>index c5ec8eae4..32bbc74f6 100644</div><div><span style="color:rgb(0,0,128)">--- a/g10/passphrase.c</span></div><div><span style="color:rgb(0,0,128)">+++ b/g10/passphrase.c</span></div><div>@@ -150,6 +150,12 @@ read_passphrase_from_fd( int fd )</div><div>         break;</div><div>     }</div><div>   pw[i] = 0;</div><div><span style="color:rgb(9,134,88)">+</span></div><div><span style="color:rgb(9,134,88)">+  /* Fix for Windows CRLF line endings for passphrase file generated on windows:</span></div><div><span style="color:rgb(9,134,88)">+     If the passphrase ends with a carriage return character ('\r') due to CRLF line endings, strip it. */</span></div><div><span style="color:rgb(9,134,88)">+  if (i > 0 && pw[i-1] == '\r')</span></div><div><span style="color:rgb(9,134,88)">+    pw[i-1] = 0;</span></div><div><span style="color:rgb(9,134,88)">+    </span></div><div>   if (!opt.batch && opt.pinentry_mode != PINENTRY_MODE_LOOPBACK)</div><div>     tty_printf("\b\b\b   \n" );</div><div> </div><div><span style="color:rgb(163,21,21)">-- </span></div><div>2.49.0</div><br><br></div></div>