| 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, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 |
| 15 | #ifndef OPENSSL_HEADER_CRYPTO_FIPSMODULE_ECDSA_INTERNAL_H |
| 16 | #define OPENSSL_HEADER_CRYPTO_FIPSMODULE_ECDSA_INTERNAL_H |
| 17 |
| 18 | #include <openssl/base.h> |
| 19 |
| 20 | #include "../ec/internal.h" |
| 21 |
| 22 | #if defined(__cplusplus) |
| 23 | extern "C" { |
| 24 | #endif |
| 25 |
| 26 |
| 27 | // ECDSA_MAX_FIXED_LEN is the maximum length of an ECDSA signature in the |
| 28 | // fixed-width, big-endian format from IEEE P1363. |
| 29 | #define ECDSA_MAX_FIXED_LEN (2 * EC_MAX_BYTES) |
| 30 |
| 31 | // ecdsa_sign_fixed behaves like |ECDSA_sign| but uses the fixed-width, |
| 32 | // big-endian format from IEEE P1363. |
| 33 | int ecdsa_sign_fixed(const uint8_t *digest, size_t digest_len, uint8_t *sig, |
| 34 | size_t *out_sig_len, size_t max_sig_len, |
| 35 | const EC_KEY *key); |
| 36 |
| 37 | // ecdsa_sign_fixed_with_nonce_for_known_answer_test behaves like |
| 38 | // |ecdsa_sign_fixed| but takes a caller-supplied nonce. This function is used |
| 39 | // as part of known-answer tests in the FIPS module. |
| 40 | int ecdsa_sign_fixed_with_nonce_for_known_answer_test( |
| 41 | const uint8_t *digest, size_t digest_len, uint8_t *sig, size_t *out_sig_len, |
| 42 | size_t max_sig_len, const EC_KEY *key, const uint8_t *nonce, |
| 43 | size_t nonce_len); |
| 44 |
| 45 | // ecdsa_verify_fixed behaves like |ECDSA_verify| but uses the fixed-width, |
| 46 | // big-endian format from IEEE P1363. |
| 47 | int ecdsa_verify_fixed(const uint8_t *digest, size_t digest_len, |
| 48 | const uint8_t *sig, size_t sig_len, const EC_KEY *key); |
| 49 |
| 50 | // ecdsa_verify_fixed_no_self_test behaves like ecdsa_verify_fixed, but doesn't |
| 51 | // try to run the self-test first. This is for use in the self tests themselves, |
| 52 | // to prevent an infinite loop. |
| 53 | int ecdsa_verify_fixed_no_self_test(const uint8_t *digest, size_t digest_len, |
| 54 | const uint8_t *sig, size_t sig_len, |
| 55 | const EC_KEY *key); |
| 56 |
| 57 |
| 58 | #if defined(__cplusplus) |
| 59 | } |
| 60 | #endif |
| 61 |
| 62 | #endif // OPENSSL_HEADER_CRYPTO_FIPSMODULE_ECDSA_INTERNAL_H |
| 63 |