hm_pmeth.c (302408) | hm_pmeth.c (325335) |
---|---|
1/* 2 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 3 * 2007. 4 */ 5/* ==================================================================== 6 * Copyright (c) 2007 The OpenSSL Project. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 85 unchanged lines hidden (view full) --- 94static int pkey_hmac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) 95{ 96 HMAC_PKEY_CTX *sctx, *dctx; 97 if (!pkey_hmac_init(dst)) 98 return 0; 99 sctx = src->data; 100 dctx = dst->data; 101 dctx->md = sctx->md; | 1/* 2 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 3 * 2007. 4 */ 5/* ==================================================================== 6 * Copyright (c) 2007 The OpenSSL Project. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 85 unchanged lines hidden (view full) --- 94static int pkey_hmac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) 95{ 96 HMAC_PKEY_CTX *sctx, *dctx; 97 if (!pkey_hmac_init(dst)) 98 return 0; 99 sctx = src->data; 100 dctx = dst->data; 101 dctx->md = sctx->md; |
102 HMAC_CTX_init(&dctx->ctx); | |
103 if (!HMAC_CTX_copy(&dctx->ctx, &sctx->ctx)) | 102 if (!HMAC_CTX_copy(&dctx->ctx, &sctx->ctx)) |
104 return 0; 105 if (sctx->ktmp.data) { | 103 goto err; 104 if (sctx->ktmp.data != NULL) { |
106 if (!ASN1_OCTET_STRING_set(&dctx->ktmp, 107 sctx->ktmp.data, sctx->ktmp.length)) | 105 if (!ASN1_OCTET_STRING_set(&dctx->ktmp, 106 sctx->ktmp.data, sctx->ktmp.length)) |
108 return 0; | 107 goto err; |
109 } 110 return 1; | 108 } 109 return 1; |
110 err: 111 HMAC_CTX_cleanup(&dctx->ctx); 112 OPENSSL_free(dctx); 113 return 0; |
|
111} 112 113static void pkey_hmac_cleanup(EVP_PKEY_CTX *ctx) 114{ 115 HMAC_PKEY_CTX *hctx = ctx->data; 116 HMAC_CTX_cleanup(&hctx->ctx); 117 if (hctx->ktmp.data) { 118 if (hctx->ktmp.length) --- 144 unchanged lines hidden --- | 114} 115 116static void pkey_hmac_cleanup(EVP_PKEY_CTX *ctx) 117{ 118 HMAC_PKEY_CTX *hctx = ctx->data; 119 HMAC_CTX_cleanup(&hctx->ctx); 120 if (hctx->ktmp.data) { 121 if (hctx->ktmp.length) --- 144 unchanged lines hidden --- |