1 // Copyright 2021 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 15 #pragma once 16 17 #include "pw_bytes/span.h" 18 #include "pw_status/status.h" 19 20 namespace pw::crypto::ecdsa { 21 22 // VerifyP256Signature verifies the `signature` of `digest` using `public_key`. 23 // 24 // `public_key` is a byte string in SEC 1 uncompressed form (0x04||X||Y), which 25 // is exactly 65 bytes. Compressed forms (02/03||X) *may* not be supported 26 // by some backends, e.g. Mbed TLS. 27 // 28 // `digest` is a raw byte string, truncated to 32 bytes. 29 // 30 // `signature` is a raw byte string (r||s) of exactly 64 bytes. 31 // 32 // Returns Status::OkStatus() for a successful verification, or an error Status 33 // otherwise. 34 Status VerifyP256Signature(ConstByteSpan public_key, 35 ConstByteSpan digest, 36 ConstByteSpan signature); 37 38 } // namespace pw::crypto::ecdsa 39