1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

pgcrypto update:

* Use error codes instead of -1
* px_strerror for new error codes
* calling convention change for px_gen_salt - return error code
* use px_strerror in pgcrypto.c

Marko Kreen
This commit is contained in:
Neil Conway
2005-03-21 05:19:55 +00:00
parent fa332a06ec
commit b160d6b9dc
9 changed files with 124 additions and 68 deletions

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/random.c,v 1.8 2004/11/23 23:44:08 neilc Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/random.c,v 1.9 2005/03/21 05:19:55 neilc Exp $
*/
@ -55,7 +55,7 @@ safe_read(int fd, void *buf, size_t count)
{
if (errno == EINTR)
continue;
return -1;
return PXE_DEV_READ_ERROR;
}
p += res;
done += res;
@ -72,7 +72,7 @@ px_get_random_bytes(uint8 *dst, unsigned count)
fd = open(RAND_DEV, O_RDONLY);
if (fd == -1)
return -1;
return PXE_DEV_READ_ERROR;
res = safe_read(fd, dst, count);
close(fd);
return res;
@ -117,10 +117,10 @@ px_get_random_bytes(uint8 *dst, unsigned count)
*/
res = RAND_bytes(dst, count);
if (res > 0)
if (res == 1)
return count;
return -1;
return PXE_OSSL_RAND_ERROR;
}
#else