xref: /aosp_15_r20/external/boringssl/src/crypto/fipsmodule/ecdsa/internal.h (revision 8fb009dc861624b67b6cdb62ea21f0f22d0c584b)
1 /* Copyright (c) 2021, Google Inc.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
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 #if defined(__cplusplus)
21 extern "C" {
22 #endif
23 
24 
25 // ecdsa_sign_with_nonce_for_known_answer_test behaves like |ECDSA_do_sign| but
26 // takes a fixed nonce. This function is used as part of known-answer tests in
27 // the FIPS module.
28 ECDSA_SIG *ecdsa_sign_with_nonce_for_known_answer_test(const uint8_t *digest,
29                                                        size_t digest_len,
30                                                        const EC_KEY *eckey,
31                                                        const uint8_t *nonce,
32                                                        size_t nonce_len);
33 
34 // ecdsa_do_verify_no_self_test does the same as |ECDSA_do_verify|, but doesn't
35 // try to run the self-test first. This is for use in the self tests themselves,
36 // to prevent an infinite loop.
37 int ecdsa_do_verify_no_self_test(const uint8_t *digest, size_t digest_len,
38                                  const ECDSA_SIG *sig, const EC_KEY *eckey);
39 
40 
41 #if defined(__cplusplus)
42 }
43 #endif
44 
45 #endif  // OPENSSL_HEADER_CRYPTO_FIPSMODULE_ECDSA_INTERNAL_H
46