pki: Don't generate negative random serial numbers in X.509 certificates

According to RFC 5280 4.1.2.2 we MUST force non-negative serial numbers.
This commit is contained in:
Martin Willi
2014-03-31 11:14:58 +02:00
parent 0226ca886d
commit e49197f15e
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -363,6 +363,7 @@ static int issue()
rng->destroy(rng);
goto end;
}
serial.ptr[0] &= 0x7F;
rng->destroy(rng);
}
+1
View File
@@ -314,6 +314,7 @@ static int self()
rng->destroy(rng);
goto end;
}
serial.ptr[0] &= 0x7F;
rng->destroy(rng);
}
not_before = time(NULL);