[darwinbuild-changes] [855] branches/PR-8279204/darwinxref/plugins/register.c
source_changes at macosforge.org
source_changes at macosforge.org
Fri Aug 6 09:39:39 PDT 2010
Revision: 855
http://trac.macosforge.org/projects/darwinbuild/changeset/855
Author: wsiegrist at apple.com
Date: 2010-08-06 09:39:37 -0700 (Fri, 06 Aug 2010)
Log Message:
-----------
Replace OpenSSL with CommonCrypto in register plugin
Modified Paths:
--------------
branches/PR-8279204/darwinxref/plugins/register.c
Modified: branches/PR-8279204/darwinxref/plugins/register.c
===================================================================
--- branches/PR-8279204/darwinxref/plugins/register.c 2010-08-06 16:28:26 UTC (rev 854)
+++ branches/PR-8279204/darwinxref/plugins/register.c 2010-08-06 16:39:37 UTC (rev 855)
@@ -43,7 +43,8 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
-#include <openssl/evp.h>
+#include <stdlib.h>
+#include <CommonCrypto/CommonDigest.h>
#include "sqlite3.h"
extern char** environ;
@@ -129,22 +130,13 @@
}
static char* calculate_digest(int fd) {
- unsigned char digstr[EVP_MAX_MD_SIZE];
- memset(digstr, 0, sizeof(digstr));
+ unsigned char md[20];
+ CC_SHA1_CTX c;
+ CC_SHA1_Init(&c);
- EVP_MD_CTX ctx;
- static const EVP_MD* md;
+ memset(md, 0, 20);
- if (md == NULL) {
- EVP_MD_CTX_init(&ctx);
- OpenSSL_add_all_digests();
- md = EVP_get_digestbyname("sha1");
- if (md == NULL) return NULL;
- }
-
- EVP_DigestInit(&ctx, md);
-
- unsigned int len;
+ ssize_t len;
const unsigned int blocklen = 8192;
static unsigned char* block = NULL;
if (block == NULL) {
@@ -155,11 +147,11 @@
if (len == 0) { close(fd); break; }
if ((len < 0) && (errno == EINTR)) continue;
if (len < 0) { close(fd); return NULL; }
- EVP_DigestUpdate(&ctx, block, len);
+ CC_SHA1_Update(&c, block, (size_t)len);
}
-
- EVP_DigestFinal(&ctx, digstr, &len);
- return format_digest(digstr);
+
+ CC_SHA1_Final(md, &c);
+ return format_digest(md);
}
static char* calculate_unprebound_digest(const char* filename);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100806/70cce7dc/attachment.html>
More information about the darwinbuild-changes
mailing list