dsa_ameth.c (325337) | dsa_ameth.c (326663) |
---|---|
1/* 2 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 3 * 2006. 4 */ 5/* ==================================================================== 6 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 119 unchanged lines hidden (view full) --- 128 129static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) 130{ 131 DSA *dsa; 132 int ptype; 133 unsigned char *penc = NULL; 134 int penclen; 135 ASN1_STRING *str = NULL; | 1/* 2 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 3 * 2006. 4 */ 5/* ==================================================================== 6 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 119 unchanged lines hidden (view full) --- 128 129static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) 130{ 131 DSA *dsa; 132 int ptype; 133 unsigned char *penc = NULL; 134 int penclen; 135 ASN1_STRING *str = NULL; |
136 ASN1_OBJECT *aobj; |
|
136 137 dsa = pkey->pkey.dsa; 138 if (pkey->save_parameters && dsa->p && dsa->q && dsa->g) { 139 str = ASN1_STRING_new(); 140 if (!str) { 141 DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); 142 goto err; 143 } --- 10 unchanged lines hidden (view full) --- 154 155 penclen = i2d_DSAPublicKey(dsa, &penc); 156 157 if (penclen <= 0) { 158 DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); 159 goto err; 160 } 161 | 137 138 dsa = pkey->pkey.dsa; 139 if (pkey->save_parameters && dsa->p && dsa->q && dsa->g) { 140 str = ASN1_STRING_new(); 141 if (!str) { 142 DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); 143 goto err; 144 } --- 10 unchanged lines hidden (view full) --- 155 156 penclen = i2d_DSAPublicKey(dsa, &penc); 157 158 if (penclen <= 0) { 159 DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); 160 goto err; 161 } 162 |
162 if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_DSA), 163 ptype, str, penc, penclen)) | 163 aobj = OBJ_nid2obj(EVP_PKEY_DSA); 164 if (aobj == NULL) 165 goto err; 166 167 if (X509_PUBKEY_set0_param(pk, aobj, ptype, str, penc, penclen)) |
164 return 1; 165 166 err: 167 if (penc) 168 OPENSSL_free(penc); 169 if (str) 170 ASN1_STRING_free(str); 171 --- 508 unchanged lines hidden --- | 168 return 1; 169 170 err: 171 if (penc) 172 OPENSSL_free(penc); 173 if (str) 174 ASN1_STRING_free(str); 175 --- 508 unchanged lines hidden --- |