Merge pull request #1008 from lightning-signer/2021-07-sync-no-std
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Thu, 22 Jul 2021 14:17:09 +0000 (14:17 +0000)
committerGitHub <noreply@github.com>
Thu, 22 Jul 2021 14:17:09 +0000 (14:17 +0000)
Dummy sync implementation for no_std

lightning/src/util/message_signing.rs

index 2055b4087749ada5b3baef731770608baceb629e..8beff835a4bffe1f0b3d59e672380323b6164f98 100644 (file)
@@ -36,6 +36,11 @@ fn sigrec_encode(sig_rec: RecoverableSignature) -> Vec<u8> {
 }
 
 fn sigrec_decode(sig_rec: Vec<u8>) -> Result<RecoverableSignature, Error> {
+    // Signature must be 64 + 1 bytes long (compact signature + recovery id)
+    if sig_rec.len() != 65 {
+        return Err(Error::InvalidSignature);
+    }
+
     let rsig = &sig_rec[1..];
     let rid = sig_rec[0] as i32 - 31;