Browse Source

Fix memory leaks in LEDAkem

kyber
Thom Wiggers 4 years ago
committed by Kris Kwiatkowski
parent
commit
d8c9c431cf
3 changed files with 7 additions and 4 deletions
  1. +3
    -2
      crypto_kem/ledakemlt12/leaktime/rng.c
  2. +2
    -1
      crypto_kem/ledakemlt32/leaktime/rng.c
  3. +2
    -1
      crypto_kem/ledakemlt52/leaktime/rng.c

+ 3
- 2
crypto_kem/ledakemlt12/leaktime/rng.c View File

@@ -81,7 +81,7 @@ int PQCLEAN_LEDAKEMLT12_LEAKTIME_seedexpander(AES_XOF_struct *ctx, uint8_t *x, s
memcpy(x + offset, ctx->buffer + ctx->buffer_pos, xlen);
ctx->buffer_pos += xlen;

return RNG_SUCCESS;
goto end;
}

// take what's in the buffer
@@ -103,7 +103,8 @@ int PQCLEAN_LEDAKEMLT12_LEAKTIME_seedexpander(AES_XOF_struct *ctx, uint8_t *x, s
}

}
aes256_ctx_release(&ctx256);
end:

aes256_ctx_release(&ctx256);
return RNG_SUCCESS;
}

+ 2
- 1
crypto_kem/ledakemlt32/leaktime/rng.c View File

@@ -81,7 +81,7 @@ int PQCLEAN_LEDAKEMLT32_LEAKTIME_seedexpander(AES_XOF_struct *ctx, uint8_t *x, s
memcpy(x + offset, ctx->buffer + ctx->buffer_pos, xlen);
ctx->buffer_pos += xlen;

return RNG_SUCCESS;
goto end;
}

// take what's in the buffer
@@ -103,6 +103,7 @@ int PQCLEAN_LEDAKEMLT32_LEAKTIME_seedexpander(AES_XOF_struct *ctx, uint8_t *x, s
}

}
end:
aes256_ctx_release(&ctx256);

return RNG_SUCCESS;


+ 2
- 1
crypto_kem/ledakemlt52/leaktime/rng.c View File

@@ -81,7 +81,7 @@ int PQCLEAN_LEDAKEMLT52_LEAKTIME_seedexpander(AES_XOF_struct *ctx, uint8_t *x, s
memcpy(x + offset, ctx->buffer + ctx->buffer_pos, xlen);
ctx->buffer_pos += xlen;

return RNG_SUCCESS;
goto end;
}

// take what's in the buffer
@@ -103,6 +103,7 @@ int PQCLEAN_LEDAKEMLT52_LEAKTIME_seedexpander(AES_XOF_struct *ctx, uint8_t *x, s
}

}
end:
aes256_ctx_release(&ctx256);

return RNG_SUCCESS;


Loading…
Cancel
Save