In the near future, one of the promising concepts that are going to change undoubtedly the whole automobile industry, vehicular networking, and transportation sector is the Internet of Vehicles (IoVs). IoVs open new opportunities in different services and applications to enhance road conditions, driver/passenger safety, transportation issues, non-safety applications, and especially for the avoidance of accidents. For reducing accidents, timely warning messages play an important role. For that, lightweight protocols are needed. Another important criterion to be ensured is ‘security’. Because the attackers always try to convey false warning messages that may result in serious issues or attacks. However, in the existing research, secure and lightweight protocols in IoVs are missing. Hence, in this paper, we designed a protocol, P2-SHARP (Privacy-Preserving Secure Hash-based Authentication and Revelation Protocol) using IoVs. In this scheme, secure transmission of local and global warning messages is done. For ensuring security, we have used several cryptographic operations. Security and performance analysis reveals the efficiency of P2-SHARP. © 2021 Elsevier B.V.