comparison libtomcrypt/src/pk/dsa/dsa_sign_hash.c @ 1439:8d24733026c5 coverity

merge
author Matt Johnston <matt@ucc.asn.au>
date Sat, 24 Jun 2017 23:33:16 +0800
parents f849a5ca2efc
children 6dba84798cd5
comparison
equal deleted inserted replaced
1400:238a439670f5 1439:8d24733026c5
4 * algorithms in a highly modular and flexible manner. 4 * algorithms in a highly modular and flexible manner.
5 * 5 *
6 * The library is free for all purposes without any express 6 * The library is free for all purposes without any express
7 * guarantee it works. 7 * guarantee it works.
8 * 8 *
9 * Tom St Denis, [email protected], http://libtomcrypt.com 9 * Tom St Denis, [email protected], http://libtom.org
10 */ 10 */
11 #include "tomcrypt.h" 11 #include "tomcrypt.h"
12 12
13 /** 13 /**
14 @file dsa_sign_hash.c 14 @file dsa_sign_hash.c
15 DSA implementation, sign a hash, Tom St Denis 15 DSA implementation, sign a hash, Tom St Denis
16 */ 16 */
17 17
18 #ifdef MDSA 18 #ifdef LTC_MDSA
19 19
20 /** 20 /**
21 Sign a hash with DSA 21 Sign a hash with DSA
22 @param in The hash to sign 22 @param in The hash to sign
23 @param inlen The length of the hash to sign 23 @param inlen The length of the hash to sign
47 if (key->type != PK_PRIVATE) { 47 if (key->type != PK_PRIVATE) {
48 return CRYPT_PK_NOT_PRIVATE; 48 return CRYPT_PK_NOT_PRIVATE;
49 } 49 }
50 50
51 /* check group order size */ 51 /* check group order size */
52 if (key->qord >= MDSA_MAX_GROUP) { 52 if (key->qord >= LTC_MDSA_MAX_GROUP) {
53 return CRYPT_INVALID_ARG; 53 return CRYPT_INVALID_ARG;
54 } 54 }
55 55
56 buf = XMALLOC(MDSA_MAX_GROUP); 56 buf = XMALLOC(LTC_MDSA_MAX_GROUP);
57 if (buf == NULL) { 57 if (buf == NULL) {
58 return CRYPT_MEM; 58 return CRYPT_MEM;
59 } 59 }
60 60
61 /* Init our temps */ 61 /* Init our temps */
100 err = CRYPT_OK; 100 err = CRYPT_OK;
101 error: 101 error:
102 mp_clear_multi(k, kinv, tmp, NULL); 102 mp_clear_multi(k, kinv, tmp, NULL);
103 ERRBUF: 103 ERRBUF:
104 #ifdef LTC_CLEAN_STACK 104 #ifdef LTC_CLEAN_STACK
105 zeromem(buf, MDSA_MAX_GROUP); 105 zeromem(buf, LTC_MDSA_MAX_GROUP);
106 #endif 106 #endif
107 XFREE(buf); 107 XFREE(buf);
108 return err; 108 return err;
109 } 109 }
110 110
149 return err; 149 return err;
150 } 150 }
151 151
152 #endif 152 #endif
153 153
154 /* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_sign_hash.c,v $ */ 154 /* $Source$ */
155 /* $Revision: 1.12 $ */ 155 /* $Revision$ */
156 /* $Date: 2006/12/04 22:27:56 $ */ 156 /* $Date$ */