mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-26 19:25:02 +00:00
Revert "VBoot Reference: Refactor Part 2 - Crypto Libraries"
This reverts commit e018a80a37aaa45681f45f5852f04d20aedd8b2d. Review URL: http://codereview.chromium.org/1593002
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "cryptolib.h"
|
||||
#include "padding.h"
|
||||
#include "rsa_utility.h"
|
||||
#include "signature_digest.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -59,27 +60,6 @@ RSAPublicKey* RSAPublicKeyFromFile(const char* input_file) {
|
||||
return key;
|
||||
}
|
||||
|
||||
uint8_t* DigestFile(char* input_file, int sig_algorithm) {
|
||||
int input_fd, len;
|
||||
uint8_t data[SHA1_BLOCK_SIZE];
|
||||
uint8_t* digest = NULL;
|
||||
DigestContext ctx;
|
||||
|
||||
if( (input_fd = open(input_file, O_RDONLY)) == -1 ) {
|
||||
debug("Couldn't open input file.\n");
|
||||
return NULL;
|
||||
}
|
||||
DigestInit(&ctx, sig_algorithm);
|
||||
while ( (len = read(input_fd, data, SHA1_BLOCK_SIZE)) ==
|
||||
SHA1_BLOCK_SIZE)
|
||||
DigestUpdate(&ctx, data, len);
|
||||
if (len != -1)
|
||||
DigestUpdate(&ctx, data, len);
|
||||
digest = DigestFinal(&ctx);
|
||||
close(input_fd);
|
||||
return digest;
|
||||
}
|
||||
|
||||
uint8_t* SignatureFile(const char* input_file, const char* key_file,
|
||||
int algorithm) {
|
||||
char* sign_utility = "./sign_data.sh";
|
||||
|
||||
Reference in New Issue
Block a user