jpake.c (197679) | jpake.c (215116) |
---|---|
1/* $OpenBSD: jpake.c,v 1.2 2009/03/05 07:18:19 djm Exp $ */ | 1/* $OpenBSD: jpake.c,v 1.4 2010/07/13 23:13:16 djm Exp $ */ |
2/* 3 * Copyright (c) 2008 Damien Miller. All rights reserved. 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 419 unchanged lines hidden (view full) --- 429 JPAKE_DEBUG_BUF((expected_confirm_hash, expected_confirm_hash_len, 430 "%s: expected confirm hash", __func__)); 431 JPAKE_DEBUG_BUF((peer_confirm_hash, peer_confirm_hash_len, 432 "%s: received confirm hash", __func__)); 433 434 if (peer_confirm_hash_len != expected_confirm_hash_len) 435 error("%s: confirmation length mismatch (my %u them %u)", 436 __func__, expected_confirm_hash_len, peer_confirm_hash_len); | 2/* 3 * Copyright (c) 2008 Damien Miller. All rights reserved. 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 419 unchanged lines hidden (view full) --- 429 JPAKE_DEBUG_BUF((expected_confirm_hash, expected_confirm_hash_len, 430 "%s: expected confirm hash", __func__)); 431 JPAKE_DEBUG_BUF((peer_confirm_hash, peer_confirm_hash_len, 432 "%s: received confirm hash", __func__)); 433 434 if (peer_confirm_hash_len != expected_confirm_hash_len) 435 error("%s: confirmation length mismatch (my %u them %u)", 436 __func__, expected_confirm_hash_len, peer_confirm_hash_len); |
437 else if (memcmp(peer_confirm_hash, expected_confirm_hash, | 437 else if (timingsafe_bcmp(peer_confirm_hash, expected_confirm_hash, |
438 expected_confirm_hash_len) == 0) 439 success = 1; 440 bzero(expected_confirm_hash, expected_confirm_hash_len); 441 xfree(expected_confirm_hash); 442 debug3("%s: success = %d", __func__, success); 443 return success; 444} 445 446/* XXX main() function with tests */ 447 448#endif /* JPAKE */ 449 | 438 expected_confirm_hash_len) == 0) 439 success = 1; 440 bzero(expected_confirm_hash, expected_confirm_hash_len); 441 xfree(expected_confirm_hash); 442 debug3("%s: success = %d", __func__, success); 443 return success; 444} 445 446/* XXX main() function with tests */ 447 448#endif /* JPAKE */ 449 |