diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2017-12-01 12:46:20 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2017-12-01 12:46:20 +0000 |
commit | 3f77d0944006d98d130349a35d3bf65399df67b6 (patch) | |
tree | f8fd50737ec835829e925262e94d5a46782df75b /usr/src/common/crypto/modes/ctr.c | |
parent | 319ffd7b00d357d8bcc5a3ab337a6a870bf0faa6 (diff) | |
parent | cd964fce751ca752af4158842063a9579a2d4331 (diff) | |
download | illumos-joyent-3f77d0944006d98d130349a35d3bf65399df67b6.tar.gz |
[illumos-gate merge]
commit cd964fce751ca752af4158842063a9579a2d4331
5869 Need AES CMAC support in KCF+PKCS11
commit 6dfcdabd85f09409c5d2f9fb25a3013384ffaf74
8800 loader: use the same option list for dhcp discovery and request
commit dfbc6f2daa6bb8fc06fad985ead27d5db30eab3a
8799 loader: Always issue the pxe request
commit 494a2e4857c10ebf74b8a5652d96466bd9e02f2c
8865 nightly shouldn't depend on specific /usr/bin/egrep behavior
Diffstat (limited to 'usr/src/common/crypto/modes/ctr.c')
-rw-r--r-- | usr/src/common/crypto/modes/ctr.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/usr/src/common/crypto/modes/ctr.c b/usr/src/common/crypto/modes/ctr.c index e44dc3e642..919ed3ab53 100644 --- a/usr/src/common/crypto/modes/ctr.c +++ b/usr/src/common/crypto/modes/ctr.c @@ -169,13 +169,9 @@ ctr_mode_final(ctr_ctx_t *ctx, crypto_data_t *out, int (*encrypt_block)(const void *, const uint8_t *, uint8_t *)) { uint8_t *lastp; - void *iov_or_mp; - offset_t offset; - uint8_t *out_data_1; - uint8_t *out_data_2; - size_t out_data_1_len; uint8_t *p; int i; + int rv; if (out->cd_length < ctx->ctr_remainder_len) return (CRYPTO_DATA_LEN_RANGE); @@ -189,23 +185,17 @@ ctr_mode_final(ctr_ctx_t *ctx, crypto_data_t *out, p[i] ^= lastp[i]; } - crypto_init_ptrs(out, &iov_or_mp, &offset); - crypto_get_ptrs(out, &iov_or_mp, &offset, &out_data_1, - &out_data_1_len, &out_data_2, ctx->ctr_remainder_len); - - bcopy(p, out_data_1, out_data_1_len); - if (out_data_2 != NULL) { - bcopy((uint8_t *)p + out_data_1_len, - out_data_2, ctx->ctr_remainder_len - out_data_1_len); + rv = crypto_put_output_data(p, out, ctx->ctr_remainder_len); + if (rv == CRYPTO_SUCCESS) { + out->cd_offset += ctx->ctr_remainder_len; + ctx->ctr_remainder_len = 0; } - out->cd_offset += ctx->ctr_remainder_len; - ctx->ctr_remainder_len = 0; - return (CRYPTO_SUCCESS); + return (rv); } int ctr_init_ctx(ctr_ctx_t *ctr_ctx, ulong_t count, uint8_t *cb, -void (*copy_block)(uint8_t *, uint8_t *)) + void (*copy_block)(uint8_t *, uint8_t *)) { uint64_t upper_mask = 0; uint64_t lower_mask = 0; |