]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
we don't accept a serial number with leading zeroes
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 14 Mar 2010 18:41:40 +0000 (19:41 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 14 Mar 2010 18:41:40 +0000 (19:41 +0100)
src/pki/commands/issue.c
src/pki/commands/self.c

index 07ab9066acc8cc1deb41fdab59263b27273061b7..abd61b74ed8ccbd45eb206f37e534d4cf3cb2db6 100644 (file)
@@ -212,6 +212,11 @@ static int issue()
                        goto end;
                }
                rng->allocate_bytes(rng, 8, &serial);
+               while (*serial.ptr == 0x00)
+               {
+                       /* we don't accept a serial number with leading zeroes */
+                       rng->get_bytes(rng, 1, serial.ptr);
+               }
                rng->destroy(rng);
        }
 
index 30ae23be5019a6fd7af1ffaf82ffb2ee75a4ee0e..d283daa6af9e5179351f3a597c4ace096e5fe1df 100644 (file)
@@ -158,6 +158,11 @@ static int self()
                        goto end;
                }
                rng->allocate_bytes(rng, 8, &serial);
+               while (*serial.ptr == 0x00)
+               {
+                       /* we don't accept a serial number with leading zeroes */
+                       rng->get_bytes(rng, 1, serial.ptr);
+               }
                rng->destroy(rng);
        }
        not_before = time(NULL);