Remove the unused sha224 functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
diff --git a/cgminer.c b/cgminer.c
index e0acbe5..2c74531 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1345,8 +1345,8 @@ static void calc_midstate(struct work *work)
for (swapcounter = 0; swapcounter < 16; swapcounter++)
data.i[swapcounter] = swab32(((uint32_t*) (work->data))[swapcounter]);
sha2_context ctx;
- sha2_starts( &ctx, 0 );
- sha2_update( &ctx, data.c, 64 );
+ sha2_starts(&ctx);
+ sha2_update(&ctx, data.c, 64);
memcpy(work->midstate, ctx.state, sizeof(work->midstate));
#if defined(__BIG_ENDIAN__) || defined(MIPSEB)
int i;
@@ -2156,8 +2156,8 @@ bool regeneratehash(const struct work *work)
for (i = 0; i < 80 / 4; i++)
swap32[i] = swab32(data32[i]);
- sha2(swap, 80, hash1, false);
- sha2(hash1, 32, (unsigned char *)(work->hash), false);
+ sha2(swap, 80, hash1);
+ sha2(hash1, 32, (unsigned char *)(work->hash));
difficulty = swab32(*((uint32_t *)(work->data + 72)));
@@ -4951,8 +4951,8 @@ static void gen_hash(unsigned char *data, unsigned char *hash, int len)
{
unsigned char hash1[32];
- sha2(data, len, hash1, false);
- sha2(hash1, 32, hash, false);
+ sha2(data, len, hash1);
+ sha2(hash1, 32, hash);
}
/* Diff 1 is a 256 bit unsigned integer of
@@ -5132,8 +5132,8 @@ static bool hashtest(struct thr_info *thr, struct work *work)
bool ret = false;
flip80(swap32, data32);
- sha2(swap, 80, hash1, false);
- sha2(hash1, 32, hash2, false);
+ sha2(swap, 80, hash1);
+ sha2(hash1, 32, hash2);
flip32(work->hash, hash2_32);
/* Flipped or not, hash2_32[7] should be 0 */
diff --git a/driver-ztex.c b/driver-ztex.c
index ba3e7bb..23aa97e 100644
--- a/driver-ztex.c
+++ b/driver-ztex.c
@@ -171,8 +171,8 @@ static bool ztex_checkNonce(struct libztex_device *ztex,
for (i = 0; i < 80 / 4; i++)
swap32[i] = swab32(data32[i]);
- sha2(swap, 80, hash1, false);
- sha2(hash1, 32, hash2, false);
+ sha2(swap, 80, hash1);
+ sha2(hash1, 32, hash2);
#if defined(__BIGENDIAN__) || defined(MIPSEB)
if (hash2_32[7] != ((hdata->hash7 + 0x5be0cd19) & 0xFFFFFFFF)) {
#else
diff --git a/sha2.c b/sha2.c
index caad666..55a1b35 100644
--- a/sha2.c
+++ b/sha2.c
@@ -60,37 +60,19 @@
/*
* SHA-256 context setup
*/
-void sha2_starts( sha2_context *ctx, int is224 )
+void sha2_starts( sha2_context *ctx )
{
ctx->total[0] = 0;
ctx->total[1] = 0;
- if( is224 == 0 )
- {
- /* SHA-256 */
- ctx->state[0] = 0x6A09E667;
- ctx->state[1] = 0xBB67AE85;
- ctx->state[2] = 0x3C6EF372;
- ctx->state[3] = 0xA54FF53A;
- ctx->state[4] = 0x510E527F;
- ctx->state[5] = 0x9B05688C;
- ctx->state[6] = 0x1F83D9AB;
- ctx->state[7] = 0x5BE0CD19;
- }
- else
- {
- /* SHA-224 */
- ctx->state[0] = 0xC1059ED8;
- ctx->state[1] = 0x367CD507;
- ctx->state[2] = 0x3070DD17;
- ctx->state[3] = 0xF70E5939;
- ctx->state[4] = 0xFFC00B31;
- ctx->state[5] = 0x68581511;
- ctx->state[6] = 0x64F98FA7;
- ctx->state[7] = 0xBEFA4FA4;
- }
-
- ctx->is224 = is224;
+ ctx->state[0] = 0x6A09E667;
+ ctx->state[1] = 0xBB67AE85;
+ ctx->state[2] = 0x3C6EF372;
+ ctx->state[3] = 0xA54FF53A;
+ ctx->state[4] = 0x510E527F;
+ ctx->state[5] = 0x9B05688C;
+ ctx->state[6] = 0x1F83D9AB;
+ ctx->state[7] = 0x5BE0CD19;
}
static void sha2_process( sha2_context *ctx, const unsigned char data[64] )
@@ -306,19 +288,18 @@ void sha2_finish( sha2_context *ctx, unsigned char output[32] )
PUT_ULONG_BE( ctx->state[5], output, 20 );
PUT_ULONG_BE( ctx->state[6], output, 24 );
- if( ctx->is224 == 0 )
- PUT_ULONG_BE( ctx->state[7], output, 28 );
+ PUT_ULONG_BE( ctx->state[7], output, 28 );
}
/*
* output = SHA-256( input buffer )
*/
void sha2( const unsigned char *input, int ilen,
- unsigned char output[32], int is224 )
+ unsigned char output[32] )
{
sha2_context ctx;
- sha2_starts( &ctx, is224 );
+ sha2_starts( &ctx );
sha2_update( &ctx, input, ilen );
sha2_finish( &ctx, output );
diff --git a/sha2.h b/sha2.h
index e7299de..ec5142f 100644
--- a/sha2.h
+++ b/sha2.h
@@ -39,7 +39,6 @@ typedef struct
unsigned char ipad[64]; /*!< HMAC: inner padding */
unsigned char opad[64]; /*!< HMAC: outer padding */
- int is224; /*!< 0 => SHA-256, else SHA-224 */
}
sha2_context;
@@ -51,9 +50,8 @@ extern "C" {
* \brief SHA-256 context setup
*
* \param ctx context to be initialized
- * \param is224 0 = use SHA256, 1 = use SHA224
*/
-void sha2_starts( sha2_context *ctx, int is224 );
+void sha2_starts( sha2_context *ctx);
/**
* \brief SHA-256 process buffer
@@ -68,7 +66,7 @@ void sha2_update( sha2_context *ctx, const unsigned char *input, int ilen );
* \brief SHA-256 final digest
*
* \param ctx SHA-256 context
- * \param output SHA-224/256 checksum result
+ * \param output SHA-256 checksum result
*/
void sha2_finish( sha2_context *ctx, unsigned char output[32] );
@@ -77,11 +75,10 @@ void sha2_finish( sha2_context *ctx, unsigned char output[32] );
*
* \param input buffer holding the data
* \param ilen length of the input data
- * \param output SHA-224/256 checksum result
- * \param is224 0 = use SHA256, 1 = use SHA224
+ * \param output SHA-256 checksum result
*/
void sha2( const unsigned char *input, int ilen,
- unsigned char output[32], int is224 );
+ unsigned char output[32]);
#ifdef __cplusplus
}