Suppose I have a protocol like the one below between users A and B;
-A sends random nonce G1 to B
-B sends back hash_k(G1) and random none G2
-A verifies hash_k(G1), then sends back hash_k(G1 | G2)
-B verifies and a connection is made
Would this protocol be safe from eavesdroppers and other attacks like man in the midddle?