wolfSSL SSL/TLS library, support up to TLS1.3

Dependents:   OS

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dsa.h Source File

dsa.h

00001 /* dsa.h
00002  *
00003  * Copyright (C) 2006-2017 wolfSSL Inc.
00004  *
00005  * This file is part of wolfSSL.
00006  *
00007  * wolfSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * wolfSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00020  */
00021 
00022 /* dsa.h for openSSL */
00023 
00024 
00025 #ifndef WOLFSSL_DSA_H_
00026 #define WOLFSSL_DSA_H_
00027 
00028 #include <wolfssl/openssl/bn.h>
00029 
00030 #ifdef __cplusplus
00031     extern "C" {
00032 #endif
00033 
00034 #ifndef WOLFSSL_DSA_TYPE_DEFINED /* guard on redeclaration */
00035 typedef struct WOLFSSL_DSA            WOLFSSL_DSA;
00036 #define WOLFSSL_DSA_TYPE_DEFINED
00037 #endif
00038 
00039 typedef WOLFSSL_DSA                   DSA;
00040 
00041 struct WOLFSSL_DSA {
00042     WOLFSSL_BIGNUM* p;
00043     WOLFSSL_BIGNUM* q;
00044     WOLFSSL_BIGNUM* g;
00045     WOLFSSL_BIGNUM* pub_key;      /* our y */
00046     WOLFSSL_BIGNUM* priv_key;     /* our x */
00047     void*          internal;     /* our Dsa Key */
00048     char           inSet;        /* internal set from external ? */
00049     char           exSet;        /* external set from internal ? */
00050 };
00051 
00052 
00053 WOLFSSL_API WOLFSSL_DSA* wolfSSL_DSA_new(void);
00054 WOLFSSL_API void wolfSSL_DSA_free(WOLFSSL_DSA*);
00055 
00056 WOLFSSL_API int wolfSSL_DSA_generate_key(WOLFSSL_DSA*);
00057 
00058 typedef void (*WOLFSSL_BN_CB)(int i, int j, void* exArg);
00059 WOLFSSL_API WOLFSSL_DSA* wolfSSL_DSA_generate_parameters(int bits,
00060                    unsigned char* seed, int seedLen, int* counterRet,
00061                    unsigned long* hRet, WOLFSSL_BN_CB cb, void* CBArg);
00062 WOLFSSL_API int wolfSSL_DSA_generate_parameters_ex(WOLFSSL_DSA*, int bits,
00063                    unsigned char* seed, int seedLen, int* counterRet,
00064                    unsigned long* hRet, void* cb);
00065 
00066 WOLFSSL_API int wolfSSL_DSA_LoadDer(WOLFSSL_DSA*, const unsigned char*, int sz);
00067 
00068 WOLFSSL_API int wolfSSL_DSA_do_sign(const unsigned char* d,
00069                                     unsigned char* sigRet, WOLFSSL_DSA* dsa);
00070 
00071 WOLFSSL_API int wolfSSL_DSA_do_verify(const unsigned char* d,
00072                                       unsigned char* sig,
00073                                       WOLFSSL_DSA* dsa, int *dsacheck);
00074 
00075 #define DSA_new wolfSSL_DSA_new
00076 #define DSA_free wolfSSL_DSA_free
00077 
00078 #define DSA_generate_key           wolfSSL_DSA_generate_key
00079 #define DSA_generate_parameters    wolfSSL_DSA_generate_parameters
00080 #define DSA_generate_parameters_ex wolfSSL_DSA_generate_parameters_ex
00081 
00082 
00083 #ifdef __cplusplus
00084     }  /* extern "C" */ 
00085 #endif
00086 
00087 #endif /* header */
00088