again changing // to /* */ so that sun's compiler doesn't fail.
(note these are all in source/blender/verify) Sorry about not putting the full path in on the last two, I just noticed it doesn't do that unless your in the root dir. mein@cs.umn.edu
This commit is contained in:
@@ -41,9 +41,10 @@ extern "C" {
|
|||||||
#include "BLO_sys_types.h"
|
#include "BLO_sys_types.h"
|
||||||
|
|
||||||
#define SIGNVERIFYHEADERSTRUCTSIZE sizeof(struct BLO_sign_verify_HeaderStruct)
|
#define SIGNVERIFYHEADERSTRUCTSIZE sizeof(struct BLO_sign_verify_HeaderStruct)
|
||||||
// TODO use reasonable sizes
|
/* TODO use reasonable sizes
|
||||||
// Tests showed: pubKeyLen 64, cryptedKeyLen 64 bytes
|
Tests showed: pubKeyLen 64, cryptedKeyLen 64 bytes
|
||||||
// So we pick 2*64 bytes + tail for now :
|
So we pick 2*64 bytes + tail for now : */
|
||||||
|
|
||||||
#define MAXPUBKEYLEN 130
|
#define MAXPUBKEYLEN 130
|
||||||
#define MAXSIGNATURELEN 130
|
#define MAXSIGNATURELEN 130
|
||||||
|
|
||||||
@@ -62,12 +63,12 @@ struct BLO_sign_verify_HeaderStruct {
|
|||||||
#define MAXSIGNERLEN 100
|
#define MAXSIGNERLEN 100
|
||||||
|
|
||||||
struct BLO_SignerHeaderStruct {
|
struct BLO_SignerHeaderStruct {
|
||||||
uint8_t name[MAXSIGNERLEN]; // the signers name (from the key)
|
uint8_t name[MAXSIGNERLEN]; /* the signers name (from the key) */
|
||||||
uint8_t email[MAXSIGNERLEN]; // the signers email (from the key)
|
uint8_t email[MAXSIGNERLEN]; /* the signers email (from the key) */
|
||||||
uint8_t homeUrl[MAXSIGNERLEN]; // the signers home page
|
uint8_t homeUrl[MAXSIGNERLEN]; /* the signers home page */
|
||||||
uint8_t text[MAXSIGNERLEN]; // optional additional user text
|
uint8_t text[MAXSIGNERLEN]; /* optional additional user text */
|
||||||
uint8_t pubKeyUrl1[MAXSIGNERLEN]; // the signers pubKey store
|
uint8_t pubKeyUrl1[MAXSIGNERLEN]; /* the signers pubKey store */
|
||||||
uint8_t pubKeyUrl2[MAXSIGNERLEN]; // the signers pubKey at NaN
|
uint8_t pubKeyUrl2[MAXSIGNERLEN]; /* the signers pubKey at NaN */
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -39,7 +39,7 @@ struct BLO_SignerInfo {
|
|||||||
char name[MAXSIGNERLEN];
|
char name[MAXSIGNERLEN];
|
||||||
char email[MAXSIGNERLEN];
|
char email[MAXSIGNERLEN];
|
||||||
char homeUrl[MAXSIGNERLEN];
|
char homeUrl[MAXSIGNERLEN];
|
||||||
// more to come...
|
/* more to come... */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BLO_SignerInfo *BLO_getSignerInfo(void);
|
struct BLO_SignerInfo *BLO_getSignerInfo(void);
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
#include "BLO_verify.h"
|
#include "BLO_verify.h"
|
||||||
#include "BLO_sign_verify_Header.h" /* used by verify and encrypt */
|
#include "BLO_sign_verify_Header.h" /* used by verify and encrypt */
|
||||||
|
|
||||||
#include "BLO_signer_info.h" // external signer info struct
|
#include "BLO_signer_info.h" /* external signer info struct */
|
||||||
|
|
||||||
static struct BLO_SignerInfo g_SignerInfo = {"", "", ""};
|
static struct BLO_SignerInfo g_SignerInfo = {"", "", ""};
|
||||||
|
|
||||||
@@ -202,9 +202,9 @@ BLO_verify_process(
|
|||||||
|
|
||||||
/* Is there really (still) new data available ? */
|
/* Is there really (still) new data available ? */
|
||||||
if (dataIn > 0) {
|
if (dataIn > 0) {
|
||||||
// BLO_SignerHeaderStruct
|
/* BLO_SignerHeaderStruct */
|
||||||
if (BLO_verify->signerHeader->name[0] == 0) {
|
if (BLO_verify->signerHeader->name[0] == 0) {
|
||||||
// we don't have our signerHeader complete yet
|
/* we don't have our signerHeader complete yet */
|
||||||
unsigned int processed;
|
unsigned int processed;
|
||||||
processed = ((dataIn + BLO_verify->streamDone -
|
processed = ((dataIn + BLO_verify->streamDone -
|
||||||
SIGNVERIFYHEADERSTRUCTSIZE) <= SIGNERHEADERSTRUCTSIZE)
|
SIGNVERIFYHEADERSTRUCTSIZE) <= SIGNERHEADERSTRUCTSIZE)
|
||||||
@@ -217,7 +217,7 @@ BLO_verify_process(
|
|||||||
data += processed;
|
data += processed;
|
||||||
if (BLO_verify->streamDone == SIGNVERIFYHEADERSTRUCTSIZE +
|
if (BLO_verify->streamDone == SIGNVERIFYHEADERSTRUCTSIZE +
|
||||||
SIGNERHEADERSTRUCTSIZE) {
|
SIGNERHEADERSTRUCTSIZE) {
|
||||||
// we have the whole header, absorb it
|
/* we have the whole header, absorb it */
|
||||||
struct BLO_SignerHeaderStruct *signerHeader;
|
struct BLO_SignerHeaderStruct *signerHeader;
|
||||||
signerHeader = (struct BLO_SignerHeaderStruct *)
|
signerHeader = (struct BLO_SignerHeaderStruct *)
|
||||||
BLO_verify->signerHeaderBuffer;
|
BLO_verify->signerHeaderBuffer;
|
||||||
@@ -246,12 +246,12 @@ BLO_verify_process(
|
|||||||
BLO_verify->signerHeader->pubKeyUrl1,
|
BLO_verify->signerHeader->pubKeyUrl1,
|
||||||
BLO_verify->signerHeader->pubKeyUrl2);
|
BLO_verify->signerHeader->pubKeyUrl2);
|
||||||
#endif
|
#endif
|
||||||
// also update the signature and crc checksum
|
/* also update the signature and crc checksum */
|
||||||
RIPEMD160_Update(&(BLO_verify->ripemd160_ctx),
|
RIPEMD160_Update(&(BLO_verify->ripemd160_ctx),
|
||||||
BLO_verify->signerHeaderBuffer,
|
BLO_verify->signerHeaderBuffer,
|
||||||
SIGNERHEADERSTRUCTSIZE);
|
SIGNERHEADERSTRUCTSIZE);
|
||||||
|
|
||||||
// update datacrc
|
/* update datacrc */
|
||||||
BLO_verify->datacrc = crc32(
|
BLO_verify->datacrc = crc32(
|
||||||
BLO_verify->datacrc, (const Bytef *)
|
BLO_verify->datacrc, (const Bytef *)
|
||||||
BLO_verify->signerHeaderBuffer,
|
BLO_verify->signerHeaderBuffer,
|
||||||
@@ -264,13 +264,13 @@ BLO_verify_process(
|
|||||||
if (dataIn > 0) {
|
if (dataIn > 0) {
|
||||||
RIPEMD160_Update(&(BLO_verify->ripemd160_ctx), data, dataIn);
|
RIPEMD160_Update(&(BLO_verify->ripemd160_ctx), data, dataIn);
|
||||||
|
|
||||||
// update datacrc
|
/* update datacrc */
|
||||||
BLO_verify->datacrc = crc32(
|
BLO_verify->datacrc = crc32(
|
||||||
BLO_verify->datacrc, (const Bytef *) data, dataIn);
|
BLO_verify->datacrc, (const Bytef *) data, dataIn);
|
||||||
|
|
||||||
BLO_verify->streamDone += dataIn;
|
BLO_verify->streamDone += dataIn;
|
||||||
|
|
||||||
// give data to streamGlueRead, it will find out what to do next
|
/* give data to streamGlueRead, it will find out what to do next */
|
||||||
err = readStreamGlue(
|
err = readStreamGlue(
|
||||||
BLO_verify->endControl,
|
BLO_verify->endControl,
|
||||||
&(BLO_verify->streamGlue),
|
&(BLO_verify->streamGlue),
|
||||||
@@ -365,16 +365,16 @@ BLO_verify_end(
|
|||||||
free(BLO_verify);
|
free(BLO_verify);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
// static exponent
|
/* static exponent */
|
||||||
rsa->e = BN_bin2bn(rsa_e, sizeof(rsa_e)-1, rsa->e);
|
rsa->e = BN_bin2bn(rsa_e, sizeof(rsa_e)-1, rsa->e);
|
||||||
|
|
||||||
// public part into rsa->n
|
/* public part into rsa->n */
|
||||||
rsa->n = BN_bin2bn(BLO_verify->streamHeader->pubKey,
|
rsa->n = BN_bin2bn(BLO_verify->streamHeader->pubKey,
|
||||||
BLO_verify->streamHeader->pubKeyLen,
|
BLO_verify->streamHeader->pubKeyLen,
|
||||||
rsa->n);
|
rsa->n);
|
||||||
//DEBUG RSA_print_fp(stdout, rsa, 0);
|
/*DEBUG RSA_print_fp(stdout, rsa, 0); */
|
||||||
|
|
||||||
// verify the signature
|
/* verify the signature */
|
||||||
verifySuccess = RSA_verify(NID_ripemd160, digest, RIPEMD160_DIGEST_LENGTH,
|
verifySuccess = RSA_verify(NID_ripemd160, digest, RIPEMD160_DIGEST_LENGTH,
|
||||||
BLO_verify->streamHeader->signature,
|
BLO_verify->streamHeader->signature,
|
||||||
BLO_verify->streamHeader->signatureLen, rsa);
|
BLO_verify->streamHeader->signatureLen, rsa);
|
||||||
@@ -392,12 +392,12 @@ BLO_verify_end(
|
|||||||
BRS_SETSPECERR(BRS_SIGFAILED);
|
BRS_SETSPECERR(BRS_SIGFAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy signer information to external struct
|
/* copy signer information to external struct */
|
||||||
|
|
||||||
strncpy(g_SignerInfo.name, BLO_verify->signerHeader->name, MAXSIGNERLEN-1);
|
strncpy(g_SignerInfo.name, BLO_verify->signerHeader->name, MAXSIGNERLEN-1);
|
||||||
strncpy(g_SignerInfo.email, BLO_verify->signerHeader->email, MAXSIGNERLEN-1);
|
strncpy(g_SignerInfo.email, BLO_verify->signerHeader->email, MAXSIGNERLEN-1);
|
||||||
strncpy(g_SignerInfo.homeUrl, BLO_verify->signerHeader->homeUrl, MAXSIGNERLEN-1);
|
strncpy(g_SignerInfo.homeUrl, BLO_verify->signerHeader->homeUrl, MAXSIGNERLEN-1);
|
||||||
//
|
|
||||||
free(digest);
|
free(digest);
|
||||||
free(BLO_verify->streamGlue);
|
free(BLO_verify->streamGlue);
|
||||||
free(BLO_verify->streamHeader);
|
free(BLO_verify->streamHeader);
|
||||||
|
Reference in New Issue
Block a user