projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Set cipher IV as octet string and pointer from providers
[openssl.git]
/
providers
/
implementations
/
ciphers
/
ciphercommon_gcm.c
diff --git
a/providers/implementations/ciphers/ciphercommon_gcm.c
b/providers/implementations/ciphers/ciphercommon_gcm.c
index a6928e1ba36f7802aed5af08b4c3fe02c82b2cfa..06fbbd07aaf6b68a744c6bb676b3f8e00dd8fe44 100644
(file)
--- a/
providers/implementations/ciphers/ciphercommon_gcm.c
+++ b/
providers/implementations/ciphers/ciphercommon_gcm.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019
-2020
The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@
-12,7
+12,7
@@
#include "prov/ciphercommon.h"
#include "prov/ciphercommon_gcm.h"
#include "prov/providercommonerr.h"
#include "prov/ciphercommon.h"
#include "prov/ciphercommon_gcm.h"
#include "prov/providercommonerr.h"
-#include
"crypto/rand.h"
+#include
<openssl/rand.h>
#include "prov/provider_ctx.h"
static int gcm_tls_init(PROV_GCM_CTX *dat, unsigned char *aad, size_t aad_len);
#include "prov/provider_ctx.h"
static int gcm_tls_init(PROV_GCM_CTX *dat, unsigned char *aad, size_t aad_len);
@@
-160,7
+160,8
@@
int gcm_get_ctx_params(void *vctx, OSSL_PARAM params[])
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
return 0;
}
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH);
return 0;
}
- if (!OSSL_PARAM_set_octet_string(p, ctx->iv, ctx->ivlen)) {
+ if (!OSSL_PARAM_set_octet_string(p, ctx->iv, ctx->ivlen)
+ && !OSSL_PARAM_set_octet_ptr(p, &ctx->iv, ctx->ivlen)) {
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SET_PARAMETER);
return 0;
}
@@
-338,7
+339,7
@@
static int gcm_iv_generate(PROV_GCM_CTX *ctx, int offset)
return 0;
/* Use DRBG to generate random iv */
return 0;
/* Use DRBG to generate random iv */
- if (
rand
_bytes_ex(ctx->libctx, ctx->iv + offset, sz) <= 0)
+ if (
RAND
_bytes_ex(ctx->libctx, ctx->iv + offset, sz) <= 0)
return 0;
ctx->iv_state = IV_STATE_BUFFERED;
ctx->iv_gen_rand = 1;
return 0;
ctx->iv_state = IV_STATE_BUFFERED;
ctx->iv_gen_rand = 1;
@@
-452,7
+453,7
@@
static int gcm_tls_iv_set_fixed(PROV_GCM_CTX *ctx, unsigned char *iv,
if (len > 0)
memcpy(ctx->iv, iv, len);
if (ctx->enc
if (len > 0)
memcpy(ctx->iv, iv, len);
if (ctx->enc
- &&
rand
_bytes_ex(ctx->libctx, ctx->iv + len, ctx->ivlen - len) <= 0)
+ &&
RAND
_bytes_ex(ctx->libctx, ctx->iv + len, ctx->ivlen - len) <= 0)
return 0;
ctx->iv_gen = 1;
ctx->iv_state = IV_STATE_BUFFERED;
return 0;
ctx->iv_gen = 1;
ctx->iv_state = IV_STATE_BUFFERED;