I need to authenticate a message sent to an embedded device (which limits my options in terms of just using an existing convention). I can run ECDH/ECDSA on the device and can use SHA-256 as a hash function but pretty much anything else is beyond the resources of the device. Also I can pre-share a public key on the device.
If I simply create a hash from the message, sign the hash using ECDSA with the private key, then append the signature to the message, send it to the device, then on the device verify the signature on the device using the public key against the message hash, is this secure?
Any traps to be aware of?
Edit:
The resource I was looking for is here Authenticate encryption, but I now realize I don't understand secure communication well enough to know what questions to ask.
As per @fgrieu's suggestion I investigate RSA rather than ECDSA, and found that for a NIST-256 curve signature verification takes 0.740s on the device whereas RSA-1024 signature verification takes 0.230s. Code sizes are about the same (3.5k) but the stack usage for the RSA was too high (3.5k) for the amount of RAM I have available. Going down to secp160r1 EC gets the verification time down to about the same as the RSA.