| 146 size_t pwlen = strlen(password); |
146 size_t pwlen = strlen(password); |
| 147 |
147 |
| 148 unsigned char pwhash[64]; |
148 unsigned char pwhash[64]; |
| 149 switch(user->hash_type) { |
149 switch(user->hash_type) { |
| 150 case KEYFILE_SSHA: { |
150 case KEYFILE_SSHA: { |
| 151 SHA_CTX ctx; |
151 WS_SHA1_CTX ctx; |
| 152 SHA1_Init(&ctx); |
152 ws_sha1_init(&ctx); |
| 153 SHA1_Update(&ctx, password, pwlen); |
153 ws_sha1_update(&ctx, password, pwlen); |
| 154 SHA1_Update(&ctx, salt, saltlen); |
154 ws_sha1_update(&ctx, salt, saltlen); |
| 155 SHA1_Final(pwhash, &ctx); |
155 ws_sha1_final(&ctx, pwhash); |
| 156 break; |
156 break; |
| 157 } |
157 } |
| 158 case KEYFILE_SSHA256: { |
158 case KEYFILE_SSHA256: { |
| 159 SHA256_CTX ctx; |
159 WS_SHA256_CTX ctx; |
| 160 SHA256_Init(&ctx); |
160 ws_sha256_init(&ctx); |
| 161 SHA256_Update(&ctx, password, pwlen); |
161 ws_sha256_update(&ctx, password, pwlen); |
| 162 SHA256_Update(&ctx, salt, saltlen); |
162 ws_sha256_update(&ctx, salt, saltlen); |
| 163 SHA256_Final(pwhash, &ctx); |
163 ws_sha256_final(&ctx, pwhash); |
| 164 break; |
164 break; |
| 165 } |
165 } |
| 166 case KEYFILE_SSHA512: { |
166 case KEYFILE_SSHA512: { |
| 167 SHA512_CTX ctx; |
167 SHA512_CTX ctx; |
| 168 SHA512_Init(&ctx); |
168 SHA512_Init(&ctx); |