X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=mozilla-sha1%2Fsha1.c;h=95a4ebf49612e4f1bb74e8c5e395d564a797de1f;hb=edacb101ef831cdc59d07015b1b5cd1aaddcc588;hp=847531d19f88e420ad68f95f11ab2f1f77876d08;hpb=b8336519450fdedc8f9cafebc73f7a0226e34e1f;p=git.git diff --git a/mozilla-sha1/sha1.c b/mozilla-sha1/sha1.c index 847531d19..95a4ebf49 100644 --- a/mozilla-sha1/sha1.c +++ b/mozilla-sha1/sha1.c @@ -1,29 +1,29 @@ -/* +/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ - * + * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. - * + * * The Original Code is SHA 180-1 Reference Implementation (Compact version) - * + * * The Initial Developer of the Original Code is Paul Kocher of - * Cryptography Research. Portions created by Paul Kocher are + * Cryptography Research. Portions created by Paul Kocher are * Copyright (C) 1995-9 by Cryptography Research, Inc. All * Rights Reserved. - * + * * Contributor(s): * * Paul Kocher - * + * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the - * "GPL"), in which case the provisions of the GPL are applicable - * instead of those above. If you wish to allow use of your + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and @@ -35,9 +35,9 @@ #include "sha1.h" -static void shaHashBlock(SHA_CTX *ctx); +static void shaHashBlock(moz_SHA_CTX *ctx); -void SHA1_Init(SHA_CTX *ctx) { +void moz_SHA1_Init(moz_SHA_CTX *ctx) { int i; ctx->lenW = 0; @@ -56,7 +56,7 @@ void SHA1_Init(SHA_CTX *ctx) { } -void SHA1_Update(SHA_CTX *ctx, const void *_dataIn, int len) { +void moz_SHA1_Update(moz_SHA_CTX *ctx, const void *_dataIn, int len) { const unsigned char *dataIn = _dataIn; int i; @@ -75,7 +75,7 @@ void SHA1_Update(SHA_CTX *ctx, const void *_dataIn, int len) { } -void SHA1_Final(unsigned char hashout[20], SHA_CTX *ctx) { +void moz_SHA1_Final(unsigned char hashout[20], moz_SHA_CTX *ctx) { unsigned char pad0x80 = 0x80; unsigned char pad0x00 = 0x00; unsigned char padlen[8]; @@ -91,10 +91,10 @@ void SHA1_Final(unsigned char hashout[20], SHA_CTX *ctx) { padlen[5] = (unsigned char)((ctx->sizeLo >> 16) & 255); padlen[6] = (unsigned char)((ctx->sizeLo >> 8) & 255); padlen[7] = (unsigned char)((ctx->sizeLo >> 0) & 255); - SHA1_Update(ctx, &pad0x80, 1); + moz_SHA1_Update(ctx, &pad0x80, 1); while (ctx->lenW != 56) - SHA1_Update(ctx, &pad0x00, 1); - SHA1_Update(ctx, padlen, 8); + moz_SHA1_Update(ctx, &pad0x00, 1); + moz_SHA1_Update(ctx, padlen, 8); /* Output hash */ @@ -106,13 +106,13 @@ void SHA1_Final(unsigned char hashout[20], SHA_CTX *ctx) { /* * Re-initialize the context (also zeroizes contents) */ - SHA1_Init(ctx); + moz_SHA1_Init(ctx); } #define SHA_ROT(X,n) (((X) << (n)) | ((X) >> (32-(n)))) -static void shaHashBlock(SHA_CTX *ctx) { +static void shaHashBlock(moz_SHA_CTX *ctx) { int t; unsigned int A,B,C,D,E,TEMP; @@ -149,4 +149,3 @@ static void shaHashBlock(SHA_CTX *ctx) { ctx->H[3] += D; ctx->H[4] += E; } -