Browse Source

z/OS support: Some cleanup

master
David Lanzendörfer 12 months ago
parent
commit
ecbba3c427
1 changed files with 6 additions and 24 deletions
  1. +6
    -24
      src/gskssl_crypto.c

+ 6
- 24
src/gskssl_crypto.c View File

@ -117,8 +117,6 @@ md5_finish(pgp_hash_t *hash, uint8_t *out)
if (pgp_get_debug_level(__FILE__)) {
hexdump(stderr, "md5_finish", out, len);
}
free(hash->data);
hash->data = NULL;
rv = funcs->C_CloseSession( *(hash->session) );
if( rv != CKR_OK) {
@ -261,28 +259,20 @@ sha1_finish(pgp_hash_t *hash, uint8_t *out)
{
CK_RV rv;
CK_ULONG len = PGP_SHA1_HASH_SIZE;
uint8_t *temp = malloc(PGP_SHA1_HASH_SIZE);
memset(temp,0,PGP_SHA1_HASH_SIZE);
memset(out,0,PGP_SHA1_HASH_SIZE);
CK_ULONG l;
rv = funcs->C_GetOperationState(*(hash->session), NULL_PTR, &len);
while( rv != CKR_OK) {}
rv = funcs->C_GetOperationState(*(hash->session), NULL_PTR, &l);
while( rv != CKR_OK ) {}
rv = funcs->C_DigestFinal(*(hash->session), temp, &len);
rv = funcs->C_DigestFinal(*(hash->session), out, &len);
if( rv != CKR_OK) {
fprintf(stderr, "C_DigestFinal: rv = 0x%.8lX\n", rv);
}
if (pgp_get_debug_level(__FILE__)) {
hexdump(stderr, "sha1_finish", temp, 20);
hexdump(stderr, "sha1_finish", out, PGP_SHA1_HASH_SIZE);
}
//memcpy(out,temp,len);
free(temp);
free(hash->data);
hash->data = NULL;
rv = funcs->C_CloseSession( *(hash->session) );
if( rv != CKR_OK) {
fprintf(stderr, "C_CloseSession: rv = 0x%.8lX\n", rv);
@ -295,7 +285,7 @@ sha1_finish(pgp_hash_t *hash, uint8_t *out)
free(hash->session);
return len;
return SHA_DIGEST_LENGTH;
}
static const pgp_hash_t sha1 = {
@ -371,8 +361,6 @@ sha256_finish(pgp_hash_t *hash, uint8_t *out)
if (pgp_get_debug_level(__FILE__)) {
hexdump(stderr, "sha256_finish", out, len);
}
free(hash->data);
hash->data = NULL;
rv = funcs->C_CloseSession( *(hash->session) );
if( rv != CKR_OK) {
@ -460,8 +448,6 @@ sha384_finish(pgp_hash_t *hash, uint8_t *out)
if (pgp_get_debug_level(__FILE__)) {
hexdump(stderr, "sha384_finish", out, len);
}
free(hash->data);
hash->data = NULL;
rv = funcs->C_CloseSession( *(hash->session) );
if( rv != CKR_OK) {
@ -549,8 +535,6 @@ sha512_finish(pgp_hash_t *hash, uint8_t *out)
if (pgp_get_debug_level(__FILE__)) {
hexdump(stderr, "sha512_finish", out, len);
}
free(hash->data);
hash->data = NULL;
rv = funcs->C_CloseSession( *(hash->session) );
if( rv != CKR_OK) {
@ -639,8 +623,6 @@ sha224_finish(pgp_hash_t *hash, uint8_t *out)
if (pgp_get_debug_level(__FILE__)) {
hexdump(stderr, "sha224_finish", out, len);
}
free(hash->data);
hash->data = NULL;
rv = funcs->C_CloseSession( *(hash->session) );
if( rv != CKR_OK) {


Loading…
Cancel
Save