Fix strange formatting by indent
[openssl.git] / engines / ccgost / gost94_keyx.c
index a183edbe8b61ca63ce6bd9763e54065547f5d11a..52d189ca8b74146ae97687a12c1b5c72a71b020d 100644 (file)
@@ -4,8 +4,8 @@
  *         This file is distributed under the same license as OpenSSL *
  *                                                                    *
  *     Implements generation and parsing of GOST_KEY_TRANSPORT for    *
- *                             GOST R 34.10-94 algorithms                            *
- *                                                                                                                                       *
+ *              GOST R 34.10-94 algorithms                            *
+ *                                                                    *
  *          Requires OpenSSL 0.9.9 for compilation                    *
  **********************************************************************/
 #include <string.h>
@@ -177,7 +177,7 @@ int pkey_GOST94cp_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
        ASN1_OBJECT_free(gkt->key_agreement_info->cipher);
        gkt->key_agreement_info->cipher = OBJ_nid2obj(param->nid);
        *outlen = i2d_GOST_KEY_TRANSPORT(gkt,out?&out:NULL);
-       if (*outlen == 0)
+       if (*outlen <= 0)
                {
                GOSTerr(GOST_F_PKEY_GOST94CP_ENCRYPT,GOST_R_ERROR_PACKING_KEY_TRANSPORT_INFO);
                goto err;
@@ -261,6 +261,10 @@ int pkey_GOST94cp_decrypt(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *key_len
                }
 
        param = get_encryption_params(gkt->key_agreement_info->cipher);
+    if(!param){
+        goto err;
+    }
+       
        gost_init(&cctx,param->sblock); 
        OPENSSL_assert(gkt->key_agreement_info->eph_iv->length==8);
        memcpy(wrappedKey,gkt->key_agreement_info->eph_iv->data,8);