commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r802818 - in /commons/sandbox/runtime/trunk/src/main/native: Makefile.in Makefile.msc.in include/acr_crypto.h os/win32/wutil.c shared/md5.c shared/sha.c shared/sha1.c
Date Mon, 10 Aug 2009 14:57:45 GMT
Author: mturk
Date: Mon Aug 10 14:57:44 2009
New Revision: 802818

URL: http://svn.apache.org/viewvc?rev=802818&view=rev
Log:
Rename sha.c to sha1.c and capitalize API prefix

Added:
    commons/sandbox/runtime/trunk/src/main/native/shared/sha1.c
      - copied, changed from r802773, commons/sandbox/runtime/trunk/src/main/native/shared/sha.c
Removed:
    commons/sandbox/runtime/trunk/src/main/native/shared/sha.c
Modified:
    commons/sandbox/runtime/trunk/src/main/native/Makefile.in
    commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
    commons/sandbox/runtime/trunk/src/main/native/include/acr_crypto.h
    commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c
    commons/sandbox/runtime/trunk/src/main/native/shared/md5.c

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.in?rev=802818&r1=802817&r2=802818&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.in Mon Aug 10 14:57:44 2009
@@ -90,7 +90,7 @@
 	$(SRCDIR)/shared/object.$(OBJ) \
 	$(SRCDIR)/shared/base64.$(OBJ) \
 	$(SRCDIR)/shared/md5.$(OBJ) \
-	$(SRCDIR)/shared/sha.$(OBJ) \
+	$(SRCDIR)/shared/sha1.$(OBJ) \
 	$(SRCDIR)/shared/sbuf.$(OBJ) \
 	$(SRCDIR)/shared/string.$(OBJ) \
 	$(SRCDIR)/shared/tables.$(OBJ) \

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=802818&r1=802817&r2=802818&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Mon Aug 10 14:57:44 2009
@@ -82,7 +82,7 @@
 	$(SRCDIR)/shared/object.$(OBJ) \
 	$(SRCDIR)/shared/base64.$(OBJ) \
 	$(SRCDIR)/shared/md5.$(OBJ) \
-	$(SRCDIR)/shared/sha.$(OBJ) \
+	$(SRCDIR)/shared/sha1.$(OBJ) \
 	$(SRCDIR)/shared/sbuf.$(OBJ) \
 	$(SRCDIR)/shared/string.$(OBJ) \
 	$(SRCDIR)/shared/tables.$(OBJ) \

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_crypto.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_crypto.h?rev=802818&r1=802817&r2=802818&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_crypto.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_crypto.h Mon Aug 10 14:57:44
2009
@@ -62,7 +62,7 @@
  * Initialize the SHA digest
  * @param context The SHA context to initialize
  */
-ACR_DECLARE(void) ACR_Sha1Init(acr_sha1_ctx_t *context);
+ACR_DECLARE(void) ACR_SHA1Init(acr_sha1_ctx_t *context);
 
 /**
  * Update the SHA digest with binary data
@@ -70,7 +70,7 @@
  * @param input The buffer to add to the SHA digest
  * @param count The length of the input buffer
  */
-ACR_DECLARE(void) ACR_Sha1Update(acr_sha1_ctx_t *context,
+ACR_DECLARE(void) ACR_SHA1Update(acr_sha1_ctx_t *context,
                                  const unsigned char *input,
                                  size_t count);
 
@@ -80,7 +80,7 @@
  * @param input The buffer to add to the SHA digest
  * @param count The length of the input buffer
  */
-ACR_DECLARE(void) ACR_Sha1UpdateA(acr_sha1_ctx_t *context,
+ACR_DECLARE(void) ACR_SHA1UpdateA(acr_sha1_ctx_t *context,
                                   const char *input,
                                   size_t count);
 
@@ -90,7 +90,7 @@
  * @param input The buffer to add to the SHA digest
  * @param count The length of the input buffer
  */
-ACR_DECLARE(void) ACR_Sha1UpdateW(acr_sha1_ctx_t *context,
+ACR_DECLARE(void) ACR_SHA1UpdateW(acr_sha1_ctx_t *context,
                                   const wchar_t *input,
                                   size_t count);
 
@@ -99,7 +99,7 @@
  * @param digest the output buffer in which to store the digest
  * @param context The context to finalize
  */
-ACR_DECLARE(void) ACR_Sha1Final(unsigned char digest[ACR_SHA1_DIGEST_LENGTH],
+ACR_DECLARE(void) ACR_SHA1Final(unsigned char digest[ACR_SHA1_DIGEST_LENGTH],
                                 acr_sha1_ctx_t *context);
 
 /**
@@ -109,7 +109,7 @@
  * @param len The length of the plaintext data
  * @param out The encrypted/encoded password
  */
-ACR_DECLARE(char *) ACR_Sha1Base16A(const char *clear, size_t len, char *out);
+ACR_DECLARE(char *) ACR_SHA1Base16A(const char *clear, size_t len, char *out);
 
 /**
  * Provide a means to SHA1 crypt/encode a plaintext data using
@@ -118,14 +118,14 @@
  * @param len The length of the plaintext data
  * @param out The encrypted/encoded password
  */
-ACR_DECLARE(wchar_t *) ACR_Sha1Base16W(const wchar_t *clear, size_t len,
+ACR_DECLARE(wchar_t *) ACR_SHA1Base16W(const wchar_t *clear, size_t len,
                                        wchar_t *out);
 
 /**
  * Initialize the MD5 digest
  * @param context The MD5 context to initialize
  */
-ACR_DECLARE(void) ACR_Md5Init(acr_md5_ctx_t *ctx);
+ACR_DECLARE(void) ACR_MD5Init(acr_md5_ctx_t *ctx);
 
 /**
  * Update the MD5 digest with binary data
@@ -133,7 +133,7 @@
  * @param input The buffer to add to the MD5 digest
  * @param count The length of the input buffer
  */
-ACR_DECLARE(void) ACR_Md5Update(acr_md5_ctx_t *ctx,
+ACR_DECLARE(void) ACR_MD5Update(acr_md5_ctx_t *ctx,
                                 const unsigned char *input,
                                 size_t count);
 
@@ -143,7 +143,7 @@
  * @param input The buffer to add to the MD5 digest
  * @param count The length of the input buffer
  */
-ACR_DECLARE(void) ACR_Md5UpdateA(acr_md5_ctx_t *context,
+ACR_DECLARE(void) ACR_MD5UpdateA(acr_md5_ctx_t *context,
                                  const char *input,
                                  size_t count);
 
@@ -153,7 +153,7 @@
  * @param input The buffer to add to the MD5 digest
  * @param count The length of the input buffer
  */
-ACR_DECLARE(void) ACR_Md5UpdateW(acr_md5_ctx_t *context,
+ACR_DECLARE(void) ACR_MD5UpdateW(acr_md5_ctx_t *context,
                                  const wchar_t *input,
                                  size_t count);
 
@@ -162,7 +162,7 @@
  * @param digest the output buffer in which to store the digest
  * @param context The context to finalize
  */
-ACR_DECLARE(void) ACR_Md5Final(unsigned char digest[ACR_MD5_DIGEST_LENGTH],
+ACR_DECLARE(void) ACR_MD5Final(unsigned char digest[ACR_MD5_DIGEST_LENGTH],
                                acr_md5_ctx_t *context);
 
 /**
@@ -172,7 +172,7 @@
  * @param len The length of the plaintext data
  * @param out The encrypted/encoded password
  */
-ACR_DECLARE(char *) ACR_Md5Base16A(const char *clear, size_t len, char *out);
+ACR_DECLARE(char *) ACR_MD5Base16A(const char *clear, size_t len, char *out);
 
 /**
  * Provide a means to MD5 crypt/encode a plaintext data using
@@ -181,7 +181,7 @@
  * @param len The length of the plaintext data
  * @param out The encrypted/encoded password
  */
-ACR_DECLARE(wchar_t *) ACR_Md5Base16W(const wchar_t *clear, size_t len,
+ACR_DECLARE(wchar_t *) ACR_MD5Base16W(const wchar_t *clear, size_t len,
                                       wchar_t *out);
 
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c?rev=802818&r1=802817&r2=802818&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c Mon Aug 10 14:57:44 2009
@@ -50,9 +50,9 @@
     wcscat(rname, dtnames[type]);
     rc = GetFullPathNameW(fname, ACR_HBUFF_LEN, pname, NULL);
     if (rc == 0 || rc > ACR_HBUFF_LEN)
-        ACR_Sha1Base16W(fname, wcslen(fname), rname + 10);
+        ACR_SHA1Base16W(fname, wcslen(fname), rname + 10);
     else
-        ACR_Sha1Base16W(pname, wcslen(pname), rname + 10);
+        ACR_SHA1Base16W(pname, wcslen(pname), rname + 10);
     fprintf(stdout, "Converted %S from %S\n", rname, pname);
     fflush(stdout);
     return rname;
@@ -149,3 +149,4 @@
     }
     return 0;
 }
+

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/md5.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/md5.c?rev=802818&r1=802817&r2=802818&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/md5.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/md5.c Mon Aug 10 14:57:44 2009
@@ -70,7 +70,7 @@
  * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
  * initialization constants.
  */
-ACR_DECLARE(void) ACR_Md5Init(acr_md5_ctx_t *ctx)
+ACR_DECLARE(void) ACR_MD5Init(acr_md5_ctx_t *ctx)
 {
     ctx->count = 0;
     ctx->state[0] = 0x67452301;
@@ -198,7 +198,7 @@
  * of bytes.
  */
 ACR_DECLARE(void)
-ACR_Md5Update(acr_md5_ctx_t *ctx, const unsigned char *input, size_t len)
+ACR_MD5Update(acr_md5_ctx_t *ctx, const unsigned char *input, size_t len)
 {
     size_t have, need;
 
@@ -231,18 +231,18 @@
         memcpy(ctx->buffer + have, input, len);
 }
 
-ACR_DECLARE(void) ACR_Md5UpdateA(acr_md5_ctx_t *context,
+ACR_DECLARE(void) ACR_MD5UpdateA(acr_md5_ctx_t *context,
                                  const char *data,
                                  size_t count)
 {
-    ACR_Md5Update(context, (const unsigned char *)data, count);
+    ACR_MD5Update(context, (const unsigned char *)data, count);
 }
 
-ACR_DECLARE(void) ACR_Md5UpdateW(acr_md5_ctx_t *context,
+ACR_DECLARE(void) ACR_MD5UpdateW(acr_md5_ctx_t *context,
                                  const wchar_t *data,
                                  size_t count)
 {
-    ACR_Md5Update(context, (const unsigned char *)data,
+    ACR_MD5Update(context, (const unsigned char *)data,
                   count * sizeof(wchar_t));
 }
 
@@ -264,15 +264,15 @@
              (size_t)((ctx->count >> 3) & (ACR_MD5_BLOCK_LENGTH - 1));
     if (padlen < 1 + 8)
         padlen += ACR_MD5_BLOCK_LENGTH;
-    ACR_Md5Update(ctx, PADDING, padlen - 8);        /* padlen - 8 <= 64 */
-    ACR_Md5Update(ctx, count, 8);
+    ACR_MD5Update(ctx, PADDING, padlen - 8);        /* padlen - 8 <= 64 */
+    ACR_MD5Update(ctx, count, 8);
 }
 
 /*
  * Final wrapup--call MD5Pad, fill in digest and zero out ctx.
  */
 ACR_DECLARE(void)
-ACR_Md5Final(unsigned char digest[ACR_MD5_DIGEST_LENGTH], acr_md5_ctx_t *ctx)
+ACR_MD5Final(unsigned char digest[ACR_MD5_DIGEST_LENGTH], acr_md5_ctx_t *ctx)
 {
     int i;
 
@@ -284,7 +284,7 @@
     }
 }
 
-ACR_DECLARE(char *) ACR_Md5Base16A(const char *clear, size_t len, char *out)
+ACR_DECLARE(char *) ACR_MD5Base16A(const char *clear, size_t len, char *out)
 {
     int i, x = 0;
     acr_md5_ctx_t context;
@@ -293,9 +293,9 @@
     if (out == NULL && (out = malloc(ACR_MD5_DIGEST_STRING_LENGTH)) == NULL)
         return NULL;
 
-    ACR_Md5Init(&context);
-    ACR_Md5UpdateA(&context, clear, len);
-    ACR_Md5Final(digest, &context);
+    ACR_MD5Init(&context);
+    ACR_MD5UpdateA(&context, clear, len);
+    ACR_MD5Final(digest, &context);
     for (i = 0; i < ACR_MD5_DIGEST_LENGTH; i++) {
         out[x++] = HI_NIBBLE_HEX(digest[i]);
         out[x++] = LO_NIBBLE_HEX(digest[i]);
@@ -306,7 +306,7 @@
     return out;
 }
 
-ACR_DECLARE(wchar_t *) ACR_Md5Base16W(const wchar_t *clear, size_t len, wchar_t *out)
+ACR_DECLARE(wchar_t *) ACR_MD5Base16W(const wchar_t *clear, size_t len, wchar_t *out)
 {
     int i, x = 0;
     acr_md5_ctx_t context;
@@ -315,9 +315,9 @@
     if (out == NULL &&
        (out = malloc(ACR_MD5_DIGEST_STRING_LENGTH * sizeof(wchar_t))) == NULL)
         return NULL;
-    ACR_Md5Init(&context);
-    ACR_Md5UpdateW(&context, clear, len);
-    ACR_Md5Final(digest, &context);
+    ACR_MD5Init(&context);
+    ACR_MD5UpdateW(&context, clear, len);
+    ACR_MD5Final(digest, &context);
     for (i = 0; i < ACR_MD5_DIGEST_LENGTH; i++) {
         out[x++] = HI_NIBBLE_HEX(digest[i]);
         out[x++] = LO_NIBBLE_HEX(digest[i]);

Copied: commons/sandbox/runtime/trunk/src/main/native/shared/sha1.c (from r802773, commons/sandbox/runtime/trunk/src/main/native/shared/sha.c)
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/sha1.c?p2=commons/sandbox/runtime/trunk/src/main/native/shared/sha1.c&p1=commons/sandbox/runtime/trunk/src/main/native/shared/sha.c&r1=802773&r2=802818&rev=802818&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/sha.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/sha1.c Mon Aug 10 14:57:44 2009
@@ -131,7 +131,7 @@
 
 /* initialize the SHA digest */
 
-ACR_DECLARE(void) ACR_Sha1Init(acr_sha1_ctx_t *context)
+ACR_DECLARE(void) ACR_SHA1Init(acr_sha1_ctx_t *context)
 {
     /* SHA1 initialization constants */
     context->count = 0;
@@ -145,7 +145,7 @@
 /* 
  * Update the SHA digest
  */
-ACR_DECLARE(void) ACR_Sha1Update(acr_sha1_ctx_t *context,
+ACR_DECLARE(void) ACR_SHA1Update(acr_sha1_ctx_t *context,
                                  const unsigned char *data,
                                  size_t len)
 {
@@ -165,18 +165,18 @@
     memcpy(&context->buffer[j], &data[i], len - i);
 }
 
-ACR_DECLARE(void) ACR_Sha1UpdateA(acr_sha1_ctx_t *context,
+ACR_DECLARE(void) ACR_SHA1UpdateA(acr_sha1_ctx_t *context,
                                   const char *data,
                                   size_t count)
 {
-    ACR_Sha1Update(context, (const unsigned char *)data, count);
+    ACR_SHA1Update(context, (const unsigned char *)data, count);
 }
 
-ACR_DECLARE(void) ACR_Sha1UpdateW(acr_sha1_ctx_t *context,
+ACR_DECLARE(void) ACR_SHA1UpdateW(acr_sha1_ctx_t *context,
                                   const wchar_t *data,
                                   size_t count)
 {
-    ACR_Sha1Update(context, (const unsigned char *)data,
+    ACR_SHA1Update(context, (const unsigned char *)data,
                    count * sizeof(wchar_t));
 }
 
@@ -192,16 +192,16 @@
         finalcount[i] = (acr_byte_t)((context->count >>
             ((7 - (i & 7)) * 8)) & 255);    /* Endian independent */
     }
-    ACR_Sha1Update(context, (acr_byte_t *)"\200", 1);
+    ACR_SHA1Update(context, (acr_byte_t *)"\200", 1);
     while ((context->count & 504) != 448)
-        ACR_Sha1Update(context, (acr_byte_t *)"\0", 1);
-    ACR_Sha1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
+        ACR_SHA1Update(context, (acr_byte_t *)"\0", 1);
+    ACR_SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
 }
 
 /* 
  * Finish computing the SHA digest
  */
-ACR_DECLARE(void) ACR_Sha1Final(unsigned char digest[ACR_SHA1_DIGEST_LENGTH],
+ACR_DECLARE(void) ACR_SHA1Final(unsigned char digest[ACR_SHA1_DIGEST_LENGTH],
                                 acr_sha1_ctx_t *context)
 {
     unsigned int i;
@@ -216,7 +216,7 @@
     }
 }
 
-ACR_DECLARE(char *) ACR_Sha1Base16A(const char *clear, size_t len, char *out)
+ACR_DECLARE(char *) ACR_SHA1Base16A(const char *clear, size_t len, char *out)
 {
     int i, x = 0;
     acr_sha1_ctx_t context;
@@ -225,9 +225,9 @@
     if (out == NULL && (out = malloc(ACR_SHA1_DIGEST_STRING_LENGTH)) == NULL)
         return NULL;
 
-    ACR_Sha1Init(&context);
-    ACR_Sha1UpdateA(&context, clear, len);
-    ACR_Sha1Final(digest, &context);
+    ACR_SHA1Init(&context);
+    ACR_SHA1UpdateA(&context, clear, len);
+    ACR_SHA1Final(digest, &context);
     for (i = 0; i < ACR_SHA1_DIGEST_LENGTH; i++) {
         out[x++] = HI_NIBBLE_HEX(digest[i]);
         out[x++] = LO_NIBBLE_HEX(digest[i]);
@@ -238,7 +238,7 @@
     return out;
 }
 
-ACR_DECLARE(wchar_t *) ACR_Sha1Base16W(const wchar_t *clear, size_t len,
+ACR_DECLARE(wchar_t *) ACR_SHA1Base16W(const wchar_t *clear, size_t len,
                                        wchar_t *out)
 {
     int i, x = 0;
@@ -249,9 +249,9 @@
        (out = malloc(ACR_SHA1_DIGEST_STRING_LENGTH * sizeof(wchar_t))) == NULL)
         return NULL;
 
-    ACR_Sha1Init(&context);
-    ACR_Sha1UpdateW(&context, clear, len);
-    ACR_Sha1Final(digest, &context);
+    ACR_SHA1Init(&context);
+    ACR_SHA1UpdateW(&context, clear, len);
+    ACR_SHA1Final(digest, &context);
     for (i = 0; i < ACR_SHA1_DIGEST_LENGTH; i++) {
         out[x++] = HI_NIBBLE_HEX(digest[i]);
         out[x++] = LO_NIBBLE_HEX(digest[i]);



Mime
View raw message