You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Sander Striker <st...@samba-tng.org> on 2001/05/26 15:22:45 UTC

buckets, brigades, md5

Hi,

I'm doing some snooping around the code in apr-util and
I was wondering if someone can provide me with an example
on how to use them. (I don't want to go through the apache
code at the moment...) Maybe a testbucket program to fit
in the apr-util/test directory? :-)

Btw, I noticed Justin is planning on moving over md5 from
apr to apr-util. Any chance md4 is added to the crypto/
dir to?

Thanks, 

Sander


Re: buckets, brigades, md5

Posted by Greg Stein <gs...@lyra.org>.
On Sat, May 26, 2001 at 07:44:14PM +0200, Sander Striker wrote:
> [...]
> > Within httpd itself, filters contain bucket brigades.  I am not
> > currently aware of any other usage of bucket brigades outside of the
> > filter code.  IMHO, key files to look at in httpd-2.0 itself are 
> > server/util_filter.c and modules/http/http_protocol.c (see 
> > ap_http_filter).  mod_include and mod_tls also use filters.  Other
> > modules (such as my mod_mbox - see www.apachelabs.org) use them as well.
> > I tried to make the mod_mbox usage of filters fairly easy to understand
> > as I didn't find the mod_include code very easy to understand.  So, 
> > maybe the mod_mbox code might be easier to understand.
> 
> Ah, I took a peek there and it seems that I want to use filters... :-(
> Hmmm, are there plans to move these into apr-util? Or are they really
> hardcore apache?

The functions in util_filter.c are all quite Apache specific. Maybe some
stuff could be extracted, but we've never look too hard at the problem. If
you see something, and think it makes sense in APRUTIL (and can be
extracted), then just point it out...

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: [PATCH] md4 WAS: RE: buckets, brigades, md5

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Mon, May 28, 2001 at 11:00:40AM +0200, Sander Striker wrote:
> Hi,
> 
> [...]
> Sander> Regarding MD4, I only have a link to RFC1320 for you:
> Sander> http://www.faqs.org/rfcs/rfc1320.html
> Sander>
> Sander> Which contains reference code...
> 
> Greg> You want it, then you can do the work :-)  (i.e. post a patch)
> 
> Ok, here it is. It adds the following to apr:
> include/apr_md4.h
> passwd/apr_md4.c

IIRC, some of the Win32 password algorithms rely on MD4 - if so, I 
think this is why you guys want to see it.  It's been years since I
touched Win32, but a bell went off when you brought up MD4.

If no one beats me to it, I'll add this to apr-util/crypto.  No reason 
it should be in apr just because md5 is.  I'm planning to move md5 out 
to apr-util - just as soon as I figure out what to do with uuid.

FWIW, I have a first pass at the date stuff ready for apr-util.

As I'm still waiting for my apache.org account to be created (I think it
might have gotten delayed to due to other issues - I can wait until they
are addressed), I can't commit just yet.  So, this may take a few days 
for me to add.  If someone else wants to go ahead before then, feel free.
Nothing much I can do right now.  =)

Once I'm ready to commit this, I'll look at the code to make sure I 
don't have any gotchas or comments on it - someone else may review 
it before then.  I won't look at it until I'm ready to commit.  If 
I have any concerns, I'll post them then.  -- justin


[PATCH] md4 WAS: RE: buckets, brigades, md5

Posted by Sander Striker <st...@samba-tng.org>.
Hi,

[...]
Sander> Regarding MD4, I only have a link to RFC1320 for you:
Sander> http://www.faqs.org/rfcs/rfc1320.html
Sander>
Sander> Which contains reference code...

Greg> You want it, then you can do the work :-)  (i.e. post a patch)

Ok, here it is. It adds the following to apr:
include/apr_md4.h
passwd/apr_md4.c

This is probably not the correct location. It actually should go in
apr-util in the crypto department, but anyway.
Oh, come to think of it, since there is no apr_md4_encode function,
the #includes can probably be cleaned up in apr_md4.c.

I also updated the md5 code (removed all tab characters and the reference
to UINT4, which really should be an apr_uint32_t instead of a typedef'd
unsigned int).

Greg> Although... I would ask, "who needs this?" I don't think that MD4 is
Greg> generally useful, so I would question its inclusion into APRUTIL. MD5
and
Greg> SHA1... those are modern/current and get used. But MD4? I had
completely
Greg> forgotten about that one until you mentioned it.

Well some old code uses md4. And sometimes you just need to stay backwards
compatible.

Sander




Re: buckets, brigades, md5

Posted by Greg Stein <gs...@lyra.org>.
On Sat, May 26, 2001 at 07:46:02PM +0200, Sander Striker wrote:
> > Regarding MD4, I only have a link to RFC1320 for you:
> > http://www.faqs.org/rfcs/rfc1320.html
> 
> Which contains reference code... 

You want it, then you can do the work :-)  (i.e. post a patch)

Although... I would ask, "who needs this?" I don't think that MD4 is
generally useful, so I would question its inclusion into APRUTIL. MD5 and
SHA1... those are modern/current and get used. But MD4? I had completely
forgotten about that one until you mentioned it.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

RE: buckets, brigades, md5

Posted by Sander Striker <st...@samba-tng.org>.
> Regarding MD4, I only have a link to RFC1320 for you:
> http://www.faqs.org/rfcs/rfc1320.html

Which contains reference code... 
 
Sander


RE: buckets, brigades, md5

Posted by Sander Striker <st...@samba-tng.org>.
[...]
> Within httpd itself, filters contain bucket brigades.  I am not
> currently aware of any other usage of bucket brigades outside of the
> filter code.  IMHO, key files to look at in httpd-2.0 itself are 
> server/util_filter.c and modules/http/http_protocol.c (see 
> ap_http_filter).  mod_include and mod_tls also use filters.  Other
> modules (such as my mod_mbox - see www.apachelabs.org) use them as well.
> I tried to make the mod_mbox usage of filters fairly easy to understand
> as I didn't find the mod_include code very easy to understand.  So, 
> maybe the mod_mbox code might be easier to understand.

Ah, I took a peek there and it seems that I want to use filters... :-(
Hmmm, are there plans to move these into apr-util? Or are they really
hardcore apache?

[...]
> If you come up with a good example program, post it.  =)  I might
> eventually add something, but no guarantees.  I have lots of things I
> want to do first.

Same here :-)

> But, yeah, a program that easily showcases bucket
> brigades outside of httpd-2.0 isn't a bad idea.  However, bucket
> brigades are so tied into httpd-2.0, it is really hard to come up with
> an example.
 
>> Btw, I noticed Justin is planning on moving over md5 from
>> apr to apr-util. Any chance md4 is added to the crypto/
>> dir to?
> 
> Someone have reference code for md4?  I believe I'll be able to extract
> md5 out of apr, but first I need something to implement randomness in 
> APR.  Lots of dependencies at each step.  Baby steps...  -- justin

You could do something very dirty and copy the md5 code to a non
exported area of apr so you can still use it in the uuid code.
This way you can move (a copy of) the md5 code to apr-util.

Regarding MD4, I only have a link to RFC1320 for you:
http://www.faqs.org/rfcs/rfc1320.html

Sander


Re: buckets, brigades, md5

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Sat, May 26, 2001 at 03:22:45PM +0200, Sander Striker wrote:
> Hi,
> 
> I'm doing some snooping around the code in apr-util and
> I was wondering if someone can provide me with an example
> on how to use them. (I don't want to go through the apache
> code at the moment...) Maybe a testbucket program to fit
> in the apr-util/test directory? :-)

Buckets brigades are fairly straightforward (so I say).  Someone 
else (Roy or Ryan?) may have a more coherent explanation.  A bucket 
is some sort of data (heap, file, mmap, etc), while a brigade is a 
set of buckets.  But, you knew that.  

You can add buckets anywhere in the brigade (a brigade is typically
implemented as linked-list, IIRC).  There are certain types of buckets -
see the APR_BUCKET_IS_* #defines in apr_buckets.h.  Somewhere in 
apr_buckets.h is code for easily traversing a brigade (see 
APR_BRIGADE_FOREACH in apr_buckets.h and the comment above it describes 
how to traverse it).

Within httpd itself, filters contain bucket brigades.  I am not
currently aware of any other usage of bucket brigades outside of the
filter code.  IMHO, key files to look at in httpd-2.0 itself are 
server/util_filter.c and modules/http/http_protocol.c (see 
ap_http_filter).  mod_include and mod_tls also use filters.  Other
modules (such as my mod_mbox - see www.apachelabs.org) use them as well.
I tried to make the mod_mbox usage of filters fairly easy to understand
as I didn't find the mod_include code very easy to understand.  So, 
maybe the mod_mbox code might be easier to understand.

Rather than listen to me ramble, you might just be better off reading 
Roy's initial post on bucket brigades:

http://www.apachelabs.org/apache-mbox/199911.mbox/%3c199911122357.aa18914@gremlin-relay.ics.uci.edu%3e

I do know that what Roy described isn't exactly what was implemented, 
but it is close enough to get the general idea.

If you come up with a good example program, post it.  =)  I might
eventually add something, but no guarantees.  I have lots of things I
want to do first.  But, yeah, a program that easily showcases bucket
brigades outside of httpd-2.0 isn't a bad idea.  However, bucket
brigades are so tied into httpd-2.0, it is really hard to come up with
an example.

> Btw, I noticed Justin is planning on moving over md5 from
> apr to apr-util. Any chance md4 is added to the crypto/
> dir to?

Someone have reference code for md4?  I believe I'll be able to extract
md5 out of apr, but first I need something to implement randomness in 
APR.  Lots of dependencies at each step.  Baby steps...  -- justin