Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.c

Issue 21968004: Updated usrsctp to fix various issues for windows (using changes pushed upstream) and unified SHA1 … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed indent Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /*- 1 /*-
2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 2 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 3 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
4 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 4 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
8 * 8 *
9 * a) Redistributions of source code must retain the above copyright notice, 9 * a) Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer. 10 * this list of conditions and the following disclaimer.
(...skipping 20 matching lines...) Expand all
31 */ 31 */
32 32
33 #ifdef __FreeBSD__ 33 #ifdef __FreeBSD__
34 #include <sys/cdefs.h> 34 #include <sys/cdefs.h>
35 __FBSDID("$FreeBSD$"); 35 __FBSDID("$FreeBSD$");
36 #endif 36 #endif
37 37
38 #ifdef SCTP_USE_NSS_SHA1 38 #ifdef SCTP_USE_NSS_SHA1
39 #include <netinet/sctp_nss_sha1.h> 39 #include <netinet/sctp_nss_sha1.h>
40 40
41 /* A SHA-1 Digest is 160 bits, or 20 bytes */
42 #define SHA_DIGEST_LENGTH (20)
43
41 void 44 void
42 SCTP_NSS_SHA1_Init(struct sha1_context *ctx) 45 SCTP_NSS_SHA1_Init(struct sha1_context *ctx)
43 { 46 {
44 ctx->pk11_ctx = PK11_CreateDigestContext(SEC_OID_SHA1); 47 ctx->pk11_ctx = PK11_CreateDigestContext(SEC_OID_SHA1);
45 PK11_DigestBegin(ctx->pk11_ctx); 48 PK11_DigestBegin(ctx->pk11_ctx);
46 } 49 }
47 50
48 void 51 void
49 SCTP_NSS_SHA1_Update(struct sha1_context *ctx, const unsigned char *ptr, int siz ) 52 SCTP_NSS_SHA1_Update(struct sha1_context *ctx, const unsigned char *ptr, int siz )
50 { 53 {
51 PK11_DigestOp(ctx->pk11_ctx, ptr, siz); 54 PK11_DigestOp(ctx->pk11_ctx, ptr, siz);
52 } 55 }
53 56
54 void 57 void
55 SCTP_NSS_SHA1_Final(unsigned char *digest, struct sha1_context *ctx) 58 SCTP_NSS_SHA1_Final(unsigned char *digest, struct sha1_context *ctx)
56 { 59 {
57 unsigned int output_len = 0; 60 unsigned int output_len = 0;
58 » PK11_DigestFinal(ctx->pk11_ctx, digest, &output_len, sizeof(digest)); 61 » PK11_DigestFinal(ctx->pk11_ctx, digest, &output_len, SHA_DIGEST_LENGTH);
59 PK11_DestroyContext(ctx->pk11_ctx, PR_TRUE); 62 PK11_DestroyContext(ctx->pk11_ctx, PR_TRUE);
60 } 63 }
61 #endif 64 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698