liboauth/backport-pedantic-ANSI-ISO-C-89-90-for-MSVC-2013-fixes-2.patch
yixiangzhike b9a98adda0 Use openssl instead of nss to fix failure for RSA-SHA1 signature
(cherry picked from commit b8055739468f47d2541eca35a4c855f99beab116)
2024-07-22 11:27:41 +08:00

53 lines
1.5 KiB
Diff

From 3d5fd48ddcc1a844251fe92004a98936b2d7eb69 Mon Sep 17 00:00:00 2001
From: Robin Gareus <robin@gareus.org>
Date: Tue, 1 Jul 2014 14:32:27 +0200
Subject: [PATCH] pedantic ANSI ISO-C 89/90 for MSVC 2013 - fixes #2
---
src/hash.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/hash.c b/src/hash.c
index 17ff5c8..a337b0e 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -48,12 +48,13 @@ char *oauth_sign_hmac_sha1 (const char *m, const char *k) {
}
char *oauth_body_hash_file(char *filename) {
- FILE *F= fopen(filename, "r");
- if (!F) return NULL;
-
size_t len=0;
char fb[BUFSIZ];
sha1nfo s;
+
+ FILE *F= fopen(filename, "r");
+
+ if (!F) return NULL;
sha1_init(&s);
while (!feof(F) && (len=fread(fb,sizeof(char),BUFSIZ, F))>0) {
@@ -271,7 +272,8 @@ char *oauth_body_hash_file(char *filename) {
SECStatus s;
char *rv=NULL;
size_t bl;
- unsigned char fb[BUFSIZ];
+ unsigned char fb[BUFSIZ];
+ unsigned char *dgst;
FILE *F= fopen(filename, "r");
if (!F) return NULL;
@@ -292,7 +294,7 @@ char *oauth_body_hash_file(char *filename) {
s = PK11_DigestFinal(context, digest, &len, sizeof digest);
if (s != SECSuccess) goto looser;
- unsigned char *dgst = xmalloc(len*sizeof(char)); // oauth_body_hash_encode frees the digest..
+ dgst = xmalloc(len*sizeof(char)); // oauth_body_hash_encode frees the digest..
memcpy(dgst, digest, len);
rv=oauth_body_hash_encode(len, dgst);
--
2.33.0