Use RAND_METHOD for implementing RAND_status.
This commit is contained in:
		
							
								
								
									
										5
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								CHANGES
									
									
									
									
									
								
							| @@ -4,6 +4,11 @@ | |||||||
|  |  | ||||||
|  Changes between 0.9.5 and 0.9.6  [XX XXX 2000] |  Changes between 0.9.5 and 0.9.6  [XX XXX 2000] | ||||||
|  |  | ||||||
|  |   *) Include RAND_status() into RAND_METHOD instead of implementing | ||||||
|  |      it only for md_rand.c  Otherwise replacing the PRNG by calling | ||||||
|  |      RAND_set_rand_method would be impossible. | ||||||
|  |      [Bodo Moeller] | ||||||
|  |  | ||||||
|   *) Don't let DSA_generate_key() enter an infinite loop if the random |   *) Don't let DSA_generate_key() enter an infinite loop if the random | ||||||
|      number generation fails. |      number generation fails. | ||||||
|      [Bodo Moeller] |      [Bodo Moeller] | ||||||
|   | |||||||
| @@ -156,6 +156,7 @@ static void ssleay_rand_seed(const void *buf, int num); | |||||||
| static void ssleay_rand_add(const void *buf, int num, double add_entropy); | static void ssleay_rand_add(const void *buf, int num, double add_entropy); | ||||||
| static int ssleay_rand_bytes(unsigned char *buf, int num); | static int ssleay_rand_bytes(unsigned char *buf, int num); | ||||||
| static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num); | static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num); | ||||||
|  | static int ssleay_rand_status(void); | ||||||
|  |  | ||||||
| RAND_METHOD rand_ssleay_meth={ | RAND_METHOD rand_ssleay_meth={ | ||||||
| 	ssleay_rand_seed, | 	ssleay_rand_seed, | ||||||
| @@ -163,6 +164,7 @@ RAND_METHOD rand_ssleay_meth={ | |||||||
| 	ssleay_rand_cleanup, | 	ssleay_rand_cleanup, | ||||||
| 	ssleay_rand_add, | 	ssleay_rand_add, | ||||||
| 	ssleay_rand_pseudo_bytes, | 	ssleay_rand_pseudo_bytes, | ||||||
|  | 	ssleay_rand_status | ||||||
| 	};  | 	};  | ||||||
|  |  | ||||||
| RAND_METHOD *RAND_SSLeay(void) | RAND_METHOD *RAND_SSLeay(void) | ||||||
| @@ -502,7 +504,7 @@ static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num) | |||||||
| 	return (ret); | 	return (ret); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| int RAND_status(void) | static int ssleay_rand_status(void) | ||||||
| 	{ | 	{ | ||||||
| 	if (!initialized) | 	if (!initialized) | ||||||
| 		ssleay_rand_initialize(); | 		ssleay_rand_initialize(); | ||||||
|   | |||||||
| @@ -70,6 +70,7 @@ typedef struct rand_meth_st | |||||||
| 	void (*cleanup)(void); | 	void (*cleanup)(void); | ||||||
| 	void (*add)(const void *buf, int num, double entropy); | 	void (*add)(const void *buf, int num, double entropy); | ||||||
| 	int (*pseudorand)(unsigned char *buf, int num); | 	int (*pseudorand)(unsigned char *buf, int num); | ||||||
|  | 	int (*status)(void); | ||||||
| 	} RAND_METHOD; | 	} RAND_METHOD; | ||||||
|  |  | ||||||
| #ifdef BN_DEBUG | #ifdef BN_DEBUG | ||||||
|   | |||||||
| @@ -108,3 +108,10 @@ int RAND_pseudo_bytes(unsigned char *buf, int num) | |||||||
| 		return rand_meth->pseudorand(buf,num); | 		return rand_meth->pseudorand(buf,num); | ||||||
| 	return(-1); | 	return(-1); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | int RAND_status(void) | ||||||
|  | 	{ | ||||||
|  | 	if (rand_meth != NULL) | ||||||
|  | 		return rand_meth->status(); | ||||||
|  | 	return 0; | ||||||
|  | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Bodo Möller
					Bodo Möller