xref: /openbsd-src/lib/libcrypto/ecdsa/ecdsa_local.h (revision 3e6ba5886cbe4cc72928d4b2589ebe61df798adc)
1*3e6ba588Stb /* $OpenBSD: ecdsa_local.h,v 1.2 2023/07/28 15:50:33 tb Exp $ */
29243ef13Stb /*
39243ef13Stb  * Written by Nils Larsch for the OpenSSL project
49243ef13Stb  */
59243ef13Stb /* ====================================================================
69243ef13Stb  * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
79243ef13Stb  *
89243ef13Stb  * Redistribution and use in source and binary forms, with or without
99243ef13Stb  * modification, are permitted provided that the following conditions
109243ef13Stb  * are met:
119243ef13Stb  *
129243ef13Stb  * 1. Redistributions of source code must retain the above copyright
139243ef13Stb  *    notice, this list of conditions and the following disclaimer.
149243ef13Stb  *
159243ef13Stb  * 2. Redistributions in binary form must reproduce the above copyright
169243ef13Stb  *    notice, this list of conditions and the following disclaimer in
179243ef13Stb  *    the documentation and/or other materials provided with the
189243ef13Stb  *    distribution.
199243ef13Stb  *
209243ef13Stb  * 3. All advertising materials mentioning features or use of this
219243ef13Stb  *    software must display the following acknowledgment:
229243ef13Stb  *    "This product includes software developed by the OpenSSL Project
239243ef13Stb  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
249243ef13Stb  *
259243ef13Stb  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
269243ef13Stb  *    endorse or promote products derived from this software without
279243ef13Stb  *    prior written permission. For written permission, please contact
289243ef13Stb  *    licensing@OpenSSL.org.
299243ef13Stb  *
309243ef13Stb  * 5. Products derived from this software may not be called "OpenSSL"
319243ef13Stb  *    nor may "OpenSSL" appear in their names without prior written
329243ef13Stb  *    permission of the OpenSSL Project.
339243ef13Stb  *
349243ef13Stb  * 6. Redistributions of any form whatsoever must retain the following
359243ef13Stb  *    acknowledgment:
369243ef13Stb  *    "This product includes software developed by the OpenSSL Project
379243ef13Stb  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
389243ef13Stb  *
399243ef13Stb  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
409243ef13Stb  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
419243ef13Stb  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
429243ef13Stb  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
439243ef13Stb  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
449243ef13Stb  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
459243ef13Stb  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
469243ef13Stb  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
479243ef13Stb  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
489243ef13Stb  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
499243ef13Stb  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
509243ef13Stb  * OF THE POSSIBILITY OF SUCH DAMAGE.
519243ef13Stb  * ====================================================================
529243ef13Stb  *
539243ef13Stb  * This product includes cryptographic software written by Eric Young
549243ef13Stb  * (eay@cryptsoft.com).  This product includes software written by Tim
559243ef13Stb  * Hudson (tjh@cryptsoft.com).
569243ef13Stb  *
579243ef13Stb  */
589243ef13Stb 
599243ef13Stb #ifndef HEADER_ECS_LOCAL_H
609243ef13Stb #define HEADER_ECS_LOCAL_H
619243ef13Stb 
62*3e6ba588Stb #include <openssl/ec.h>
639243ef13Stb 
649243ef13Stb __BEGIN_HIDDEN_DECLS
659243ef13Stb 
669243ef13Stb struct ECDSA_SIG_st {
679243ef13Stb 	BIGNUM *r;
689243ef13Stb 	BIGNUM *s;
699243ef13Stb };
709243ef13Stb 
719243ef13Stb int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *in_ctx, BIGNUM **out_kinv,
729243ef13Stb     BIGNUM **out_r);
739243ef13Stb int ecdsa_sign(int type, const unsigned char *digest, int digest_len,
749243ef13Stb     unsigned char *signature, unsigned int *signature_len, const BIGNUM *kinv,
759243ef13Stb     const BIGNUM *r, EC_KEY *eckey);
769243ef13Stb ECDSA_SIG *ecdsa_sign_sig(const unsigned char *digest, int digest_len,
779243ef13Stb     const BIGNUM *in_kinv, const BIGNUM *in_r, EC_KEY *eckey);
789243ef13Stb 
799243ef13Stb __END_HIDDEN_DECLS
809243ef13Stb 
819243ef13Stb #endif /* !HEADER_ECS_LOCAL_H */
82