Fix a compliance issue in signature encoding

The issue is not present in the normal path because asn1write_mpi() does it
automatically, but we're not using that here...
diff --git a/library/pk_wrap.c b/library/pk_wrap.c
index 762dbfb..5e83602 100644
--- a/library/pk_wrap.c
+++ b/library/pk_wrap.c
@@ -807,8 +807,16 @@
     *p -= len;
     memmove( *p, start, len );
 
+    /* ASN.1 DER encoding requires minimal length, so skip leading 0s.
+     * Neither r nor s can be 0, so we can assume len > 0 at all times. */
+    while( **p == 0x00 )
+    {
+        ++(*p);
+        --len;
+    }
+
     /* if the msb is 1, ASN.1 requires that we prepend a 0.
-     * we're never called with n_len == 0, so we can always read back a byte */
+     * Neither r nor s can be 0, so we can assume len > 0 at all times. */
     if( **p & 0x80 )
     {
         if( *p - start < 1 )