PPP, magic, renamed random_bytes() to magic_random_bytes() for API coherency

This commit is contained in:
Sylvain Rochet 2015-08-30 18:54:21 +02:00
parent d0fa8acf86
commit e8399416ae
5 changed files with 10 additions and 10 deletions

View File

@ -110,7 +110,7 @@ u32_t magic(void); /* Returns the next magic number */
* least some degree. Also, it's important to get a good seed before
* the first use.
*/
void random_bytes(unsigned char *buf, u32_t buf_len);
void magic_random_bytes(unsigned char *buf, u32_t buf_len);
/*
* Return a new random number between 0 and (2^pow)-1 included.

View File

@ -60,7 +60,7 @@ static void chap_md5_generate_challenge(ppp_pcb *pcb, unsigned char *cp) {
clen = MD5_MIN_CHALLENGE + magic_pow(MD5_MIN_MAX_POWER_OF_TWO_CHALLENGE);
*cp++ = clen;
random_bytes(cp, clen);
magic_random_bytes(cp, clen);
}
static int chap_md5_verify_response(ppp_pcb *pcb, int id, const char *name,

View File

@ -249,7 +249,7 @@ static void chapms_generate_challenge(ppp_pcb *pcb, unsigned char *challenge) {
memcpy(challenge, mschap_challenge, 8);
else
#endif
random_bytes(challenge, 8);
magic_random_bytes(challenge, 8);
}
static void chapms2_generate_challenge(ppp_pcb *pcb, unsigned char *challenge) {
@ -261,7 +261,7 @@ static void chapms2_generate_challenge(ppp_pcb *pcb, unsigned char *challenge) {
memcpy(challenge, mschap_challenge, 16);
else
#endif
random_bytes(challenge, 16);
magic_random_bytes(challenge, 16);
}
static int chapms_verify_response(ppp_pcb *pcb, int id, const char *name,

View File

@ -136,7 +136,7 @@ void magic_randomize(void) {
}
/*
* random_bytes - Fill a buffer with random bytes.
* magic_random_bytes - Fill a buffer with random bytes.
*
* Use the random pool to generate random data. This degrades to pseudo
* random when used faster than randomness is supplied using magic_churnrand().
@ -153,7 +153,7 @@ void magic_randomize(void) {
* magic_randcount each time? Probably there is a weakness but I wish that
* it was documented.
*/
void random_bytes(unsigned char *buf, u32_t buf_len) {
void magic_random_bytes(unsigned char *buf, u32_t buf_len) {
md5_context md5;
u_char tmp[MD5_HASH_SIZE];
u32_t n;
@ -177,7 +177,7 @@ void random_bytes(unsigned char *buf, u32_t buf_len) {
u32_t magic(void) {
u32_t new_rand;
random_bytes((unsigned char *)&new_rand, sizeof(new_rand));
magic_random_bytes((unsigned char *)&new_rand, sizeof(new_rand));
return new_rand;
}
@ -254,9 +254,9 @@ u32_t magic(void) {
}
/*
* random_bytes - Fill a buffer with random bytes.
* magic_random_bytes - Fill a buffer with random bytes.
*/
void random_bytes(unsigned char *buf, u32_t buf_len) {
void magic_random_bytes(unsigned char *buf, u32_t buf_len) {
u32_t new_rand, n;
while (buf_len > 0) {

View File

@ -319,7 +319,7 @@ static err_t pppol2tp_connect(ppp_pcb *ppp, void *ctx) {
#if PPPOL2TP_AUTH_SUPPORT
/* Generate random vector */
if (l2tp->secret != NULL) {
random_bytes(l2tp->secret_rv, sizeof(l2tp->secret_rv));
magic_random_bytes(l2tp->secret_rv, sizeof(l2tp->secret_rv));
}
#endif /* PPPOL2TP_AUTH_SUPPORT */