Skip to content

Commit

Permalink
Replace SHA-1 library with one that is clearly licensed.
Browse files Browse the repository at this point in the history
The SHA-1 library that we used until now was taken from RFC 3174.  That
library has no clearly free license statement, only a license on the text
of the RFC.  This commit replaces this library with a modified version of
the code from the Apache Portable Runtime library from apr.apache.org,
which is licensed under the Apache 2.0 license, the same as the rest of
Open vSwitch.
  • Loading branch information
blp committed Jun 15, 2009
1 parent a14bc59 commit 5eccf35
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 431 deletions.
15 changes: 15 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This file is included in compliance with the Apache 2.0 license,
available at http://www.apache.org/licenses/LICENSE-2.0.html

Open vSwitch
Copyright (c) 2007, 2008, 2009 Nicira Networks.

Apache Portable Runtime
Copyright 2008 The Apache Software Foundation.

This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).

Portions of this software were developed at the National Center
for Supercomputing Applications (NCSA) at the University of
Illinois at Urbana-Champaign.
17 changes: 5 additions & 12 deletions lib/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,15 @@ cfg_set_file(const char *file_name)
static int
update_cookie(void)
{
struct sha1_ctx context;
int i;
SHA1Context context;

if (SHA1Reset(&context) != shaSuccess) {
return -1;
}
sha1_init(&context);
for (i = 0; i < cfg.n; i++) {
if (SHA1Input(&context, (uint8_t *)cfg.names[i],
strlen(cfg.names[i])) != shaSuccess) {
return -1;
}
SHA1Input(&context, (uint8_t *)"\n", 1);
}
if (SHA1Result(&context, cfg_cookie) != shaSuccess) {
return -1;
sha1_update(&context, cfg.names[i], strlen(cfg.names[i]));
sha1_update(&context, "\n", 1);
}
sha1_final(&context, cfg_cookie);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ bool cfg_is_dirty(void);

void cfg_get_all(struct svec *);

#define CFG_COOKIE_LEN SHA1HashSize
#define CFG_COOKIE_LEN SHA1_DIGEST_SIZE
int cfg_get_cookie(uint8_t *cookie);

void cfg_buf_put(struct ofpbuf *buffer);
Expand Down
Loading

0 comments on commit 5eccf35

Please sign in to comment.