… | |
… | |
34 | #include "conf.h" |
34 | #include "conf.h" |
35 | #include "slog.h" |
35 | #include "slog.h" |
36 | #include "device.h" |
36 | #include "device.h" |
37 | #include "vpn.h" |
37 | #include "vpn.h" |
38 | #include "connection.h" |
38 | #include "connection.h" |
|
|
39 | |
|
|
40 | #include "netcompat.h" |
39 | |
41 | |
40 | #if !HAVE_RAND_PSEUDO_BYTES |
42 | #if !HAVE_RAND_PSEUDO_BYTES |
41 | # define RAND_pseudo_bytes RAND_bytes |
43 | # define RAND_pseudo_bytes RAND_bytes |
42 | #endif |
44 | #endif |
43 | |
45 | |
… | |
… | |
954 | |
956 | |
955 | rsachallenge chg; |
957 | rsachallenge chg; |
956 | |
958 | |
957 | if (!rsa_cache.find (p->id, chg)) |
959 | if (!rsa_cache.find (p->id, chg)) |
958 | { |
960 | { |
959 | slog (L_ERR, _("%s(%s): unrequested auth response"), |
961 | slog (L_ERR, _("%s(%s): unrequested auth response ignored"), |
960 | conf->nodename, (const char *)rsi); |
962 | conf->nodename, (const char *)rsi); |
961 | break; |
963 | break; |
962 | } |
964 | } |
963 | else |
965 | else |
964 | { |
966 | { |
965 | crypto_ctx *cctx = new crypto_ctx (chg, 0); |
967 | crypto_ctx *cctx = new crypto_ctx (chg, 0); |
966 | |
968 | |
967 | if (!p->hmac_chk (cctx)) |
969 | if (!p->hmac_chk (cctx)) |
|
|
970 | { |
968 | slog (L_ERR, _("%s(%s): hmac authentication error on auth response, received invalid packet\n" |
971 | slog (L_ERR, _("%s(%s): hmac authentication error on auth response, received invalid packet\n" |
969 | "could be an attack, or just corruption or an synchronization error"), |
972 | "could be an attack, or just corruption or an synchronization error"), |
970 | conf->nodename, (const char *)rsi); |
973 | conf->nodename, (const char *)rsi); |
|
|
974 | break; |
|
|
975 | } |
971 | else |
976 | else |
972 | { |
977 | { |
973 | rsaresponse h; |
978 | rsaresponse h; |
974 | |
979 | |
975 | rsa_hash (p->id, chg, h); |
980 | rsa_hash (p->id, chg, h); |