| 203 | */ |
| 204 | |
| 205 | my_bool |
| 206 | check_scramble_323(const unsigned char *scrambled, const char *message, |
| 207 | ulong *hash_pass) |
| 208 | { |
| 209 | struct rand_struct rand_st; |
| 210 | ulong hash_message[2]; |
| 211 | /* Big enough for checks. */ |
| 212 | uchar buff[16], scrambled_buff[SCRAMBLE_LENGTH_323 + 1]; |
| 213 | uchar *to, extra; |
| 214 | const uchar *pos; |
| 215 | |
| 216 | /* Ensure that the scrambled message is null-terminated. */ |
| 217 | memcpy(scrambled_buff, scrambled, SCRAMBLE_LENGTH_323); |
| 218 | scrambled_buff[SCRAMBLE_LENGTH_323]= '\0'; |
| 219 | scrambled= scrambled_buff; |
| 220 | |
| 221 | hash_password(hash_message, message, SCRAMBLE_LENGTH_323); |
| 222 | randominit(&rand_st,hash_pass[0] ^ hash_message[0], |
| 223 | hash_pass[1] ^ hash_message[1]); |
| 224 | to=buff; |
| 225 | DBUG_ASSERT(sizeof(buff) > SCRAMBLE_LENGTH_323); |
| 226 | for (pos=scrambled ; *pos && to < buff+sizeof(buff) ; pos++) |
| 227 | *to++=(char) (floor(my_rnd(&rand_st)*31)+64); |
| 228 | if (pos-scrambled != SCRAMBLE_LENGTH_323) |
| 229 | return 1; |
| 230 | extra=(char) (floor(my_rnd(&rand_st)*31)); |
| 231 | to=buff; |
| 232 | while (*scrambled) |
| 233 | { |
| 234 | if (*scrambled++ != (uchar) (*to++ ^ extra)) |
| 235 | return 1; /* Wrong password */ |
| 236 | } |
| 237 | return 0; |
| 238 | } |
| 239 | |
| 240 | static inline uint8 char_val(uint8 X) |
| 241 | { |
nothing calls this directly
no test coverage detected