mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Finished move of ap_md5 routines to apr_md5. Removed ap_md5.h.
Replaced more magic numbers with MD5_DIGESTSIZE. Yuck. Submitted by: William Rowe, Roy Fielding git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85017 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -63,11 +63,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ap_md5.h"
|
||||
#include "apr_md5.h"
|
||||
|
||||
API_EXPORT(char *) ap_md5(ap_pool_t *a, const unsigned char *string);
|
||||
API_EXPORT(char *) ap_md5_binary(ap_pool_t *a, const unsigned char *buf, int len);
|
||||
API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *p, AP_MD5_CTX * context);
|
||||
API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *p, ap_md5_ctx_t *context);
|
||||
API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -2560,7 +2560,7 @@ static int default_handler(request_rec *r)
|
||||
ap_mmap_offset((void**)&addr, mm ,0);
|
||||
|
||||
if (d->content_md5 & 1) {
|
||||
AP_MD5_CTX context;
|
||||
ap_md5_ctx_t context;
|
||||
|
||||
ap_MD5Init(&context);
|
||||
ap_MD5Update(&context, addr, (unsigned int)r->finfo.size);
|
||||
|
@@ -59,7 +59,7 @@
|
||||
/* Utility routines for Apache proxy */
|
||||
#include "mod_proxy.h"
|
||||
#include "http_main.h"
|
||||
#include "ap_md5.h"
|
||||
#include "apr_md5.h"
|
||||
#include "http_log.h"
|
||||
#include "util_uri.h"
|
||||
#include "util_date.h" /* get ap_checkmask() decl. */
|
||||
@@ -667,8 +667,8 @@ int ap_proxy_liststr(const char *list, const char *val)
|
||||
*/
|
||||
void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength)
|
||||
{
|
||||
AP_MD5_CTX context;
|
||||
unsigned char digest[16];
|
||||
ap_md5_ctx_t context;
|
||||
unsigned char digest[MD5_DIGESTSIZE];
|
||||
char tmp[26];
|
||||
int i, k, d;
|
||||
unsigned int x;
|
||||
@@ -714,8 +714,8 @@ void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength)
|
||||
|
||||
void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength)
|
||||
{
|
||||
AP_MD5_CTX context;
|
||||
unsigned char digest[16];
|
||||
ap_md5_ctx_t context;
|
||||
unsigned char digest[MD5_DIGESTSIZE];
|
||||
char tmp[22];
|
||||
int i, k, d;
|
||||
unsigned int x;
|
||||
|
@@ -93,8 +93,8 @@
|
||||
API_EXPORT(char *) ap_md5_binary(ap_pool_t *p, const unsigned char *buf, int length)
|
||||
{
|
||||
const char *hex = "0123456789abcdef";
|
||||
AP_MD5_CTX my_md5;
|
||||
unsigned char hash[16];
|
||||
ap_md5_ctx_t my_md5;
|
||||
unsigned char hash[MD5_DIGESTSIZE];
|
||||
char *r, result[33];
|
||||
int i;
|
||||
|
||||
@@ -106,7 +106,7 @@ API_EXPORT(char *) ap_md5_binary(ap_pool_t *p, const unsigned char *buf, int len
|
||||
ap_MD5Update(&my_md5, buf, (unsigned int)length);
|
||||
ap_MD5Final(hash, &my_md5);
|
||||
|
||||
for (i = 0, r = result; i < 16; i++) {
|
||||
for (i = 0, r = result; i < MD5_DIGESTSIZE; i++) {
|
||||
*r++ = hex[hash[i] >> 4];
|
||||
*r++ = hex[hash[i] & 0xF];
|
||||
}
|
||||
@@ -165,7 +165,7 @@ API_EXPORT(char *) ap_md5(ap_pool_t *p, const unsigned char *string)
|
||||
static char basis_64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *a, AP_MD5_CTX * context)
|
||||
API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *a, ap_md5_ctx_t *context)
|
||||
{
|
||||
unsigned char digest[18];
|
||||
char *encodedDigest;
|
||||
@@ -194,7 +194,7 @@ API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *a, AP_MD5_CTX * context)
|
||||
|
||||
API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile, int convert)
|
||||
{
|
||||
AP_MD5_CTX context;
|
||||
ap_md5_ctx_t context;
|
||||
unsigned char buf[1000];
|
||||
long length = 0;
|
||||
int nbytes;
|
||||
@@ -216,7 +216,7 @@ API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile, int convert)
|
||||
|
||||
API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile)
|
||||
{
|
||||
AP_MD5_CTX context;
|
||||
ap_md5_ctx_t context;
|
||||
unsigned char buf[1000];
|
||||
long length = 0;
|
||||
ap_ssize_t nbytes;
|
||||
|
@@ -69,10 +69,8 @@
|
||||
*/
|
||||
|
||||
#include "apr_lib.h"
|
||||
#include "ap_config.h"
|
||||
#include <sys/types.h>
|
||||
#include "ap.h"
|
||||
#include "ap_md5.h"
|
||||
#include "apr_md5.h"
|
||||
#include "apr_portable.h"
|
||||
#if defined(MPE) || defined(QNX) || defined(WIN32) || defined(__TANDEM) || defined(BEOS)
|
||||
#include <signal.h>
|
||||
#else
|
||||
@@ -142,8 +140,8 @@ static void putline(FILE *f, char *l)
|
||||
static void add_password(char *user, char *realm, FILE *f)
|
||||
{
|
||||
char *pw;
|
||||
AP_MD5_CTX context;
|
||||
unsigned char digest[16];
|
||||
ap_md5_ctx_t context;
|
||||
unsigned char digest[MD5_DIGESTSIZE];
|
||||
char string[MAX_STRING_LEN];
|
||||
char pwin[MAX_STRING_LEN];
|
||||
char pwv[MAX_STRING_LEN];
|
||||
@@ -174,7 +172,7 @@ static void add_password(char *user, char *realm, FILE *f)
|
||||
ap_MD5Update(&context, (unsigned char *) string, strlen(string));
|
||||
ap_MD5Final(digest, &context);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
for (i = 0; i < MD5_DIGESTSIZE; i++)
|
||||
fprintf(f, "%02x", digest[i]);
|
||||
|
||||
fprintf(f, "\n");
|
||||
|
Reference in New Issue
Block a user