Intelligent reflecting surface (IRS) is a promising solution to build a programmable wireless environment for future communication systems, in which the reflector elements steer the incident signal in fully customizable ways by passive beamforming. In this paper, an IRS-aided secure spatial modulation (SM) is proposed, where the IRS perform passive beamforming and information transfer simultaneously by adjusting the on-off states of the reflecting elements. We formulate an optimization problem to maximize the average secrecy rate (SR) by jointly optimizing the passive beamforming at IRS and the transmit power at transmitter under the consideration that the direct pathes channels from transmitter to receivers are obstructed by obstacles. As the expression of SR is complex, we derive a newly fitting expression (NASR) for the expression of traditional approximate SR (TASR), which has simpler closed-form and more convenient for subsequent optimization. Based on the above two fitting expressions, three beamforming methods, called maximizing NASR via successive convex approximation (Max-NASR-SCA), maximizing NASR via dual ascent (Max-NASR-DA) and maximizing TASR via semi-definite relaxation (Max-TASR-SDR) are proposed to improve the SR performance. Additionally, two transmit power design (TPD) methods are proposed based on the above two approximate SR expressions, called Max-NASR-TPD and Max-TASR-TPD. Simulation results show that the proposed Max-NASR-DA and Max-NASR-SCA IRS beamformers harvest substantial SR performance gains over Max-TASR-SDR. For TPD, the proposed Max-NASR-TPD performs better than Max-TASR-TPD. Particularly, the Max-NASR-TPD has a closed-form solution.