Loading doc/crypto/BN_rand.pod +11 −6 Original line number Original line Diff line number Diff line Loading @@ -19,13 +19,18 @@ BN_rand, BN_pseudo_rand, BN_rand_range, BN_pseudo_rand_range - generate pseudo-r =head1 DESCRIPTION =head1 DESCRIPTION BN_rand() generates a cryptographically strong pseudo-random number of BN_rand() generates a cryptographically strong pseudo-random number of B<bits> in length and stores it in B<rnd>. If B<top> is -1, the B<bits> in length and stores it in B<rnd>. most significant bit of the random number can be zero. If B<top> is 0, The value of B<bits> must be zero or greater. it is set to 1, and if B<top> is 1, the two most significant bits of The B<top> parameters specifies requirements on the most significant bit of the generated number. If it is B<BN_RAND_TOP_ANY>, there is no constraint. If it is B<BN_RAND_TOP_ONE>, the top bit must be one. If it is B<BN_RAND_TOP_TWO>, the two most significant bits of the number will be set to 1, so that the product of two such random the number will be set to 1, so that the product of two such random numbers will always have 2*B<bits> length. If B<bottom> is true, the numbers will always have 2*B<bits> length. number will be odd. The value of B<bits> must be zero or greater. If B<bits> is If B<bottom> is B<BN_RAND_BOTTOM_ODD>, the number will be odd; if it 1 then B<top> cannot also be 1. is B<BN_RAND_BOTTOM_ANY> it can be odd or even. If B<bits> is 1 then B<top> cannot also be B<BN_RAND_FLG_TOPTWO>. BN_pseudo_rand() does the same, but pseudo-random numbers generated by BN_pseudo_rand() does the same, but pseudo-random numbers generated by this function are not necessarily unpredictable. They can be used for this function are not necessarily unpredictable. They can be used for Loading include/openssl/bn.h +9 −0 Original line number Original line Diff line number Diff line Loading @@ -82,6 +82,15 @@ extern "C" { void BN_set_flags(BIGNUM *b, int n); void BN_set_flags(BIGNUM *b, int n); int BN_get_flags(const BIGNUM *b, int n); int BN_get_flags(const BIGNUM *b, int n); /* Values for |top| in BN_rand() */ #define BN_RAND_TOP_ANY -1 #define BN_RAND_TOP_ONE 0 #define BN_RAND_TOP_TWO 1 /* Values for |bottom| in BN_rand() */ #define BN_RAND_BOTTOM_ANY 0 #define BN_RAND_BOTTOM_ODD 1 /* /* * get a clone of a BIGNUM with changed flags, for *temporary* use only (the * get a clone of a BIGNUM with changed flags, for *temporary* use only (the * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The Loading Loading
doc/crypto/BN_rand.pod +11 −6 Original line number Original line Diff line number Diff line Loading @@ -19,13 +19,18 @@ BN_rand, BN_pseudo_rand, BN_rand_range, BN_pseudo_rand_range - generate pseudo-r =head1 DESCRIPTION =head1 DESCRIPTION BN_rand() generates a cryptographically strong pseudo-random number of BN_rand() generates a cryptographically strong pseudo-random number of B<bits> in length and stores it in B<rnd>. If B<top> is -1, the B<bits> in length and stores it in B<rnd>. most significant bit of the random number can be zero. If B<top> is 0, The value of B<bits> must be zero or greater. it is set to 1, and if B<top> is 1, the two most significant bits of The B<top> parameters specifies requirements on the most significant bit of the generated number. If it is B<BN_RAND_TOP_ANY>, there is no constraint. If it is B<BN_RAND_TOP_ONE>, the top bit must be one. If it is B<BN_RAND_TOP_TWO>, the two most significant bits of the number will be set to 1, so that the product of two such random the number will be set to 1, so that the product of two such random numbers will always have 2*B<bits> length. If B<bottom> is true, the numbers will always have 2*B<bits> length. number will be odd. The value of B<bits> must be zero or greater. If B<bits> is If B<bottom> is B<BN_RAND_BOTTOM_ODD>, the number will be odd; if it 1 then B<top> cannot also be 1. is B<BN_RAND_BOTTOM_ANY> it can be odd or even. If B<bits> is 1 then B<top> cannot also be B<BN_RAND_FLG_TOPTWO>. BN_pseudo_rand() does the same, but pseudo-random numbers generated by BN_pseudo_rand() does the same, but pseudo-random numbers generated by this function are not necessarily unpredictable. They can be used for this function are not necessarily unpredictable. They can be used for Loading
include/openssl/bn.h +9 −0 Original line number Original line Diff line number Diff line Loading @@ -82,6 +82,15 @@ extern "C" { void BN_set_flags(BIGNUM *b, int n); void BN_set_flags(BIGNUM *b, int n); int BN_get_flags(const BIGNUM *b, int n); int BN_get_flags(const BIGNUM *b, int n); /* Values for |top| in BN_rand() */ #define BN_RAND_TOP_ANY -1 #define BN_RAND_TOP_ONE 0 #define BN_RAND_TOP_TWO 1 /* Values for |bottom| in BN_rand() */ #define BN_RAND_BOTTOM_ANY 0 #define BN_RAND_BOTTOM_ODD 1 /* /* * get a clone of a BIGNUM with changed flags, for *temporary* use only (the * get a clone of a BIGNUM with changed flags, for *temporary* use only (the * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The Loading