~ubuntu-branches/debian/lenny/dropbear/lenny

« back to all changes in this revision

Viewing changes to libtomcrypt/sha512.c

  • Committer: Bazaar Package Importer
  • Author(s): Gerrit Pape
  • Date: 2005-05-25 22:38:17 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050525223817-fdl653extybmz1zb
Tags: 0.45-3
* debian/dropbear.init: init script prints human readable message in case
  it's disabled (closes: #309099).
* debian/dropbear.postinst: configure: restart service through init script
  instead of start.
* debian/dropbear.prerm: set -u -> set -e.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
 
91
91
/* compress 1024-bits */
92
92
#ifdef CLEAN_STACK
93
 
static void _sha512_compress(hash_state * md, unsigned char *buf)
 
93
static int _sha512_compress(hash_state * md, unsigned char *buf)
94
94
#else
95
 
static void sha512_compress(hash_state * md, unsigned char *buf)
 
95
static int  sha512_compress(hash_state * md, unsigned char *buf)
96
96
#endif
97
97
{
98
98
    ulong64 S[8], W[80], t0, t1;
151
151
    for (i = 0; i < 8; i++) {
152
152
        md->sha512.state[i] = md->sha512.state[i] + S[i];
153
153
    }
 
154
 
 
155
    return CRYPT_OK;
154
156
}
155
157
 
156
158
/* compress 1024-bits */
157
159
#ifdef CLEAN_STACK
158
 
static void sha512_compress(hash_state * md, unsigned char *buf)
 
160
static int sha512_compress(hash_state * md, unsigned char *buf)
159
161
{
160
 
    _sha512_compress(md, buf);
 
162
    int err;
 
163
    err = _sha512_compress(md, buf);
161
164
    burn_stack(sizeof(ulong64) * 90 + sizeof(int));
 
165
    return err;
162
166
}
163
167
#endif
164
168
 
165
169
/* init the sha512 state */
166
 
void sha512_init(hash_state * md)
 
170
int sha512_init(hash_state * md)
167
171
{
168
172
    _ARGCHK(md != NULL);
169
 
 
170
173
    md->sha512.curlen = 0;
171
174
    md->sha512.length = 0;
172
175
    md->sha512.state[0] = CONST64(0x6a09e667f3bcc908);
177
180
    md->sha512.state[5] = CONST64(0x9b05688c2b3e6c1f);
178
181
    md->sha512.state[6] = CONST64(0x1f83d9abfb41bd6b);
179
182
    md->sha512.state[7] = CONST64(0x5be0cd19137e2179);
 
183
    return CRYPT_OK;
180
184
}
181
185
 
182
186
HASH_PROCESS(sha512_process, sha512_compress, sha512, 128)