mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
Add RAND_UNIMPLEMENTED error code
See old GitHub PR 38. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3714)
This commit is contained in:
parent
7447c49f0d
commit
0ea155fc1c
@ -2042,6 +2042,7 @@ PKCS7_R_UNSUPPORTED_CIPHER_TYPE:111:unsupported cipher type
|
|||||||
PKCS7_R_UNSUPPORTED_CONTENT_TYPE:112:unsupported content type
|
PKCS7_R_UNSUPPORTED_CONTENT_TYPE:112:unsupported content type
|
||||||
PKCS7_R_WRONG_CONTENT_TYPE:113:wrong content type
|
PKCS7_R_WRONG_CONTENT_TYPE:113:wrong content type
|
||||||
PKCS7_R_WRONG_PKCS7_TYPE:114:wrong pkcs7 type
|
PKCS7_R_WRONG_PKCS7_TYPE:114:wrong pkcs7 type
|
||||||
|
RAND_R_FUNC_NOT_IMPLEMENTED:101:Function not implemented
|
||||||
RAND_R_PRNG_NOT_SEEDED:100:PRNG not seeded
|
RAND_R_PRNG_NOT_SEEDED:100:PRNG not seeded
|
||||||
RSA_R_ALGORITHM_MISMATCH:100:algorithm mismatch
|
RSA_R_ALGORITHM_MISMATCH:100:algorithm mismatch
|
||||||
RSA_R_BAD_E_VALUE:101:bad e value
|
RSA_R_BAD_E_VALUE:101:bad e value
|
||||||
|
@ -19,6 +19,8 @@ static const ERR_STRING_DATA RAND_str_functs[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const ERR_STRING_DATA RAND_str_reasons[] = {
|
static const ERR_STRING_DATA RAND_str_reasons[] = {
|
||||||
|
{ERR_PACK(ERR_LIB_RAND, 0, RAND_R_FUNC_NOT_IMPLEMENTED),
|
||||||
|
"Function not implemented"},
|
||||||
{ERR_PACK(ERR_LIB_RAND, 0, RAND_R_PRNG_NOT_SEEDED), "PRNG not seeded"},
|
{ERR_PACK(ERR_LIB_RAND, 0, RAND_R_PRNG_NOT_SEEDED), "PRNG not seeded"},
|
||||||
{0, NULL}
|
{0, NULL}
|
||||||
};
|
};
|
||||||
|
@ -137,6 +137,7 @@ int RAND_bytes(unsigned char *buf, int num)
|
|||||||
const RAND_METHOD *meth = RAND_get_rand_method();
|
const RAND_METHOD *meth = RAND_get_rand_method();
|
||||||
if (meth && meth->bytes)
|
if (meth && meth->bytes)
|
||||||
return meth->bytes(buf, num);
|
return meth->bytes(buf, num);
|
||||||
|
RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,24 +22,20 @@ RAND_bytes() puts B<num> cryptographically strong pseudo-random bytes
|
|||||||
into B<buf>. An error occurs if the PRNG has not been seeded with
|
into B<buf>. An error occurs if the PRNG has not been seeded with
|
||||||
enough randomness to ensure an unpredictable byte sequence.
|
enough randomness to ensure an unpredictable byte sequence.
|
||||||
|
|
||||||
RAND_pseudo_bytes() has been deprecated. Users should use RAND_bytes() instead.
|
RAND_pseudo_bytes() has been deprecated; use RAND_bytes() instead.
|
||||||
RAND_pseudo_bytes() puts B<num> pseudo-random bytes into B<buf>.
|
|
||||||
Pseudo-random byte sequences generated by RAND_pseudo_bytes() will be
|
|
||||||
unique if they are of sufficient length, but are not necessarily
|
|
||||||
unpredictable. They can be used for non-cryptographic purposes and for
|
|
||||||
certain purposes in cryptographic protocols, but usually not for key
|
|
||||||
generation etc.
|
|
||||||
|
|
||||||
The contents of B<buf> is mixed into the entropy pool before retrieving
|
The contents of B<buf> is mixed into the entropy pool before retrieving
|
||||||
the new pseudo-random bytes unless disabled at compile time (see FAQ).
|
the new pseudo-random bytes unless disabled at compile time (see FAQ).
|
||||||
|
|
||||||
=head1 RETURN VALUES
|
=head1 RETURN VALUES
|
||||||
|
|
||||||
RAND_bytes() returns 1 on success, 0 otherwise. The error code can be
|
RAND_bytes() returns 1 on success, -1 if not supported by the current
|
||||||
obtained by L<ERR_get_error(3)>. RAND_pseudo_bytes() returns 1 if the
|
RAND method, or 0 on other failure. The error code can be
|
||||||
bytes generated are cryptographically strong, 0 otherwise. Both
|
obtained by L<ERR_get_error(3)>.
|
||||||
functions return -1 if they are not supported by the current RAND
|
|
||||||
method.
|
=head HISTORY
|
||||||
|
|
||||||
|
RAND_pseudo_bytes() was deprecated in OpenSSL 1.1.0.
|
||||||
|
|
||||||
=head1 SEE ALSO
|
=head1 SEE ALSO
|
||||||
|
|
||||||
@ -48,7 +44,7 @@ L<RAND_add(3)>
|
|||||||
|
|
||||||
=head1 COPYRIGHT
|
=head1 COPYRIGHT
|
||||||
|
|
||||||
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
|
|
||||||
Licensed under the OpenSSL license (the "License"). You may not use
|
Licensed under the OpenSSL license (the "License"). You may not use
|
||||||
this file except in compliance with the License. You can obtain a copy
|
this file except in compliance with the License. You can obtain a copy
|
||||||
|
@ -27,6 +27,7 @@ int ERR_load_RAND_strings(void);
|
|||||||
/*
|
/*
|
||||||
* RAND reason codes.
|
* RAND reason codes.
|
||||||
*/
|
*/
|
||||||
|
# define RAND_R_FUNC_NOT_IMPLEMENTED 101
|
||||||
# define RAND_R_PRNG_NOT_SEEDED 100
|
# define RAND_R_PRNG_NOT_SEEDED 100
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user