memset, memcpy, sizeof consistency fixes
[openssl.git] / demos / engines / ibmca / hw_ibmca.c
index 820abe862ef78d2132d915cc550165283ff78b7f..5017d6490daf1d90f02abbc0d29b03ee3f037a5a 100644 (file)
@@ -506,7 +506,7 @@ static int ibmca_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
     if (publKey == NULL) {
         goto err;
     }
-    memset(publKey, 0, sizeof(ICA_KEY_RSA_MODEXPO));
+    memset(publKey, 0, sizeof(*publKey));
 
     publKey->keyType = CORRECT_ENDIANNESS(ME_KEY_TYPE);
     publKey->keyLength = CORRECT_ENDIANNESS(sizeof(ICA_KEY_RSA_MODEXPO));
@@ -596,8 +596,7 @@ static int ibmca_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
                                       rsa->dmq1, rsa->iqmp, ctx);
     }
  err:
-    if (ctx)
-        BN_CTX_free(ctx);
+    BN_CTX_free(ctx);
     return to_return;
 }
 #  endif
@@ -671,7 +670,7 @@ static int ibmca_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
 
 /* end SAB additions */
 
-    memset(privKey, 0, sizeof(ICA_KEY_RSA_CRT));
+    memset(privKey, 0, sizeof(*privKey));
     privKey->keyType = CORRECT_ENDIANNESS(CRT_KEY_TYPE);
     privKey->keyLength = CORRECT_ENDIANNESS(sizeof(ICA_KEY_RSA_CRT));
     privKey->modulusBitLength = CORRECT_ENDIANNESS(BN_num_bytes(q) * 2 * 8);