File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -303,6 +303,33 @@ _mongoc_scram_salt_password (mongoc_scram_t *scram,
303
303
}
304
304
305
305
306
+ static bool
307
+ _mongoc_scram_sha1 (const unsigned char * input ,
308
+ const size_t input_len ,
309
+ unsigned char * output )
310
+ {
311
+ EVP_MD_CTX digest_ctx ;
312
+ bool rval = false;
313
+
314
+ EVP_MD_CTX_init (& digest_ctx );
315
+
316
+ if (1 != EVP_DigestInit_ex (& digest_ctx , EVP_sha1 (), NULL )) {
317
+ goto cleanup ;
318
+ }
319
+
320
+ if (1 != EVP_DigestUpdate (& digest_ctx , input , input_len )) {
321
+ goto cleanup ;
322
+ }
323
+
324
+ rval = (1 == EVP_DigestFinal_ex (& digest_ctx , output , NULL ));
325
+
326
+ cleanup :
327
+ EVP_MD_CTX_cleanup (& digest_ctx );
328
+
329
+ return rval ;
330
+ }
331
+
332
+
306
333
static bool
307
334
_mongoc_scram_generate_client_proof (mongoc_scram_t * scram ,
308
335
uint8_t * outbuf ,
@@ -327,7 +354,7 @@ _mongoc_scram_generate_client_proof (mongoc_scram_t *scram,
327
354
& hash_len );
328
355
329
356
/* StoredKey := H(client_key) */
330
- SHA1 (client_key , MONGOC_SCRAM_HASH_SIZE , stored_key );
357
+ _mongoc_scram_sha1 (client_key , MONGOC_SCRAM_HASH_SIZE , stored_key );
331
358
332
359
/* ClientSignature := HMAC(StoredKey, AuthMessage) */
333
360
HMAC (EVP_sha1 (),
You can’t perform that action at this time.
0 commit comments